ActiveAnimations (Android)

  • #1, by darren-beckettTuesday, 08. September 2015, 14:49 5 years ago
    I'm using the following script to move some animations, it's works perfectly for PC, but does not work for Android.
    Error: Attempt to index global 'ActiveAnimations' (a nil value)

    startObjectTween(ActiveAnimations["Glass01"], VAnimationCurrentPosition, ActiveAnimations["Glass01"].AnimationCurrentPosition, {x = 100, y = 300}, 500, easeQuintOut)

    Great Poster

    351 Posts


  • #2, by darren-beckettWednesday, 09. September 2015, 13:34 5 years ago
    Can anybody confirm that startObjectTween should work on android?

    Great Poster

    351 Posts

  • #3, by darren-beckettWednesday, 09. September 2015, 13:44 5 years ago
    And will it be added/fixed in a future release?

    Great Poster

    351 Posts

  • #4, by afrlmeWednesday, 09. September 2015, 14:42 5 years ago
    I've never tested on android before. Maybe the startObjectTween() function does not work on android? Maybe you could try using the recent to() function instead?
    ActiveAnimations["Glass01"]:to(500, { AnimationCurrentPosition = {x = 100, y = 300} }, easeQuintOut)
    1
    2

    ... the animation is definitely playing or preloaded at the time of you executing the script, yes?

    P.S: there is a none tween method you could use. You could create a temporary mainLoop handler for moving the animation, but there will be no support for easing or time it takes to get from the current position to the target - well unless you were to use the mainLoop in combination with a called by other action & a condition to determine when the animation should update & by how many pixels. Calculate distance in pixels on x & y from target x & y then share those answers by the time in ms. It's only math after all.

    Imperator

    6842 Posts

  • #5, by darren-beckettWednesday, 09. September 2015, 14:48 5 years ago
    Thanks, I will have a play.

    Great Poster

    351 Posts

  • #6, by darren-beckettThursday, 10. September 2015, 14:13 5 years ago
    I've performed a few more tests and i can confirm that Android cannot access the ActiveAnimations directly.
    You can however use GetObject to retrieve the active animations, see this working example:

    --Retrieve ActiveAnimation
    local mAnim = getObject("ActiveAnimations[Glass01]")

    --Use local Animation object
    startObjectTween(mAnim, VAnimationCurrentPosition, mAnim.AnimationCurrentPosition, {x = 100, y = 300}, 500, easeQuintOut)

    Great Poster

    351 Posts

  • #7, by afrlmeThursday, 10. September 2015, 14:55 5 years ago
    Hmm I guess Android has no support for the new short method access.

    You should still be able to use the to() function though I think.

    Let me know if this works...
    getObject("ActiveAnimations[Glass01]"):to(500, { AnimationCurrentPosition = {x = 100, y = 300} }, easeQuintOut)
    1
    2


    P.S: you don't always have to create variables. It all depends on what you are doing. Sometimes it's just simpler to use an execute a script action & write the script inside of that on a single line or two.

    Imperator

    6842 Posts

  • #8, by darren-beckettTuesday, 22. September 2015, 16:49 5 years ago
    I've also found that Android cannot access the Buttons[LeftClick] methods directly:
    It needs to referenced like this:
    local mObj = getObject("Buttons[LeftClick]")
    startAction(mObj.Actions["Called by other action"])
    1
    2
    3

    Great Poster

    351 Posts

Write post