This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Todd Calvert
Posted Jun 15 - Read on Facebook

How can I move a background image in 200px increments? My code isn't resetting the X position of the background image.

I am making a Dpad to slowly move a camera feed image. The arrow buttons are using states to show a hit state. I am using an animation with the the x position of camera feed image as a starting point and adding 200px.

The animation fires once and moves the image from 0 to -200.
The second time I click the arrow buttons the x position doesn't move to -400. It stays at -200.

rightAnim = new Animation
layer: cameraFeed
properties:
x: cameraFeed.x + 200
delay: Utils.randomNumber(0, 4)

rightBTN.on Events.Click, () ->
rightBTN.states.switch("default")
rightAnim.start()
print cameraFeed.x
rightBTN.onAnimationEnd ->
rightBTN.states.switch("inactive", time: .5)