Displays a group of sprites. If no parameter is specified, draws all sprites in the sketch.
For an animation, drawSprites is usually used along with background()
within draw()
. The drawing order is determined by the order the sprites were created, which is stored and can be altered in sprite.depth
.
var sprite = createSprite(); drawSprites();
Animate a spinning square using the draw loop, background, and drawSprites commands.
// Animate a spinning square using the draw loop, background, and drawSprites commands. var sprite = createSprite(200,200); function draw() { background("white"); sprite.rotation = sprite.rotation + 10; drawSprites(); }
drawSprites(group)
Name | Type | Required? | Description |
---|---|---|---|
group | Object | The label of the group of sprites to be displayed. |
No return value. Changes output to the display only.
Found a bug in the documentation? Let us know at documentation@code.org