โ† All examples

godot shaders

Squash and stretch bounce for sprites

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.

Recorded render of Squash and stretch bounce for sprites

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • component.json
  • demo.tscn
  • inspect_shader.py
  • material.tres
  • preview.png
  • sprite_squash_stretch.gdshader
  • test_package.py
  • verification/native.json

How it works

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/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • contract_static
  • engine_run
  • engine_log_clean
  • shader_in_scene
  • capture_written
  • render_not_uniform
  • shader_changes_pixels

Limits to consider

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.