Link Animation speed to a value

  • #1, by PykeTuesday, 14. January 2014, 09:58 11 years ago
    I would love to be able to slowly ramp up/slow down an animations speed by linking it to a value.
    Is there way to do this that I'm just not seeing?

    Newbie

    59 Posts


  • #2, by afrlmeTuesday, 14. January 2014, 12:07 11 years ago
    The only thing I'm seeing for this is "AnimationPause" in the data tructure but according to the data structure it is not scriptable but you can still try it, as the script status is not always correct...
    getObject("Animations[add animation name here]"):setValue(VAnimationPause, add value here)
    
    --example
    getObject("Animations[walk_west]"):setValue(VAnimationPause, 150) -- set delay value between frames of "walk_west" to 150ms
    

    Imperator

    7278 Posts

  • #3, by Simon_ASAThursday, 24. September 2015, 23:20 9 years ago
    It works! Now I can change the speed of my minigame.

    Great Poster

    321 Posts

  • #4, by afrlmeThursday, 24. September 2015, 23:33 9 years ago
    Yeah it works in current session. I believe the reason it said unscriptable on the data structure page of the wiki is because the new value does not get stored into the save file data when you save your game.

    You can make the line of script even smaller than the example I wrote above...
    Animations["test"].AnimationPause = 150
    

    ... there's no reason to use the getObject method seeing as we have the shorthand access method available since 4.x. wink

    Imperator

    7278 Posts

  • #5, by Simon_ASAFriday, 25. September 2015, 16:29 9 years ago
    Yes it's much better with the new method: now I can remember it more easily smile

    This script can be very useful. It makes it possible to create a button to increase or decrease the speed of an animation.

    Great Poster

    321 Posts

  • #6, by afrlmeFriday, 25. September 2015, 16:49 9 years ago
    Yep. It's also possible to control the play order (forwards / reverse / random) of an active animation. The position of an active animation. The active frames (from x to y frame). Whether the animation has a random pause between each loop & the min - max duration of the random pause value. All in all, they allow you to get pretty creative with animations. wink

    Imperator

    7278 Posts