Created
July 22, 2022 15:50
-
-
Save LeoDog896/faf3aefb9e985a0e3ee2db2b1e4b0b33 to your computer and use it in GitHub Desktop.
Camera transition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Camera | |
export var target: Transform | |
# If the transition is active | |
export var active := true | |
# Strength of the transition | |
export var strength: float = 1 | |
# The "from" transition to transition from | |
onready var starting_transform := self.transform | |
var time: float = 0.0 | |
func _physics_process(delta: float) -> void: | |
if active: | |
time += delta * strength | |
self.transform = starting_transform.interpolate_with(target, min(1, time)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment