Controlling the animations speed in the entire scene.

KittiNekoKittiNeko Posts: 1Member

Hello, An artist stumbling around gdscript here.

How do I control the over all speed of the animations in the entire scene via script?

I have a several parallaxing layers within the scene that has a basic scrolling/looping animation, but want to be able to adjust the speed of the entire scene without going into each AnimationPlayer and adjust them one by one.

Answers

  • Shin-NiLShin-NiL Posts: 158Moderator
    edited July 2017

    I don't know if there is a global way to do this. But you can add each animation to a group
    your_animation_player_node.add_to_group("animations")

    And iterate over each item to set the overall speed

    func set_overall_speed(speed):
        var animations = get_tree().get_nodes_in_group("animations")
        for animation in animations:
            animation.set_speed(speed)
    
Sign In or Register to comment.