Skip to content
tweens.gd

GDScriptBeta

Material properties

Helpers for BaseMaterial3D, so they work with both StandardMaterial3D and ORMMaterial3D.

A material is a resource, so its tweens need a tree or an owner node; see materials for how to start them and what each needs enabled.

Each row pairs a helper with the property path it tweens. Names ending in _x, _y, _z, or _alpha write one component.

HelperPropertyValue
material_albedo_alphaalbedo_color:afloat
material_albedo_coloralbedo_colorColor
material_emissionemissionColor
material_emission_energy_multiplieremission_energy_multiplierfloat
material_emission_intensityemission_intensityfloat
material_metallicmetallicfloat
material_metallic_specularmetallic_specularfloat
material_normal_scalenormal_scalefloat
material_roughnessroughnessfloat
material_uv1_offsetuv1_offsetVector3
material_uv1_offset_xuv1_offset:xfloat
material_uv1_offset_yuv1_offset:yfloat
material_uv1_offset_zuv1_offset:zfloat
material_uv1_scaleuv1_scaleVector3
material_uv1_scale_xuv1_scale:xfloat
material_uv1_scale_yuv1_scale:yfloat
material_uv1_scale_zuv1_scale:zfloat
material_uv2_offsetuv2_offsetVector3
material_uv2_offset_xuv2_offset:xfloat
material_uv2_offset_yuv2_offset:yfloat
material_uv2_offset_zuv2_offset:zfloat
material_uv2_scaleuv2_scaleVector3
material_uv2_scale_xuv2_scale:xfloat
material_uv2_scale_yuv2_scale:yfloat
material_uv2_scale_zuv2_scale:zfloat

Each UV helper also has _x, _y, and _z variants. A component write reads the other components at each write, including concurrent edits to them.

  • Alpha fading requires a suitable transparency mode.
  • Emission and normal mapping need their feature flags enabled; normal mapping also needs a normal map.
  • Emission intensity requires rendering/lights_and_shadows/use_physical_light_units.
  • UV changes need suitable textures and mapping to be visible.

Automatic material playback requires a scene tree or an in-tree owner node. Owner-bound playback stops when the owner leaves; tree-bound playback stops with the tree. Playback keeps the original resource even when a mesh changes materials, and never duplicates or disposes it. A SceneTree owner binds to its root node, so Tweens.cancel_tweens(get_tree().root) also cancels that playback.

A manual scheduler can play resources without an owner. Dispose it when finished. See resource lifetimes.

# shader: uniform float dissolve = 0.25;
Tweens.play(shader_material, Tweens.shader_parameter(&"dissolve", 1.0, 0.5), get_tree())
Tweens.play(shader_material, Tweens.shader_parameter(&"dissolve", 1.0, 0.5), mesh)
var dissolve := Tweens.shader_parameter(&"dissolve", 1.0, 0.5)
dissolve.fill = Tweens.Fill.NONE
Tweens.play(shader_material, dissolve, get_tree())

Tweens.shader_parameter(name, to = null, seconds = 0.0, easing, delay) targets a ShaderMaterial. As with other resources, pass an owner node or the SceneTree as the third argument of Tweens.play(). The material is shared as usual, so every node using it sees the change. Uniform names are case-sensitive and captured when the tween starts. A missing shader, an undeclared uniform, an incompatible type, or a non-finite endpoint rejects the start before anything is written; the handle settles with Tweens.Reason.FAILED and the message in handle.error. If the material has no override for the uniform, the tween captures the declared shader default rather than zero.

GDScript value Uniform type
float float
int int
Vector2 / Vector3 / Vector4 Matching vector type
Color Color (typically vec4 with source_color hint)

During interpolation, integers saturate at signed 32-bit bounds. Non-finite samples fail playback before writing. Textures, resources, arrays, booleans, and quaternions aren’t supported.

When a tween ends with a fill mode that doesn’t keep the final value (NONE or APPLY_FROM_DURING_DELAY), the original explicit override is restored, or the new override is removed if none originally existed. Cancelling keeps the latest sample, as with node tweens. You can reuse a definition across materials with different initial values and override states, because each start captures its own.

Replacing, freeing, or editing the bound shader fails playback the next time it samples or restores, and the handle settles with FAILED. Any shader change signal counts as a binding change, even if the new declaration happens to be compatible, so start a new tween after changing the shader.

Default lookup requires a working renderer. Godot’s dummy headless renderer can expose declarations but return no default value, and then the start is rejected rather than inventing one. Headless tests can use an explicit material override, but verifying defaults and visible behavior takes rendering tests.

Declare an instance uniform in the shader when nodes sharing the same material need independent values:

# shader: instance uniform float pulse = 0.25;
Tweens.play(mesh, Tweens.instance_shader_parameter(&"pulse", 1.0, 0.5))
Tweens.play(sprite, Tweens.instance_shader_parameter(&"pulse", 0.0, 0.5))

Tweens.instance_shader_parameter() targets a GeometryInstance3D or a CanvasItem, which is also the owner, so these tweens follow the normal node lifetime and pause rules. Value types, validation, captures, and restoration work the same as for material uniforms. After restoration, an explicit override stays explicit, and an originally absent override is removed.

The tween captures the effective material bindings, including inherited CanvasItem materials, mesh surfaces, overrides, overlays and next passes. Replacing the mesh, a material, or a pass, or editing a bound shader, fails the next write. Binding checks are conservative, so changing a tracked slot can fail playback even if another slot still declares the same uniform. Godot controls instance-uniform indexing, capacity, shader compatibility and multi-material conflicts. The addon doesn’t assign or reconcile those declarations.

See ShaderMaterial, CanvasItem, and GeometryInstance3D. See compatibility for rendering limits and handles for failure handling.

tweens.gd is made with math & ferrets, copyright © 2026 its contributors.

Godot logo by Andrea Calabró, licensed under CC BY 4.0.

"Easy, the Ferret" illustrations drawn by foxy_maria.

tweens.gd is released under the MIT License.

Godot is licensed under the MIT License.
tweens.gd is not affiliated with or endorsed by the Godot Foundation.