All examples · Sprites and 2D · As Markdown, for AIs

Pivot

What this example shows

anchor says where a sprite sits; pivot says what it turns and grows about. Both are in 0-1 of its own size, and the pivot is the anchor unless it says otherwise. Unturned and ungrown, a sprite sits as its anchor says, whatever its pivot.

The two bikes are anchored under their back wheel, so they stand on the ground at the same point. Crashed, the one with no pivot turns about that wheel, through the floor; the one with pivot: { x: 0.5, y: 0.5 } somersaults about its middle and lands where it was. Texts and panels take a pivot too, and a box that turns its sprite turns it about the pivot.

Click the preview first so it hears the keyboard. Space crashes both.

Starting
Starting
—