Skip to content

SalmanShhh/C3Addon-simple_spring

Repository files navigation


Simple Spring

Simple numeric spring physics with multiple named springs per behavior instance, plus object-level mesh effects.

Version 2.0.0.2


See all releases


Author: SalmanShh
Made using CAW

Table of Contents


Usage

To build the addon, run the following commands:

npm i
npm run build

To run the dev server, run

npm i
npm run dev

Examples Files

Description Download
(uses deprecated ACEs now) simple-spring-examples
Mesh Effects - Simple Spring Example
Transforms & Colours - Simple Spring

Properties

Property Name Description Type
Default Stiffness Default stiffness applied to newly created springs. How quickly the spring responds - increase for faster response. float
Default Damping Default damping applied to newly created springs (0-1). Increase to reduce overshoot and oscillation. float
Default Precision Default precision applied to newly created springs. Threshold to consider animation complete - lower values require closer proximity to target. float
Enabled Enable or disable the spring behavior. check

Actions

Action Description Params
Apply Constant: Set colour spring Enable or update a constant colour spring, springing toward the given target each tick. New springs inherit the behavior's default stiffness, damping, and precision. Use the Settings ACE to override per spring. Use Pause/Stop playback ACEs to deactivate. Spring ID (string)
Colour Space (combo)
Target Channel 1 (number)
Target Channel 2 (number)
Target Channel 3 (number)
Apply To Properties (boolean)
Settings: Set colour spring Set stiffness, damping, and precision for all three channels of a named colour spring. Spring ID (string)
Stiffness (number)
Damping (number)
Precision (number)
Settings: Set colour spring from duration Compute stiffness and damping so a colour spring settles in about the requested duration, with a selectable bounce profile. Spring ID (string)
Duration (number)
Precision (number)
Bounce Profile (combo)
Apply Colour spring Combined colour spring action for current-to-target or from-to workflows with optional apply-to-properties. Spring ID (string)
Colour Space (combo)
Start Mode (combo)
From Channel 1 (number)
From Channel 2 (number)
From Channel 3 (number)
To Channel 1 (number)
To Channel 2 (number)
To Channel 3 (number)
Apply To Properties (boolean)
Add to velocity Deprecated. Use 'Velocity: Add to named spring' in the Multi Spring category instead. Value (number)
Reset to value Deprecated. Use the Multi Spring category to set a named spring's start value or recreate the spring instead. Value (number)
Set always spring to target Deprecated. Use 'Constant: Set spring' in the Multi Spring category instead. Enabled (combo)
Target (number)
Mode (combo)
Set always spring target Deprecated. Use 'Constant: Set spring' in the Multi Spring category instead. Target (number)
Set damping Deprecated. Use 'Settings: Set spring' in the Multi Spring category instead. Damping (number)
Set enabled Deprecated. Enables or disables the entire behavior. There is no direct Multi Spring equivalent; use this only when you need to pause all springs on an object. State (boolean)
Set precision Deprecated. Use 'Settings: Set spring' in the Multi Spring category instead. Precision (number)
Set stiffness Deprecated. Use 'Settings: Set spring' in the Multi Spring category instead. Stiffness (number)
Set velocity Deprecated. Use 'Velocity: Set named spring' in the Multi Spring category instead. Velocity (number)
Snap to target Deprecated. Use the Multi Spring Playback category to snap or clear a named spring instead.
Spring from/to Deprecated. Use 'Start: Named spring' in the Multi Spring category instead. From (number)
To (number)
Spring from/to angle (deprecated) Deprecated. Use 'Start: Named spring' in the Multi Spring category with Angle mode instead. From (number)
To (number)
Spring to Deprecated. Use 'Start: Named spring' in the Multi Spring category instead. To (number)
Mode (combo)
Stop at current value Deprecated. Use the Multi Spring Playback category to stop or clear a named spring instead.
Mesh: Start constant sway Start continuous sinusoidal sway. The mesh keeps swaying automatically each tick until Stop Constant Sway is called. Great for grass, plants, cloth, or flags. Angle (number)
Strength (number)
Wavelength (number)
Speed (number)
Auto Mesh (combo)
Do Mesh Effect: Directional bend Bend the mesh toward a direction with stronger motion on the leading edge. Great for wind push, recoil lean, and directional impact anticipation. Angle (number)
Strength (number)
Radius (number)
Falloff (combo)
Auto Mesh (combo)
Do Mesh Effect: Impact trail wave Create a directional banded wave from an impact path. Ideal for slash trails, dash wake distortion, and projectile fly-by pressure waves. Origin X (number)
Origin Y (number)
Angle (number)
Strength (number)
Wavelength (number)
Trail Width (number)
Auto Mesh (combo)
Do Mesh Effect: Noise jitter burst Apply randomized per-vertex impulse for electric shock, glitch hit, fear tremor, or explosion rattle, then spring back naturally. Center X (number)
Center Y (number)
Strength (number)
Radius (number)
Falloff (combo)
Auto Mesh (combo)
Do Mesh Effect: Preset combo Apply a pre-configured combination of mesh effects tuned for specific game feel scenarios. Each preset blends 2–4 effects together. Intensity scales all effect strengths proportionally. Preset (combo)
Intensity (number)
Impact X (number)
Impact Y (number)
Angle (degrees) (number)
Auto Mesh (combo)
Do Mesh Effect: Punch Blast all mesh vertices outward from a point, then spring back. Good for hit impacts, explosions, and shockwaves. Impact X (number)
Impact Y (number)
Strength (number)
Radius (number)
Falloff (combo)
Auto Mesh (combo)
Do Mesh Effect: Ripple Emit concentric rings of alternating push/pull from an origin point, like a stone dropped in water. Origin X (number)
Origin Y (number)
Strength (number)
Wavelength (number)
Decay (number)
Auto Mesh (combo)
Do Mesh Effect: Shockwave Emit a ring-shaped outward blast that peaks at a set distance from the origin. Unlike Punch, the center is unaffected — only the ring is hit. Good for bomb blasts and sonic booms. Epicenter X (number)
Epicenter Y (number)
Strength (number)
Ring Radius (number)
Ring Width (number)
Auto Mesh (combo)
Do Mesh Effect: Squash and stretch Squeeze the sprite along one axis and bow it out along the other, then spring back. Classic animation squash/stretch principle. Axis (combo)
Amount (number)
Pivot X (number)
Pivot Y (number)
Radius (number)
Auto Mesh (combo)
Mesh: Stop constant sway Stop the continuous sway. The mesh vertices spring back to rest naturally — OnMeshSettled fires when they come to a stop.
Do Mesh Effect: Twist Swirl the mesh around a pivot in a rotational motion, then spring back. Good for portal effects, magic circles, spin attacks, and tornado impacts. Pivot X (number)
Pivot Y (number)
Strength (number)
Radius (number)
Falloff (combo)
Auto Mesh (combo)
Do Mesh Effect: Wave Push parallel bands of vertices in alternating directions, like a flag rippling in wind. Vertices move perpendicular to the wave travel direction. Angle (number)
Strength (number)
Wavelength (number)
Auto Mesh (combo)
Do Mesh Effect: Wobble Shear the mesh in a direction — one side pushes one way, the opposite side pushes back. Good for hit reactions, wind gusts, and attack wind-ups. Angle (number)
Strength (number)
Auto Mesh (combo)
Mesh: Set auto mesh resolution Set the number of columns and rows used when Auto Mesh = Yes automatically creates a mesh. Higher values produce smoother, more detailed deformation at the cost of CPU. Default is 5×5. For subtle UI effects 4×4 is fine. For smooth squash/stretch on large sprites use 8×8 or higher. Columns (number)
Rows (number)
Create grid Create or replace a mesh grid on the instance and initialize mesh spring state. Columns (number)
Rows (number)
Destroy grid Destroy the mesh and clear all mesh spring state.
Reset offsets Reset all mesh point offsets and velocities back to rest.
Set damping Set mesh spring damping. Damping (number)
Set enabled Enable or disable mesh spring simulation. Enabled (boolean)
Set precision Set mesh settle precision. Precision (number)
Set stiffness Set mesh spring stiffness. Stiffness (number)
Velocity: Add to named spring Add an impulse to a named spring's current velocity. Spring ID (string)
Velocity (number)
Apply Constant: Set spring Enable or update a constant named spring, springing toward the given target each tick. New springs inherit the behavior's default stiffness, damping, and precision. Use the Settings ACE to override per spring. Use Pause/Stop playback ACEs to deactivate. Spring ID (string)
Target (number)
Debug: Log active springs Output a table of currently active springs and state values to the browser console.
Manage: Remove spring Remove a named spring and its state. The legacy default spring is reset instead of removed. Spring ID (string)
Settings: Set spring Override stiffness, damping, and precision for a named spring. New springs inherit the behavior's default stiffness, damping, and precision set in the properties panel. Spring ID (string)
Stiffness (number)
Damping (number)
Precision (number)
Settings: Set spring from duration Compute stiffness and damping so a named spring settles in about the requested duration, with a selectable bounce profile. Spring ID (string)
Duration (number)
Precision (number)
Bounce Profile (combo)
Velocity: Set named spring Set the current velocity of a named spring directly. Spring ID (string)
Velocity (number)
Apply spring Spring a named value from a start point to a target. New springs inherit the behavior's default stiffness, damping, and precision. Use the Settings ACE to override per spring. Spring ID (string)
Start Mode (combo)
From (number)
To (number)
Mode (combo)
Pause: All springs Pause all active springs.
Pause: Spring by ID Pause a spring by ID if it is active. Spring ID (string)
Resume: All springs Resume all paused springs.
Resume: Spring by ID Resume a previously paused spring by ID. Spring ID (string)
Stop: All springs Stop and clear all springs.
Stop: Spring by ID Clear a spring by ID. Spring ID (string)
Velocity: Add to angle spring Add angular velocity to a transform angle spring. Spring ID (string)
Angular Velocity (number)
Apply Constant: Set angle spring Enable or update a constant angle spring, springing toward the given target each tick. New springs inherit the behavior's default stiffness, damping, and precision. Use the Settings ACE to override per spring. Use Pause/Stop playback ACEs to deactivate. Spring ID (string)
Target Angle (number)
Apply To Properties (boolean)
Settings: Set angle spring from duration Compute stiffness and damping so an angle spring settles in about the requested duration, with a selectable bounce profile. Spring ID (string)
Duration (number)
Precision (number)
Bounce Profile (combo)
End Value: Transform angle spring Overwrite the end value of a transform angle spring. Spring ID (string)
End Angle (number)
Start Value: Transform angle spring Overwrite the start value of a transform angle spring. Spring ID (string)
Start Angle (number)
Apply Angle spring Combined angle spring action using explicit start and end values, with optional apply-to-properties. Spring ID (string)
From Angle (number)
To Angle (number)
Apply To Properties (boolean)
Velocity: Add to position spring Add a velocity impulse to a transform position spring. Spring ID (string)
Velocity X (number)
Velocity Y (number)
Velocity Z (number)
Apply Constant: Set position spring Enable or update a constant position spring, springing toward the given target each tick. New springs inherit the behavior's default stiffness, damping, and precision. Use the Settings ACE to override per spring. Use Pause/Stop playback ACEs to deactivate. Spring ID (string)
Target X (number)
Target Y (number)
Target Z (number)
Apply To Properties (boolean)
Settings: Set position spring from duration Compute stiffness and damping so a position spring settles in about the requested duration, with a selectable bounce profile. Spring ID (string)
Duration (number)
Precision (number)
Bounce Profile (combo)
End Value: Transform position spring Overwrite the end value of a transform position spring. Spring ID (string)
End X (number)
End Y (number)
End Z (number)
Start Value: Transform position spring Overwrite the start value of a transform position spring. Spring ID (string)
Start X (number)
Start Y (number)
Start Z (number)
Settings: Set transform spring Set stiffness, damping, and precision for a transform spring. Spring ID (string)
Stiffness (number)
Damping (number)
Precision (number)
Apply Position spring Position spring action using explicit start and end values, including optional Z channel, with optional apply-to-properties. Spring ID (string)
From X (number)
From Y (number)
From Z (number)
To X (number)
To Y (number)
To Z (number)
Apply To Properties (boolean)
Velocity: Add to size spring Add a velocity impulse to a transform size spring. Spring ID (string)
Velocity Width (number)
Velocity Height (number)
Apply Constant: Set size spring Enable or update a constant size spring, springing toward the given target each tick. New springs inherit the behavior's default stiffness, damping, and precision. Use the Settings ACE to override per spring. Use Pause/Stop playback ACEs to deactivate. Spring ID (string)
Target Width (number)
Target Height (number)
Apply To Properties (boolean)
Settings: Set size spring from duration Compute stiffness and damping so a size spring settles in about the requested duration, with a selectable bounce profile. Spring ID (string)
Duration (number)
Precision (number)
Bounce Profile (combo)
End Value: Transform size spring Overwrite the end value of a transform size spring. Spring ID (string)
End Width (number)
End Height (number)
Start Value: Transform size spring Overwrite the start value of a transform size spring. Spring ID (string)
Start Width (number)
Start Height (number)
Apply Size spring Size spring action using explicit start and end values, with optional apply-to-properties. Spring ID (string)
From Width (number)
From Height (number)
To Width (number)
To Height (number)
Apply To Properties (boolean)

