Skip to content

Keyframe

Type key: KEYFRAME

Rotation in degrees, clockwise. Type float, default 0.

Whether the timeline advances on its own. Type bool, default True.

Whether the object takes part in collision tests. Type bool, default False.

Shift of the shape away from the object centre (not for bbox). Type float, default 0.

Vertices of a polygon shape. Type list, default [].

Shape used for collisions: 'bbox', 'rect', 'ellipse' or 'polygon'. Type str, default 'rect'.

Size of the shape used by rect and ellipse. Type float, default = the object’s size.

Fill color, text color or image tint, depending on the type. Type (r, g, b, a), default (255, 255, 255, 255).

Length of the timeline in seconds; the timeline always lasts at least until the last keyframe. Type float, default 2.0.

Image drawn as the object itself, relative to the project; it is stretched to width/height and tinted by the color. Empty draws a plain color box. A keyframe can carry its own image_path (see the keyframes property): the timeline then switches images itself. Type str, default ''.

The timeline snapshots, sorted by time. Each entry is a dict with time (seconds), easing ('linear', 'ease_in', 'ease_out' or 'ease_in_out'), x, y, scale_x, scale_y, angle, color and image_path ('' = plain color box). The easing of an entry shapes the segment that starts at it, and the image switches at the start of a segment. Type list, default [].

True: loop forever. False: play once and hold the last keyframe. Type bool, default True.

Name shown in the Hierarchy panel. Read-only at runtime. Type str.

Angular velocity damping. Type float, default 0.

Bounciness (0 = fully inelastic, 1 = fully elastic). Type float, default 0.2.

Whether the rigid body is simulated. Type bool, default False.

Keep the rotation fixed (collisions do not spin the object). Type bool, default False.

Friction coefficient. Type float, default 0.6.

Gravity multiplier (0 = unaffected by gravity). Type float, default 1.

Linear velocity damping. Type float, default 0.

Mass. Type float, default 1.

Size of the rect/ellipse body shape (0 = use the object’s own size). Type float, default 0.

physics_shape_offset_x, physics_shape_offset_y

Section titled “physics_shape_offset_x, physics_shape_offset_y”

Shift of the body shape away from the object centre. Type float, default 0.

Vertices of a polygon body shape. Type list, default [].

Body shape: 'rect', 'ellipse' or 'polygon'. Type str, default 'rect'.

Rigid-body type: 'static', 'dynamic' or 'kinematic'. Type str, default 'dynamic'.

Transform anchor mode, see set_pivot(). Type str, default 'center'.

Coordinates of a 'custom' anchor (in the object’s own pixel grid, origin at its top-left). Type float, default 0.

Clock scale (1 = real time, 2 = twice as fast). Type float, default 1.

(x, y); assigning it updates x and y too. Type (int, int), default (20, 20).

(scale_x, scale_y). Type (float, float), default (1, 1).

Stretch factors (1 = original size). Type float, default 1.

Path of the attached script, relative to the project. Type str, default ''.

(width, height). Type (int, int).

Type key; the timeline is KEYFRAME. Read-only at runtime. Type str.

Unique id, used by get_object_by_uuid(). Read-only at runtime. Type str.

Hidden objects are not drawn and cannot be clicked. Type bool, default True.

Size in pixels. Type int, default depends on the object type.

Position relative to the parent object. Type int, default 20.

Alias of is_colliding_with_object.

  • other (object): the other object.

True when the point (scene coordinates) is inside the collision shape.

  • x (int): point x, in scene coordinates.
  • y (int): point y, in scene coordinates.

True when the shape overlaps a pygame.Rect or (x, y, w, h) tuple.

  • rect (pygame.Rect | (int, int, int, int)): the rectangle, in scene coordinates.

Distance from the object’s centre to a point.

  • x (int): point x, in scene coordinates.
  • y (int): point y, in scene coordinates.

Distance between two object centres.

  • other (object): the other object.

