Why only the first animation works good in my program? An image should move from left to the right and then from right to the left. This is happening only from left to the right.
Shoes.app do
@im = image("D:/image.jpg", left: 0, top: 220, width: 180, height: 230)
@an = animate 20 do
if @im.left < (self.width-@im.width)
@im.left += 5
else
@an.stop
end
end
@an2 = animate 20 do
if @im.left <= (self.width-@im.width) and @im.left > 0
@im.left -= 5
else
@an2.stop
end
end
end