#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Tween.sequence table help

edited April 2020 Posts: 130

I’m halfway complete with this code. I would like the ellipse to travel along the edge of the screen and end up back where it started. I got it to travel halfway but need help finishing.

``````function setup()
point = {x = WIDTH*.95, y = HEIGHT*.95}

tweens = {
tween(1, point, {x=WIDTH*.10}),
tween(1, point, {x=50}),
tween(1, point, {y=HEIGHT*.05}),

}

tween.sequence(unpack(tweens))
end

function draw()
background(0)
ellipse(point.x, point.y, 50)
end
``````
Tagged:

• Mod
Posts: 10,046
``````displayMode(FULLSCREEN)

function setup()
point = {x = 50, y = 50}
end

function tween1()
t1 = tween(2, point, {x = 50,y=HEIGHT-50})
t2 = tween(2, point, {x = WIDTH-50,y=HEIGHT-50})
t3 = tween(2, point, {x=WIDTH-50,y = 50})
t4 = tween(2, point, {x=50,y = 50})
tween.sequence( t1, t2, t3, t4 )
end

function draw()
background(0)
fill(255)
text("tap screen to start",WIDTH/2,HEIGHT/2)
ellipse(point.x, point.y, 50)
end

function touched(t)
if t.state==BEGAN then
tween1()
end
end
``````
• Posts: 130

@dave1707 I use percentages so it scales to any size screen but using your logic I was able to figure it out. Thanks Dave!

``````displayMode(FULLSCREEN)

function setup()
point = {x = WIDTH*.04, y = HEIGHT*.04}
end

function tween1()
t1 = tween(2, point, {x = WIDTH*.04,y=HEIGHT-HEIGHT*.04})
t2 = tween(2, point, {x = WIDTH-WIDTH*.04,y=HEIGHT-HEIGHT*.04})
t3 = tween(2, point, {x=WIDTH-WIDTH*.04,y = HEIGHT*.04})
t4 = tween(2, point, {x=WIDTH*.04,y = HEIGHT*.04})
tween.sequence( t1, t2, t3, t4 )
end

function draw()
background(0)
fill(255)
text("tap screen to start",WIDTH/2,HEIGHT/2)
ellipse(point.x, point.y, 50)
end

function touched(t)
if t.state==BEGAN then
tween1()
end
end
``````