The interpolated channel values at a time: a dict with x, y, scale_x, scale_y, angle and color, or None without keyframes. Before the first / after the last keyframe the nearest snapshot is held.

  • time (float): seconds from the start of the timeline.

Rotation in degrees.

Whether the animation advances automatically.

Centre of the object (scene coordinates).

Centre of the collision shape in scene coordinates.

The offset of the shape from the object centre.

The polygon vertices.

Radius of an ellipse shape (half of its smaller side).

The overlapping area with a rectangle, or None.

  • x (int): rectangle x, in scene coordinates.
  • y (int): rectangle y, in scene coordinates.
  • width (int): rectangle width.
  • height (int): rectangle height.

The size of the shape used by rect and ellipse.

The shape used for collisions.

Fill, text or tint color as (r, g, b, a).

Unit vector (dx, dy) pointing from the object to a point.

  • x (int): point x, in scene coordinates.
  • y (int): point y, in scene coordinates.

Length of the timeline in seconds.

Height in pixels.

Project-relative path of the image drawn as the object ('' = plain color box).

A copy of the timeline snapshots.

True = loop forever, False = play once then hold the last keyframe.

The name of the object.

Transform anchor mode (e.g. 'center', 'top_left', 'custom').

The anchor resolved to content pixels (x, y).

Current playback speed.

Local position (x, y), relative to the parent object.

Local pygame.Rect of the object.

The stretch factors as (scale_x, scale_y).

The x stretch factor.

The y stretch factor.

Size in pixels as (width, height).

Position of the playback clock in seconds.

Length of the timeline in seconds: the duration, or the time of the last keyframe when that is later.

The type key of the object.

The uuid of the object.

The visible state as a bool.

Width in pixels.

Position in scene coordinates, i.e. with every parent offset added.

pygame.Rect in scene coordinates.

The x part of the local position.

The y part of the local position.

Makes the object invisible. Same as obj.visible = False.

True while automatic playback is on.

True when both objects have collision enabled and their shapes overlap.

  • other (object): the other object.

is_colliding_with_rect(x, y, width, height)

Section titled “is_colliding_with_rect(x, y, width, height)”

True when the shape overlaps the given rectangle.

  • x (int): rectangle x, in scene coordinates.
  • y (int): rectangle y, in scene coordinates.
  • width (int): rectangle width.
  • height (int): rectangle height.

True while collision detection is on for this object.

True while the object is hidden.

Cheap test: True when the point is inside the object’s bounding box.

  • x (int): point x, in scene coordinates.
  • y (int): point y, in scene coordinates.

Pixel-perfect test: True only on a non-transparent pixel. Prefer it for clicks, not for per-frame checks.

  • x (int): point x, in scene coordinates.
  • y (int): point y, in scene coordinates.

Same as is_visible().

True while the object is visible.

Moves the object by (dx, dy) pixels.

  • dx (int): horizontal delta.
  • dy (int): vertical delta.

Freeze on the current time.

Start (or resume) automatic playback.

Applies the timeline value at a time to the object without playing (the Animation Editor uses it while scrubbing). Returns True when something was applied.

  • time (float): seconds from the start of the timeline.

Resets every shape field to the object’s own size.

Rewind to the start and start playing.

Sets the rotation.

  • degrees (float): angle, clockwise.

Turns automatic playback on or off.

  • auto_play (bool): True plays, False pauses.

Sets the centre (scene coordinates).

  • x (int): new centre x.
  • y (int): new centre y.

Convenience: sets an ellipse by its two radii.

  • radius_x (float): horizontal radius.
  • radius_y (float): vertical radius.

Turns collision detection on or off (while it is off, every collides_with_* / is_colliding_* call returns False).

  • enabled (bool): True / False.

Moves the shape away from the object centre (follows scale and rotation).

  • x (float): horizontal offset.
  • y (float): vertical offset.

Sets explicit polygon vertices.

  • points (list): vertex list, e.g. [(0, 0), (50, 0), (25, 40)].

