Description

DISCLAIMER: This video was filmed in Godot 4.2.2, but I changed the title to Godot 4.3 as nothing between those versions affected the features presented in t…

My Notes

0:00 Basic Tweens

var tween = create_tween() # Lives as long as the node
var global_tween = get_tree().create_tween() # Lives as long as the scene 
# move to the right over 2 seconds
tween.tween_property(self, "position", position + Vector2.RIGHT * 200, 2)

03:11

tween.tween_property(self, "position:x", position.x + 200, 2)

03:56

tween.tween_property(self, "position:x", 200, 2).as_relative()

Repeating tween

04:49

var tween = create_tween().set_loops() # loop indefinitely
var tween = create_tween().set_loops(5) # loop 5 times

06:16 Animate horizontally from x:-200 to x:1200 over 2.

tween.tween_property(self, "position:x", 1200, 2).from(-200)

6:51 Advanced Tweens

var tween = get_tree().create_tween()
# Shrink the character to nothing over 3 seconds. 
tween.tween_property(self, "scale", Vector2.ZERO, 3)
# At this point the character still exists in the tree, but is 
# too small to see.

09:37

tween.tween_property(self, "scale", Vector2.ZERO, 3)
 
tween.tween_callback(queue_free)
# after the tween is finished, remove self from the scene tree. 

10:11

tween.tween_property(self, "scale", Vector2.ZERO, 3)
tween.tween_callback(shrunk.bind("Bye Bye"))
# Prints "Bye Bye" after the tween finishes.
 
func shrunk(message):
	print(message)

10:46

tween.tween_interval(2) # pause for 2 seconds before continuing onto the next step in this tween's animation

11:02

tween.tween_method(shrunk, 0, 200, 3)
# Repeatedly call shrunk method passing in values from 0 to 200
# over the duration of 3 seconds

13:07 Tween parallelism

# runs each tween one after another
var tween = create_tween() # right THEN down
 
 # runs each tween at the same time
var tween = create_tween().set_parallel(true) # diagonal down-right
 
tween.tween_property(self, "position:x", 200, 2) # move left
tween.tween_property(self, "position:y", 200, 2) # move down

16:00 Animating multiple nodes

17:55 Tweens in practice - Triggering tween from input events

23:55 Transitions and Easing

  • Transition: a mathematical function that the tween should follow
  • Easing: how quickly the tween should begin to follow that function
  • 25:32: Tween Interactive Cheat Sheet