Conditions

Condition Description Params
Has colour spring reached target True if all channels in the named colour spring have reached their targets. Spring ID (string)
Is colour spring animating True if any channel in the named colour spring is animating. Spring ID (string)
Has reached target Deprecated. Use 'Has spring reached target' in the Multi Spring category instead.
Is always spring enabled Deprecated. Use 'Is constant spring enabled' in the Multi Spring category instead.
Is animating Deprecated. Use 'Is spring animating' in the Multi Spring category instead.
Is enabled Deprecated. Checks if the entire behavior is enabled. There is no direct Multi Spring equivalent; use this only when you need the behavior-level enabled state.
On reached target Deprecated. Use 'On spring reached target' in the Multi Spring category instead.
On started Deprecated. Use 'On spring started' in the Multi Spring category instead.
On stopped Deprecated. Use 'On spring stopped' in the Multi Spring category instead.
Is mesh sway enabled True while constant sway is running. Use this to check whether sway was started before starting it again, or to branch logic when sway is active.
Has settled True if mesh motion is currently settled.
Is animating True if mesh points are currently animating.
Is enabled True if mesh spring simulation is enabled.
Is supported True if the attached instance supports mesh API operations.
On settled Triggered when mesh spring animation settles.
On started Triggered when mesh spring animation starts.
On unsupported Triggered when a mesh action is called on an instance that does not support mesh.
On spring reached target True if the named spring has settled at its target. Spring ID (string)
Is constant spring enabled True if the named spring is running in constant (always-on) mode. Spring ID (string)
Is spring animating True if the named spring is currently animating. Spring ID (string)
Is spring constant True if the named spring is currently configured as a constant spring. Spring ID (string)
On spring reached target Triggered when a named spring settles at its target. Leave the id empty to catch any spring. Spring ID (string)
On spring started Triggered when a named spring begins animating. Leave the id empty to catch any spring. Spring ID (string)
On spring stopped Triggered when a named spring is stopped or snapped. Leave the id empty to catch any spring. Spring ID (string)
Has transform spring reached target True if the selected transform spring has reached its target. Spring ID (string)
Transform Type (combo)
Is transform spring animating True if the selected transform spring is currently animating. Spring ID (string)
Transform Type (combo)

