Home AMX User Forum AMX Control Products

How do you pause an animated button?

Is there anyway to pause and then restart a multi-state general button that has Auto-Repeat set to Yes and feedback always on. The ^ANI command works great and I?m assuming that?s the command I need to use but I can?t figure out the params to use to make it pause.
"'^ANI-<variable text address range>,<start state>,<end state>,<time>'"
Run a button animation. Time is in 1/10 seconds and is optional.
0 for state means current state.

Syntax:
SEND_COMMAND <DEV>,"'^ANI-<vt addr range>,<start state>,<end state>,<time>'"

Since 0 for state means current state, I tried plugging in a 0 for both the start state and the end state but that doesn?t do anything except to stop the animation when it reaches the last state (which is not what I would have expected since Auto-Repeat is Yes and feedback channel is always on)

So then I tried a 1 for start state and a 0 for end state and as expected that makes the button flicker between the first state and the current state (an almost pause)

I also tried turning the feedback channel off but that didn?t do anything for me either.

Any ^ANI experts out there that can help me out?

TIA

Comments

  • VLCNCRZRVLCNCRZR Posts: 216
    animated button control

    Joe,

    I was banging my head against the wall with using multi-state buttons
    for animations a while back. At that time, I was trying to find a way to
    query the button for the current state. This is not possible, just for the
    reasons you stated in your post.

    I ended up emulating the "always-on" feedback through code. It seems
    as the feedback type property falls into the group of properties that
    override any code commands. Once it is set a specific way in TPD4,
    it cannot be modified by external commands.

    Now, if I need to have any control over the multi-state button, I just
    send ON and OFF commands when applicable.
  • Joe HebertJoe Hebert Posts: 2,159
    In my particular situation, I don?t care what the current state is. I just want to send a command to pause the animation at whatever the current state happens to be. I tried your suggestion of changing the feedback to channel and then turning the channel off and on via code, however, that didn?t get me any further in trying to figure out how to pause.

    Are you saying you have been able to pause an animated button? If so, can you explain how? I?m getting nowhere fast.

    Thanks.
  • dbradydbrady Posts: 30
    I dont think this is possible with a multistate general button.(someone correct me if i'm wrong?)

    You could use a multi state bargraph with some timeline code to achieve it though. Put your animation states into the multistate bargraph and give it a high range equal to your maximum number of states. Create a repeating timeline and in each timeline event send a level incremented by one to your bargraph, Loop it back to 0 when you reach your bargraph high range.Now on a button event on your bargraph pause your timeline with 'timeline_pause'. You can restart it with 'timeline_restart'. This will achieve what you're trying to do.
  • VLCNCRZRVLCNCRZR Posts: 216
    animation control

    I should have clarified, I was NEVER able to get a multi-state button
    to pause mid-stream during an animation.

    The multi-state bargraphs are nice for level control, but apparently dont
    have the ability to auto-repeat by themselves.

    It sounds like a custom timeline would probably be the way to go.

    I am hoping that in the near future, these touch panels will support more animation type effects natively, without writing special code for it.
  • Joe HebertJoe Hebert Posts: 2,159
    dbrady wrote:
    You could use a multi state bargraph with some timeline code to achieve it though.
    Thanks for the suggestion. Yes, I?ve considered that alternative, however, in my case that will generate way too much unnecessary traffic as the animation is going to run continuously (unless it is paused ? which apparently can?t be done) and my code will have to send level commands non stop. The best part about the animated button in conjunction with the ^ANI command and other formatting commands is that I can control and modify the animation and generate very little traffic. All the hard work is done on the touch panel side of life with a minimal amount of strain on the Netlinx program and the network.

    I guess I?m going to have to abandon the idea of pausing. Feature request? :)

    Thanks for the feedback guys.
  • Spire_JeffSpire_Jeff Posts: 1,917
    I don't have the time to try this out right now, but if you created a timeline that fired at the same frequency of the button animation, you could simply start the timeline when you turn on the button. The timeline would simply keep track of the current button state. In the event you need to pause the button, just grab the current state and send the ^ANI with the start and stop frames set to the current frame. This should be able to do what you want. You may have to turn off the channel before issuing this command, but from my experience recently with the ^ANI command, this should work. Oh, don't forget to give the button an address code or the ^ANI command won't work ;)

    Jeff
  • jjamesjjames Posts: 2,908
    Any Updates?

    Has anyone made it work?
  • viningvining Posts: 4,368
    Pausing Animations

    This is what I've used for stopping animations as well as changing speeds, etc. I guess what you want is to stop where ever you are in the animation vice at the end of the run which is what it appears to always do. I had to double check this one and it does indeed finish its run before stopping. I did have mine set to "Always On" and Repeat "yes".

    The timeline idea peviously mentioned would probably be the only way to stop where it is but as you said that would always be running in the processor where I guess the animation runs on the TP independent of the processor once initiated.

    Here's what I've used FYI:
    {
    push:
    {
    local_var integer nAniB
    nAniB = button.input.channel
    switch (nAniB)
    {
    case 1://high speed
    {
    // paddle fan animation
    //"'^ANI-<vt addr range>,<start state>,<end state>,<time>'"
    send_command dvAni_Array,"'^ANI-1,1,7,1'"
    }
    case 2://medium speed
    {
    send_command dvAni_Array,"'^ANI-1,1,7,2'"
    }
    case 3://low speed
    {
    send_command dvAni_Array,"'^ANI-1,1,7,6'"
    }
    case 4://stop
    {
    send_command dvAni_Array,"'^ANI-1,0,0,0'"
    }
    //walking man animation !!!!!!
    //"'^ANI-<vt addr range>,<start state>,<end state>,<time>'"
    send_command dvAni_Array,"'^ANI-2,1,20,10'"
    }
    case 5: //running man
    {
    send_command dvAni_Array,"'^ANI-2,1,20,23'"
    }
    case 6://walking man
    {
    send_command dvAni_Array,"'^ANI-2,1,20,50'"
    }
    }
    }
Sign In or Register to comment.