Animation Suggestion

I have two blocks that i need to move based on a boolean value, Im not looking for anything crazy. I just want to move the block in the X direction from position 800 to 850 when the boolean is true and then back to spot 800 when the boolean goes back to zero.

Does anyone have any suggestions on how to actuate this?

I was simply going to use an expression on the x value and move it based on the tag but if there are other options i would like to know.

Thanks!

The best method would be with an expression. Nice and simple.

is there any way to slow the movement? maybe with a timer? I tried but i couldn’t get the timer to reverse its count. Any suggestions? Thanks

I worked up a way to move animate an object. One part of the script will move the object right and the other will move it left. You will need to figure out how you want to trigger this.

[code]move = event.source.animate
x = event.source.relX

if event.propertyName == “animate”:
if x >= 50 and x <=99:
newX = x + 1
event.source.relX = newX
if x == 99:
event.source.parent.getComponent(‘Timer’).running=0
if x <= 100 and x >= 50:
newX = x - 1
event.source.relX = newX
if x == 51:
event.source.parent.getComponent(‘Timer’).running=0 [/code]

The timer component I used is set to

Delay(ms) 50
Initial Delay(ms) 50
Step by 1

This should get you started