Material Box

Material Box

WEB Design & Material Images

Godot - Implement rotation animation with Tween

Godot

GDScript code example to implement rotation animation with Tween.


To implement rotation with Tween, specify "rotation_degrees" in tween_property() and set rotation amount and duration.

By setting rotation degrees to "360" and duration to "1", it will rotate once per second.

var tween = create_tween()
tween.tween_property(self, "rotation_degrees", 360, 1.0)
tween.play()

Can use set_loops() to repeat rotation, or increase rotation degrees.

var tween = create_tween().set_loops()
tween.tween_property(self, "rotation_degrees", 360, 1.0)
tween.play()

"rotation" can also be specified instead of "rotation_degrees".
"rotation" is specified with quaternion and mainly used for 3D rotation.

var tween = create_tween()
tween.tween_property(self, "rotation", 2, 1.0)
tween.play()

Godot

TitleGodot - Implement rotation animation with Tween

CategoryGodot

Created

Update

AuthorYousuke.U