Skip to content

Tweening sequences and spawners sample GDScript code

Elia Sarti edited this page Aug 11, 2018 · 1 revision
tween.create_sequence(
	tween.create_sequence(
		tween.create_sequence(
			tween.interpolate_property($view/Panel1, "rect_position", $view/Panel1.rect_position, min_pos, time1, state.trans, state.eases),
			tween.interpolate_property($view/Panel1, "rect_rotation", 0, 15, time2, state.trans, Tween.EASE_OUT),
			tween.interpolate_property($view/Panel1, "rect_rotation", 15, 0, time2, state.trans, Tween.EASE_IN),
			tween.interpolate_property($view/Panel1, "rect_rotation", 0, -15, time2, state.trans, Tween.EASE_OUT),
			tween.interpolate_property($view/Panel1, "rect_rotation", -15, 0, time2, state.trans, Tween.EASE_IN)
		),
		tween.create_spawner(
			tween.interpolate_property($view/Panel2, "rect_position", $view/Panel2.rect_position, $view/Panel1.rect_position, time1, state.trans, state.eases),
			tween.create_sequence(
				tween.interpolate_property($view/Panel2, "rect_scale", Vector2(1, 1), Vector2(0.6, 0.6), time1 * 0.5, state.trans, Tween.EASE_IN),
				tween.interpolate_property($view/Panel2, "rect_scale", Vector2(0.6, 0.6), Vector2(1, 1), time1 * 0.5, state.trans, Tween.EASE_OUT)
			)
		),
		tween.create_spawner(
			tween.interpolate_property($view/Panel3, "rect_position", $view/Panel3.rect_position, $view/Panel2.rect_position, time1, state.trans, state.eases),
			tween.create_sequence(
				tween.interpolate_property($view/Panel3, "rect_rotation", 0, 360, time1 * 0.5, state.trans, 0),
				tween.interpolate_property($view/Panel3, "rect_rotation", 360, 0, time1 * 0.5, state.trans, 0)
			)
		),
		tween.create_spawner(
			tween.interpolate_property($view/Panel4, "rect_position", $view/Panel4.rect_position, $view/Panel3.rect_position, time1, state.trans, state.eases),
			tween.create_sequence(
				tween.interpolate_property($view/Panel4, "rect_scale", Vector2(1, 1), Vector2(-1, 1), time1 * 0.5, state.trans, Tween.EASE_IN),
				tween.interpolate_property($view/Panel4, "rect_scale", Vector2(-1, 1), Vector2(1, 1), time1 * 0.5, state.trans, Tween.EASE_OUT)
			)
		)
	),
	tween.create_sequence(
		tween.interpolate_property($view/Panel4, "rect_position", $view/Panel3.rect_position, $view/Panel4.rect_position, time1, state.trans, state.eases),
		tween.interpolate_property($view/Panel3, "rect_position", $view/Panel2.rect_position, $view/Panel3.rect_position, time1, state.trans, state.eases),
		tween.interpolate_property($view/Panel2, "rect_position", $view/Panel1.rect_position, $view/Panel2.rect_position, time1, state.trans, state.eases),
		tween.interpolate_property($view/Panel1, "rect_position", min_pos, $view/Panel1.rect_position, time1, state.trans, state.eases)
	)
)
Clone this wiki locally