Hey, just working on some fancy game graphics. It’s a pretty simple function that makes the image pulse, and if you change one sin to cos it gives the image a sort of underwater effect
function setup()
end
function draw()
background(40, 40, 50)
sprite("Tyrian Remastered:Blimp Boss",WIDTH/2,HEIGHT/2,
math.sin(10*ElapsedTime)*50+500,math.sin(10*ElapsedTime)*50+500)
end
I think the trig example feels more fluid, and using tweens feels a bit more rigid. Tweens do provide a larger range of effects, though, so it all depends on the personality you want
I’m not sure tweens are necessarily more efficient in this case. Same math is done in both cases, and trigonometry functions are implemented in C anyway. I’d actually expect the no-tweens solution to use less resources… but no easy way to check.
( Adding FPS counter doesn’t resolve the dispute one way or the other - solid 60 for both )