Can anyone assist me in determining the algorithm to calculate the position of a shadow based on the object's rotation?
For instance, suppose I have a PNG image with
-webkit-filter: drop-shadow(rgba(0, 0, 0, 0.5) Xpx Ypx 0px);
and -webkit-transform: rotate(Zdeg);
I am looking to create a jQuery script that can determine the values of X
and Y
(shadow position) based on the rotation angle Z
in degrees.
Through experimentation, I have compiled the following table:
X | -5| -5| 0 | 5 | 5 | 5 | 0 | -5| -5| – Shadow position
Y | 0 | 5 | 5 | 5 | 0 | -5| -5| -5| 0 | – Shadow position
Z | 0 | 45| 90|135|180|225|270|315|360| – Rotation