How can I write a code to add a new/longer Animation length to CanvasModulate node?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By YeBittenDog

Hello. I am learning GDScript and general coding for the first time so please forgive my lack of overall understanding. I am attempting to increase the length of an animation created in the AnimationPlayer.

The AnimationPlayer is a child of the CanvasModulate node and intended to stretch a 24 frame animation (for day-night-cycle) into a 24 minute animation that loops while playing the game.

Here is my current code in which the Animation does not start and stays on the first frame indefinitely when launching the game:

extends CanvasModulate

onready var animationPlayer = $AnimationPlayer

export var new_length = 1

func _ready():
	$AnimationPlayer.get_animation("Day-Night-Cycle").length = new_length

func _physics_process(_delta):
	$AnimationPlayer.play("Day-Night-Cycle")

Any help would be most appreciated. Thank you kindly. :slight_smile:

  • Aaron