Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Link Animation speed to a value

  • #1, by Pyke 13 years ago Zitieren
    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?
  • #2, by afrlme 13 years ago Zitieren
    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
    
  • #3, by Simon_ASA 11 years ago Zitieren
    It works! Now I can change the speed of my minigame.
  • #4, by afrlme 11 years ago Zitieren
    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
  • #5, by Simon_ASA 11 years ago Zitieren
    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.
  • #6, by afrlme 11 years ago Zitieren
    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