Expressions

Expression Description Return Type Params
ColourBlue Get the current blue channel (0-255) of a named colour spring. number Spring ID (string)
ColourGreen Get the current green channel (0-255) of a named colour spring. number Spring ID (string)
ColourHex Get the current colour of a named spring as a #RRGGBB string. string Spring ID (string)
ColourRed Get the current red channel (0-255) of a named colour spring. number Spring ID (string)
ColourSpace Get the current colour space used by a named colour spring (rgb, hsl, or hsv). string Spring ID (string)
AlwaysSpringTarget Deprecated. There is no direct Multi Spring expression replacement. Use 'Constant: Set spring' in the Multi Spring category to manage the target instead. number
Damping Deprecated. Use the Multi Spring category expression SpringDamping("id") instead. number
From Deprecated. Use the Multi Spring category expression SpringFrom("id") instead. number
Precision Deprecated. Use the Multi Spring category expression SpringPrecision("id") instead. number
Progress Deprecated. Use the Multi Spring category expression SpringProgress("id") instead. number
Stiffness Deprecated. Use the Multi Spring category expression SpringStiffness("id") instead. number
To Deprecated. Use the Multi Spring category expression SpringTo("id") instead. number
Value Deprecated. Use the Multi Spring category expression SpringValue("id") instead. number
Velocity Deprecated. Use the Multi Spring category expression SpringVelocity("id") instead. number
MeshCols Get current mesh column count. number
MeshEnergy Total kinetic + displacement energy across all mesh points. Returns 0 when the mesh is fully at rest. Use this to check whether the mesh is still animating e.g. trigger a sound or effect only while energy > 0.01. number
MeshOffsetXAtIndex Get mesh point X offset at index. number Index (number)
MeshOffsetYAtIndex Get mesh point Y offset at index. number Index (number)
MeshPointCount Get total mesh point count for Repeat loop workflows. number
MeshRows Get current mesh row count. number
SpringCount Get how many named springs currently exist on this behavior instance. number
SpringEventId Get recent spring event ids. string Event Type (string)
SpringFrom Get the starting value of a named spring. number Spring ID (string)
SpringIdAt Get a spring id by zero-based index. string Index (number)
SpringProgress Get progress from 0 to 1 for a named spring. number Spring ID (string)
SpringProperty Get stiffness, damping, or precision of a named spring. number Spring ID (string)
Property (string)
SpringTimeToTargetSeconds Estimate how long in seconds a named spring will take to settle at its target from its current state. Returns 0 if already settled or spring missing, or -1 if not settled within the simulation window. number Spring ID (string)
SpringTo Get the target value of a named spring. number Spring ID (string)
SpringValue Get the current value of a named spring. number Spring ID (string)
SpringVelocity Get the current velocity of a named spring. number Spring ID (string)
TransformAngle Get the current sprung angle value for a transform angle spring. number Spring ID (string)
TransformX Get the current sprung X value for a transform position spring. number Spring ID (string)
TransformY Get the current sprung Y value for a transform position spring. number Spring ID (string)
TransformZ Get the current sprung Z value for a transform position spring. number Spring ID (string)
TransformDepth Get the current sprung depth value for a transform size spring. number Spring ID (string)
TransformHeight Get the current sprung height value for a transform size spring. number Spring ID (string)
TransformWidth Get the current sprung width value for a transform size spring. number Spring ID (string)

