Skip to main content

Transformations

Many functions, like ImageSprite and PolygonCollider, require attaching a shape to a body at a particular position. When the body moves or rotates, the shape moves and rotates with it. Easel has a number of common parameters that can be used to define how the position and orientation of the shape relates to the body and the screen.

Sprite space​

The following parameters affect the sprite itself:

  • scale - scales the sprite around sprite's origin.
  • angleOffset rotates the sprite around the sprite's origin.

Body space​

  • bodyOffset - defines the relative position of the sprite to the body's position.
  • bodyScale - scales the sprite around the body's origin.
  • heading - rotates the sprite around the body's origin, unless noRotation=true.

Screen space​

  • screenOffset - offsets the shape along the horizontal and vertical axes of the screen.

Functions that take transformation parameters​

You will see these parameters on functions like:

Not all parameters are used by all functions. For example, PolygonCollider does not use screenOffset as the concept of a "screen" or a "camera" does not exist for the physics engine.