group.setRotationSpeedEach()

Category:Groups

Clockwise rotation change in degrees per frame of every sprite in the group.

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.

Examples

var group = createGroup();
group.add(createSprite(100, 200));
group.add(createSprite(300, 200));
function draw() {
  background("white");
  drawSprites();
  if (mouseDown("leftButton")){
    group.setRotationSpeedEach(5);
  }
  else {
    group.setRotationSpeedEach(-5);
  }
}

Syntax

group.setRotationSpeedEach(speed)

Parameters

Name Type Required? Description
speed Number The clockwise rotation speed.

Returns

No return value. Changes output in the display after drawSprites() is called.

Tips

  • Groups of sprites all have the same functions and you use the dot notation (combining the name of the group, followed by a dot, with the function name) to call the function for that group of sprites.
  • Any changes to the properties of a sprite will not be seen until after drawSprites() is called.

Found a bug in the documentation? Let us know at documentation@code.org