Changelog

Version 2.0.0.2


Version 2.0.0.1

Fixed: fix positioning

Version 2.0.0.0

Added:

  • Added Set Spring Settings From Duration.
  • Added ACE for knowing whether a spring is a "Constant" spring.
  • Added ACE for getting an estimated time it will take to reach target value (SpringTimeToTargetSeconds)
  • Added Expression for getting the colour space being used by a Colour Spring.

Changed:

  • Improved naming scheme of Spring ACEs
  • Clean up debugger of old deprecated values.
  • Combine Apply Springing ACEs to lessen the ACE counts.

Fixed:

  • Fix Spring Triggers.
  • Fix Springing Angle Triggers.
  • Fix Async Actions so they work with the "Wait for previous actions to complete" action similar to the Tween Behaviour.

Version 1.6.2.0

Fixed:

  • Fix the Deprecated ACEs not working.

Version 1.6.1.0

Added:

  • Added (Async) "Wait for previous actions" support for Spring Actions so they can be sequenced similar to the Tween Behaviour.
  • Dedicated playback category
  • Separate instance-applying spring ACEs for colour, transform XYZ, and transform angle, instead of using a toggle inside the main start ACEs.
  • New constant spring ACEs for Colour Spring and Transform Spring.
  • Add ACEs for Applying Velocity to Spring Transform Categories (Position, Size, Angle, Value.)
  • Updated Debugger for new spring system.
  • Debug ACE for logging all the active springs in browser log.

