Is there any easy way to rotate something (preferably a physics body) over timer or equally over distance? Example: a line rotating 90 equally over the time it takes for it to move across the screen. Something that would work like tween.rotate if it existed.
@Staples Something like this.
displayMode(FULLSCREEN)
function setup()
r=0
x=0
stroke(255)
strokeWidth(4)
end
function draw()
background(40, 40, 50)
translate(x,HEIGHT/2)
rotate(r)
line(0,-50,0,50)
x=x+1
r=r+90/WIDTH
end
@Staples If you want to use a tween, here’s an example with a sprite.
displayMode(FULLSCREEN)
function setup()
t = {x=0,y=HEIGHT/2,rot=0}
tween(2,t, {x=WIDTH,y=HEIGHT/2,rot=360},
{easing = tween.easing.linear,loop = tween.loop.pingpong})
end
function draw()
background(40, 40, 50)
pushMatrix()
translate(t.x,t.y)
rotate(t.rot)
sprite("Planet Cute:Character Boy")
popMatrix()
end