Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Repeating/Looping "transition.to" on "display.newImage's"
Started by aaqil.farahcampbell21 Apr 08 2019 06:46 PM

1 reply to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

aaqil.farahcampbell21

[GLOBAL: userInfoPane.html]
aaqil.farahcampbell21
  • Observer

  • 1 posts
  • Corona SDK

--declaring variable h, adding and positioning images, and a button
w = display.contentWidth
h = display.contentHeight
B = display.newImage("B.png")
B.x = w*.1
B.y = h*.2
S = display.newImage("S.png")
S.x = w*.4
S.y = h*.2
R = display.newImage("R.png")
R.x = w*.8
R.y = h*.2
btn = display.newCircle(w/2, h*.9, w/10, h/2)
btn:setFillColor(0,1,0)
--trying to continually make 3 images S,R and B move down the screen, if a button is clicked
function fall(event)
if 1==1 then 
transition.to(S,{h/2})
transition.to(R,{h/2})
transition.to(B,{h/2}) 
end
end
btn:addEventListener("tap",fall)


[TOPIC: post.html]
#2

thomas6

[GLOBAL: userInfoPane.html]
thomas6
  • Contributor

  • 982 posts
  • Corona SDK

It's hard to even decipher if this is a question or not!

 

But I can tell you the transitions won't work because:

A: you don't specify the time for the transition

B: you only give a value "h/2" but you don't specify what property needs to transition to this value. Do you want to change the x position, y position, scale, alpha??

 

It would work better like this:

transition.to(S, {time = 1000, y = h/2})

 

 

p.s. Your "if 1 == 1" condition will always be true! But you probably know that, right?




[topic_controls]
[/topic_controls]