i am new to corona sdk and i have been experimenting with the software for a while now, but i am building an app at the same time
I was trying to get a image to move from one position to another when i click a button; this worked howwever i noticed that if i keep clicking the button the image would keep moving left.
is there a way that i can get the image to reset itself and start the transition from start again when the button is pressed again?
or/and is there a function i could use so that once the image has moved after the first button press, it then moves back to its origin on the second button press?
here is my code below:_________________________________
local background = display.setDefault(“background”, 255, 255, 255 )
widget = require(“widget”)
local rightEyeCover = display.newImage( “eyecoverright.png”, left, top, isFullResolution )
rightEyeCover:translate( 620, -30)
local function event1(event)
transition.to(rightEyeCover, {time = 2000, x = -350, delta=true, transition=easing.outQuad })
–transition.to(rightEyeCover, {time = 2000, x = 0, delta=true, transition=easing.outQuad })
end
local button6 = widget.newButton{
label = “move shape”,
fontSize = 30,
width = 640,
height = 90,
left = 0,
top = 355,
onPress=event1
}
please answer asap
thanks 