Changed:

  • Updated the instance-applying ACE wording from "To Object" / "on object" to "To Properties".
  • Renamed active ACEs with purpose-based prefixes such as "Start":, "Stop:", "Reset:", "Snap:", "Settings:", "Velocity:", "Constant:", "Apply:", and "Manage:" to improve sorting and discoverability.
  • Reorganized active spring ACEs into clearer folder-based categories so playback actions show up separately in Construct.

Fixed:

  • Correctly depecrated old Spring ACEs
  • Removed the mixed “apply to instance” parameter pattern from active spring start ACEs, which made the action picker harder to scan.
  • Brought deprecated spring start ACEs in line with the newer async sequencing behavior for legacy event sheets.
  • Corrected deprecated ACE authoring to use the proper isDeprecated flag expected by Construct.

Version 1.6.0.1


Version 1.6.0.0

Added:

  • Added Colour Springing ACEs.
  • Added Transform Springing ACEs.
  • Added Multi-Springing Support.
  • Added More Mesh Effect Presets (Explosion Burst, Jelly Bounce, Whip Lash, Teleport Glitch).

Changed:

  • Core Springing ACEs have been deprecated but still work, shouldn't show up anymore in the editor and descriptions will tell you an alternative ACEs to use.
  • Colour Springing: only one active ID can drive object colour at a time
  • Transform: one active ID each for Position, Size, and Angle

Version 1.5.0.1

Changed: update short description to mention Mesh Effects


Version 1.5.0.0

Added:

  • ADDED MESH EFFECTS! (Ripple, Shockwave, Twist, Sway, Wobble, Directional Bend, etc)
  • New ACE "MeshPresetCombo" 6 parameters (Preset, Intensity, CenterX/Y, Angle, AutoGrid) allowing you to apply pre-tuned effect combinations in one action call.
  • Mesh effects
  • Mesh Effects Example project.

Fixed:

  • ACEs now in Folder Structure, in line with the rest of my addons

Version 1.4.0.0

Added:

  • Added "Reset Value" clears all spring state to a given value
  • "stop At Current Value" and "Snap To Target" now fire "OnStopped" trigger
  • _isAlwaysSpringEnabled() and _getAlwaysSpringTarget() functions.

Fixed:

  • Takes deltatime from object instead of the runtime. (makes it so it animates correctly with the object's timescale).
  • Removed always-spring's per-frame "_isAnimating = true", it now only re-wakes when the spring is actually not settled (dist ≥ precision or speed ≥ precision), no longer continuously running every frame.
  • Debugger values editing fix.
  • "set Stiffness" no longer clamps to 1, only lower-bounds at 0.001, matching the properties.
  • _setAlwaysSpringTarget() now wakes the animation when always-spring is active

Version 1.3.0.0

Added: Add new ACEs: actions (SpringTo, SetAlwaysSpring, SetAlwaysSpringTarget, SetEnabled, SetPrecision), condition (IsEnabled), trigger (OnStarted), and expressions (Progress, Precision).

Runtime changes: add _isEnabled and gate ticking, implement _springTo (with angle handling), trigger OnStarted when animations start, add precision/enabled setters, always-spring target setter, progress calculation, include enabled in save/load, and expose new debug properties.

add Guide


Version 1.2.0.0

Added: Add new ACEs: actions (SpringTo, SetAlwaysSpring, SetAlwaysSpringTarget, SetEnabled, SetPrecision), condition (IsEnabled), trigger (OnStarted), and expressions (Progress, Precision).

Runtime changes: add _isEnabled and gate ticking, implement _springTo (with angle handling), trigger OnStarted when animations start, add precision/enabled setters, always-spring target setter, progress calculation, include enabled in save/load, and expose new debug properties.


Version 1.1.1.0

Fixed: fix issue correctly fetching instance deltatime

Version 1.1.0.0

Changed: Rewrote the spring physics logic in instance.js to use fixed-step updates for framerate independence and smoother interpolation. Simplified and renamed internal state variables, improved angle handling, and consolidated finishing/reset logic.


Version 1.0.0.0

Added: initial release, fix version ID


Version 0.0.0.0

Added: Initial release.


About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors