There is a a small annoying bug with draw() function: when a project is run, there is a small glitch after 1/5 second, which is ok in backingmode STANDARD, but resets your picture in RETAINED mode. Its seems that the backingmode() function is really applied 1/5s after the beginning of the project start.
@Simeon I can easily manage that by delaying the computations start with a tween.delay(), but since it is a bug, maybe you want to solve it? Or will you let it ‘as is’? I would like to know your choice on that, to adapt my code to this choice. Thanks.
Below is some code to reproduce the bug:
[edit] changed a couple colors to make it even more obvious.
-- test backing
function setup()
ball = {x=0, y=HEIGHT/2, r=50}
tween(1, ball, {x=WIDTH}, {loop=tween.loop.pingpong} )
stroke(0)
strokeWidth(2)
fill(255)
-- choose one of these by commenting one of the lines
draw = draw1 -- STANDARD backing mode
draw = draw2 -- or RETAINED
-- this is to init backingmode during setup (doesnt help)
--draw()
end
function draw1()
if backingMode() ~= STANDARD then
backingMode(STANDARD)
return
end
background(255, 0, 20, 255)
ellipse(ball.x,ball.y,ball.r)
end
function draw2()
if backingMode() ~= RETAINED then
backingMode(RETAINED)
background(255, 0, 20, 255)
return
end
ellipse(ball.x,ball.y,ball.r)
end
-- this is to init backingmode before setup (doesnt help either)
-- draw2()