Baltor Get started

Gallery / Godot shaders

Squash and stretch bounce for sprites

In your harnessGodot shaderMIT

Animate a sprite with volume-preserving squash and stretch around a pivot at its base: a looping bounce curve with adjustable amount, speed and pivot, or a fixed amount set from a script.

Render of Squash and stretch bounce for sprites
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
canvas_item
Parameters
amount (float = 0.22), speed (float = 5), pivot_u (float = 0.5), pivot_v (float = 1), use_fixed_stretch (bool = no), fixed_stretch (float = 0), hop_height (float = 24)
Use it on
A Sprite2D (or other textured CanvasItem) with transparent space around its shape, assigned to the node as usual.
Result
The disc squashed wide and flat against the ground line.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/sprite_squash_stretch/

Limits. Scaling a four-vertex quad gives uniform squash, not a bulge. The hop moves only the drawing, not the node, so collision does not follow it.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 57.5 KB
Licence
MIT
Declared effects
reads files, runs commands
Checked with
Godot 4.7.2, opengl3 compatibility (Mesa llvmpipe, Xvfb)
Checks
contract static, engine run, engine log clean, shader in scene, capture written, render not uniform, shader changes pixels
Techniques
Volume-preserving squash and stretch, Pivot recovered from vertex position and UV
Tags
godot shader, canvas item, squash and stretch, bounce, animation, vertex animation, 2d
Identity
library.supply.creative_originals.34f709ccb80d96a315465273.b5ea699912c50523
Version
b5ea699912c50523671221989278a245fda9f197989873cb2ab93d06f8822fb8

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.