Skip to content

Instantly share code, notes, and snippets.

@LeoDog896
Created July 22, 2022 15:50
Show Gist options
  • Save LeoDog896/faf3aefb9e985a0e3ee2db2b1e4b0b33 to your computer and use it in GitHub Desktop.
Save LeoDog896/faf3aefb9e985a0e3ee2db2b1e4b0b33 to your computer and use it in GitHub Desktop.
Camera transition
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