This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

How to check if the animation is enabled?

dzosekdzosek Posts: 37Member

Resulting true, false.

Best Answer

  • jbrooks79jbrooks79 Posts: 2,241
    Accepted Answer

    I only know how to use Visual script, but if you drag an AnimationPlayer node into the Visual Script area, you get a list, on it there's a function ( fn() ) named is_playing() . . It returns a boolean, so I assume if the animation in that special AnimationPlayer node is playing it will print ' TRUE ', until it stops, then become ' FALSE ' . .

    I am not sure how it looks in GDScript code, but maybe you can type something like AnimationPlayer.is_playing() =, then that should return TRUE, if the animation in the player is running, or not . . . You need the experts here to explain how it really works, though . . .

    AnimationPlayer docs . .
    https://docs.godotengine.org/en/stable/classes/class_animationplayer.html

    Section, about is_playing()

    bool is_playing ( ) const
    Returns true if playing an animation.

    I THINK that is fancy words for, you get a BOOLEAN ( TRUE or FALSE value ), if it is playing or, not . . .? :(( <3 <3

    https://docs.godotengine.org/en/stable/classes/class_animationplayer.html#class-animationplayer-method-is-playing

Answers

  • TwistedTwiglegTwistedTwigleg Posts: 2,561Admin

    What type of animation, and what node? How are you checking if the animation is enabled or not? It is hard to know what to suggest without knowing what is going on.

  • jbrooks79jbrooks79 Posts: 2,241Premoderated
    Accepted Answer

    I only know how to use Visual script, but if you drag an AnimationPlayer node into the Visual Script area, you get a list, on it there's a function ( fn() ) named is_playing() . . It returns a boolean, so I assume if the animation in that special AnimationPlayer node is playing it will print ' TRUE ', until it stops, then become ' FALSE ' . .

    I am not sure how it looks in GDScript code, but maybe you can type something like AnimationPlayer.is_playing() =, then that should return TRUE, if the animation in the player is running, or not . . . You need the experts here to explain how it really works, though . . .

    AnimationPlayer docs . .
    https://docs.godotengine.org/en/stable/classes/class_animationplayer.html

    Section, about is_playing()

    bool is_playing ( ) const
    Returns true if playing an animation.

    I THINK that is fancy words for, you get a BOOLEAN ( TRUE or FALSE value ), if it is playing or, not . . .? :(( <3 <3

    https://docs.godotengine.org/en/stable/classes/class_animationplayer.html#class-animationplayer-method-is-playing

  • MegalomaniakMegalomaniak Posts: 2,580Admin

    Yes the AnimationPlayer node has a boolean method is_playing that would give you the boolean true/false according to the state.

  • jbrooks79jbrooks79 Posts: 2,241Premoderated

    I tested it in Visual script, I start with a camera being animated, to make a sort of intro, or cinematic, and when printing the is_playing() it returns TRUE in debug, as long as the animation is running, and when it stops, moves to game-play, it says false, in the console . . . I think you want that one but, I have no idea how to code that, at all, am complete beginner <3 <3 :(

  • jbrooks79jbrooks79 Posts: 2,241Premoderated

    Here's a 1 minute video, where you can see it, it's the best I can do, at the moment . . .

    :D <3

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.