-
Notifications
You must be signed in to change notification settings - Fork 0
Reference ‐ Effects
All effects can be applied with just a single line of code! The effect will progress automatically, and you can run as many effects as you want at once (you can even stack the same effect multiple times!)
Important
Effects do not affect the animation's built in variables like image_xscale, image_speed, etc. They instead use their own private offset variables.
Some effects use animation curves. There are a handful of animation curves included in the Animation Curves folder, but you can also make your own. If you do so, follow this format:
- Two channels, one called
x
and one calledy
- The first point should have an h of 0 and a v of 0
- The final point should have an h of 1 and v of 0
- To keep scale values consistent, try to keep v for the middle points between 1 and -1, with the biggest curve hitting exactly -1 and/or 1
Bezier style curves are recommended!
List of included animation curve names:
- animation_curve_bounce_once
- animation_curve_bounce_twice
- animation_curve_bounce_thrice
- animation_curve_bounce_a_lot
- animation_curve_wave
- animation_curve_one_way_start
- animation_curve_one_way_middle
- animation_curve_one_way_end
- animation_curve_snap_start
- animation_curve_snap_middle
- animation_curve_snap_end
Applies a squash and stretch effect based on an animation curve to the specified track. This works by altering the xscale and yscale the sprite is drawn with, without altering the actual image_xscale or image_yscale variables.
squash_and_stretch_demo.mp4
animation_effect_squash_and_stretch(_duration, _scale, _loop_count = 1, _curve = animation_curve_bounce_once, _reverse_xy = false, _track = 0)
Argument | Type | Description |
---|---|---|
_duration | Real | How long the squash and stretch should last, measured in game frames |
_scale | Real | How big the squash and stretch should be, measured as a percent. Should typically be a value between 0.1 and 0.9 |
_loop_count | Real | (Optional) How many times the effect should loop. Pass infinity to loop forever |
_curve | Animation Curve Asset | (Optional) The animation curve to use. Use an included one or make your own! |
_reverse_xy | Bool | (Optional) If true, swaps the x and y channels of the animation curve to make things squash the other way |
_track | Real (Int) | (Optional) The track to apply the effect to. Pass all to apply the effect to every track |
Returns: N/A (Undefined)
Applies a sway effect based on an animation curve to the specified track. This works by altering the image_angle the sprite is drawn with, without altering the actual image_angle variables. This effect only uses the "x" channel of the animation curve, unless _reverse_xy
is enabled in which case it will only use the "y" channel.
You can optionally add an offset to the x and y that the rotation uses as it's origin. For example, a 50x50 sprite with a centered origin could be given an offset of 0, 25 to make it rotate from the bottom of the sprite instead of the center. This is purely visual and does not affect the actual origin of the sprite at all.
sway_demo.mp4
animation_effect_sway(_duration, _range, _x_offset = 0, _y_offset = 0, _loop_count = 1, _curve = animation_curve_bounce_once, _reverse_xy = false, _track = 0)
Argument | Type | Description |
---|---|---|
_duration | Real | How long the squash and stretch should last, measured in game frames |
_range | Real | The size of the largest rotation of the sway, measured in degrees |
_x_offset | Real | (Optional) How much to offset the x origin of the rotation |
_y_offset | Real | (Optional) How much to offset the y origin of the rotation |
_loop_count | Real | (Optional) How many times the effect should loop. Pass infinity to loop forever |
_curve | Animation Curve Asset | (Optional) The animation curve to use. Use an included one or make your own! |
_reverse_xy | Bool | (Optional) If true, uses the y channel of the animation curve instead of the x channel |
_track | Real (Int) | (Optional) The track to apply the effect to. Pass all to apply the effect to every track |
Returns: N/A (Undefined)
Applies an oscillate effect based on an animation curve to the specified track. This works by applying an offset to the x and y the sprite is drawn at. This effect only uses the "x" channel of the animation curve, unless _reverse_xy
is enabled in which case it will only use the "y" channel.
By default the animation will oscillate up and down, but you can use the _direction
argument to make it oscillate at any angle you want.
You can optionally loop this effect to get similar results to applying a sine wave to an object's y coordinate, but with an animation curve.
oscillate_demo.mp4
animation_effect_oscillate(_duration, _range, _direction = 90, _loop_count = 1, _curve = animation_curve_bounce_once, _reverse_xy = false, _track = 0)
Argument | Type | Description |
---|---|---|
_duration | Real | How long the squash and stretch should last, measured in game frames |
_range | Real | The size of the largest rotation of the sway, measured in degrees |
_direction | Real | (Optional) What direction the oscillation should go |
_loop_count | Real | (Optional) How many times the effect should loop. Pass infinity to loop forever |
_curve | Animation Curve Asset | (Optional) The animation curve to use. Use an included one or make your own! |
_reverse_xy | Bool | (Optional) If true, uses the y channel of the animation curve instead of the x channel |
_track | Real (Int) | (Optional) The track to apply the effect to. Pass all to apply the effect to every track |
Returns: N/A (Undefined)
Applies a blink effect based on an animation curve to the specified track. This works by applying an offset to the alpha sprite is drawn at. This effect only uses the "x" channel of the animation curve, unless _reverse_xy
is enabled in which case it will only use the "y" channel.
blink_demo.mp4
function animation_effect_blink(_duration, _alpha_range, _loop_count = 1, _curve = animation_curve_wave, _reverse_xy = false, _track = 0)
Argument | Type | Description |
---|---|---|
_duration | Real | How long the blink should last, measured in game frames |
_alpha_range | Real | The maximum amount alpha should be reduced. Should be a value between 0 (no alpha change) and 1 (will go fully invisible at the peak of the curve) |
_loop_count | Real | (Optional) How many times the effect should loop. Pass infinity to loop forever |
_curve | Animation Curve Asset | (Optional) The animation curve to use. Use an included one or make your own! |
_reverse_xy | Bool | (Optional) If true, uses the y channel of the animation curve instead of the x channel |
_track | Real (Int) | (Optional) The track to apply the effect to. Pass all to apply the effect to every track |
Returns: N/A (Undefined)
Applies a shake effect to the specified track. This looks similar to a screenshake, but only applied to a single sprite.
shake_demo.mp4
animation_effect_shake(_duration, _intensity, _track = 0)
Argument | Type | Description |
---|---|---|
_duration | Real | How long the shake should last, measured in game frames |
_intensity | Real | The intensity of the shake, measured in pixels |
_track | Real (Int) | (Optional) The track to apply the effect to. Pass all to apply the effect to every track |
Returns: N/A (Undefined)
Applies a hitstop effect to the specified track. This will stop the animation from progressing for the specified number of frames.
Note
The hitstop effect is different from pausing. Pausing will pause everything, including effects, while hitstop only stops the animation itself and effects will continue to update.
animation_effect_hitstop(_duration, _track = 0)
Argument | Type | Description |
---|---|---|
_duration | Real | How long the hitstop should last, measured in game frames |
_track | Real (Int) | (Optional) The track to apply the effect to. Pass all to apply the effect to every track |
Returns: N/A (Undefined)
Counts how many of the specified effect is active on the specified track. This will return 0 if the effect is not present, so it can also be used as a way to check if the effect currently exists at all or has finished.
animation_effect_get_count(_effect_name, _track = 0)
Argument | Type | Description |
---|---|---|
_effect_name | String | A string of the name of the effect to check for. Effect names: "shake", "squash_and_stretch", "sway", "oscillate", "hitstop" |
_track | Real (Int) | (Optional) The track to check. Pass all to count up the total effects on every track |
Returns: Real
Cancels all instances of the specified effect on the specified track, ending it early.
animation_effect_cancel(_effect_name, _track = 0)
Argument | Type | Description |
---|---|---|
_effect_name | String | A string of the name of the effect to cancel. Effect names: "shake", "squash_and_stretch", "sway", "oscillate", "hitstop" |
_track | Real (Int) | (Optional) The track to check. Pass all to cancel the effect on every track |
Returns: N/A (Undefined)