We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

How to detect if one or more animations are playing

Home Forums Puzzles How to detect if one or more animations are playing

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #54462

    Hi all,
    is there an easy way to detect if there is almost one application in playing?
    I have a lot of animations and I don’t want to declare and check one by one.

    For me, the best solution should be something like:

    if
    is_animation_playing > any_object = true
    do

    end if

    Thank you very much

    #54463
    haris
    Customer

    Use is anim playing puzzle :good:

    Regards,
    Haris

    harisimran1012@gmail.com

    #54466
    kdv
    Participant

    to detect if there is almost one application in playing?

    If your objects have only one animation and all animations have the same name as their objects then you can use this

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #54492

    Thank you Haris, I just did. Do you have a more specific solution?

    Thank you Kdv77kdv, I have a lot of animations with different names. The project is quite complex. I just tried you solution without success. Please, can you provide me an insight about how to detect if one ore more animation playing in the scene?

    #54495
    kdv
    Participant

    I have a lot of animations with different names

    and these names differ from the names of their objects? Then you should use scripting

    function isAnimActive() {
        for (let j = 0; j < app.actions.length; j++) {
            if (app.actions[j].isRunning()) {
                return true;
            }
        }
        return false;
    }
    
    if (isAnimActive()) {
        console.log('at least one animation is active');
    } else {
        console.log('all animations are stopped');
    }

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #54505

    Kdv77kdv, your help is very precious ad I think we are very close to the solution but the script return an error and the application doesn’t start.
    I tryied to manage it connecting to different blocks but nothing.
    And if I past in external .js it return an error, seems that
    app.actions…
    instruction is not recognized.

    I’m using the last version, Verge 4.1 with activated licence.

    Could be the version the problem?
    Is the syntax different?

    Thank you again

    #54506
    kdv
    Participant

    And if I past in external .js it return an error

    You cannot use the variable app in external scripts. This variable is declared in visual_logic.js only…

    The script above will work with no problems in the main section of puzzles, but will not in the init section.

    p.s. I’ve just noticed that this forum breaks the script ))) It hides i in the square brackets. I’ve updated the script by replacing i with j in the loop ))) The screenshot is showing the correct variant )))

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.