Rotate counterclockwise
Rotate a sprite counterclockwise around a coordinate point by a given angle.
motionrotate
Scripts
Main
define Rotate counterclockwise about (x :: custom-arg) (y :: custom-arg) (angle :: custom-arg) degrees
set [dx v] to ((x position) - (x position :: custom-arg))
set [dy v] to ((y position) - (y position :: custom-arg))
change x by ((((dx) * ([cos v] of (angle :: custom-arg))) - ((dy) * ([sin v] of (angle :: custom-arg)))) - (dx))
change y by ((((dx) * ([sin v] of (angle :: custom-arg))) + ((dy) * ([cos v] of (angle :: custom-arg)))) - (dy))
Variables / Lists
| Name | Type | Scope |
|---|
| dx | Variable | Sprite |
| dy | Variable | Sprite |