Sets the size used by rect and ellipse.

  • width (int): shape width.
  • height (int): shape height.

Sets the collision shape.

  • type (str): 'bbox', 'rect', 'ellipse' or 'polygon'.

Sets the color.

  • color ((r, g, b, a)): the new color tuple.

Sets the timeline length.

  • duration (float): seconds.

Sets the height.

  • h (int): new height in pixels.

Sets the image drawn as the object.

  • image_path (str): path relative to the project; '' draws the color box.

Replaces the timeline. The entries are cleaned and sorted by time.

  • keyframes (list): snapshot dicts (see the keyframes property).

Turns looping on or off.

  • loop (bool): True loops, False plays once.

Choose the transform anchor.

  • pivot (str): 'center' (default), 'top_left', 'top_center', 'top_right', 'center_left', 'center_right', 'bottom_left', 'bottom_center', 'bottom_right' or 'custom'.

Rotate/scale around a free point of the object’s own pixel grid (also sets pivot to 'custom').

  • x (float): anchor x in the pixel grid.
  • y (float): anchor y in the pixel grid.

Set the playback speed (minimum 0.01).

  • playback_speed (float): clock scale, 1 = real time.

Sets the local position.

  • x (int): new x, relative to the parent object, in pixels.
  • y (int): new y, relative to the parent object, in pixels.

Sets both stretch factors.

  • sx (float): x stretch factor.
  • sy (float): y stretch factor.

Sets the x stretch factor.

  • sx (float): x stretch factor.

Sets the y stretch factor.

  • sy (float): y stretch factor.

Sets the size in pixels.

  • width (int): new width.
  • height (int): new height.

Jump to a time in seconds; playback continues from there. With looping on, the time wraps around the timeline length.

  • time (float): seconds from the start of the timeline.

Sets the visible state.

  • visible (bool): True shows the object, False hides it.

Sets the width.

  • w (int): new width in pixels.

Sets the position in scene coordinates.

  • x (int): new x, in scene coordinates.
  • y (int): new y, in scene coordinates.

Sets the x part of the local position.

  • x (int): new x, relative to the parent object.

Sets the y part of the local position.

  • y (int): new y, relative to the parent object.

Makes the object visible. Same as obj.visible = True.

Pause and rewind to the start.

A play-once animation reached its last keyframe.

The animation (re)starts.

Pressed and released on the object.

The object starts overlapping other (both need collision enabled).

  • other (object): the other object.

The overlap with other ends.

  • other (object): the other object.

When the scene is replaced, the object is removed with studio.destroy_object() or the game closes.

Double click on the object.

Pointer moves while dragging.

  • pos ((int, int)): pointer position in scene coordinates.

The drag ends.

A pointer drag on the object starts.

Pointer moves onto the object.

Pointer moves off the object.

Left button pressed on the object.

The button that was pressed on this object is released.

Right click on the object.

Once, when the scene has loaded.

Every frame.

  • dt (float): seconds since the last frame.

When the object is shown or hidden.

  • visible (bool): True when shown, False when hidden.

snapshot_from_object(obj, time=0.0, easing='linear')

Section titled “snapshot_from_object(obj, time=0.0, easing='linear')”

Pack the object’s CURRENT channel values into one keyframe snapshot.

  • obj (object): the object to snapshot.
  • time (float): snapshot time in seconds.
  • easing (str): easing curve of the segment that starts at this frame.

Sanitise and sort a keyframe list: sorts, fills missing channels and clamps values; returns a fresh list (never mutates the input).

  • keyframes (list): list of keyframe dicts.

Map linear progress 0..1 through a named easing curve.

  • kind (str): 'linear', 'ease_in', 'ease_out' or 'ease_in_out'.
  • t (float): linear progress 0..1.

Default easing curve ('linear').

All easing curve names: ('linear', 'ease_in', 'ease_out', 'ease_in_out').

Animated channels: ('x', 'y', 'scale_x', 'scale_y', 'angle', 'color', 'image_path').