Clockwise rotation change in degrees per frame of the sprite.
A positive value will rotate clockwise, a negative value will rotate counterclockwise. Must be used with the draw() function containing a drawSprites().
The default rotationSpeed is 0. All sprite properties can be both accessed and updated.
var sprite = createSprite(200, 200);
sprite.rotationSpeed=10;
function draw() {
background("white");
drawSprites();
}
Make the sprite spin faster and faster when the mouse moves.
// Make the sprite spin faster and faster when the mouse moves.
var sprite = createSprite(200, 200);
function draw() {
background("white");
if (mouseDidMove()) sprite.rotationSpeed=sprite.rotationSpeed+1;
drawSprites();
}
sprite.rotationSpeed
The clockwise rotation speed.
rotation within the draw() function.World.frameRate will affect the rotationSpeed.getDirection instead.drawSprites() is called.Found a bug in the documentation? Let us know at documentation@code.org