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

ActiveAnimations (Android)

  • #1, by darren-beckett 11 years ago Zitieren
    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)
  • #2, by darren-beckett 11 years ago Zitieren
    Can anybody confirm that startObjectTween should work on android?
  • #3, by darren-beckett 11 years ago Zitieren
    And will it be added/fixed in a future release?
  • #4, by afrlme 11 years ago Zitieren
    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)
    

    ... 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.
  • #5, by darren-beckett 11 years ago Zitieren
    Thanks, I will have a play.
  • #6, by darren-beckett 11 years ago Zitieren
    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)
  • #7, by afrlme 11 years ago Zitieren
    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)
    


    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.
  • #8, by darren-beckett 11 years ago Zitieren
    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"])