Hello guys, i need some help with layers in codea. Its not a secret, what codea do draws anything on “layers”, like in photoshop. And i dived my project on classes. So i have background class, interface and so on. I need to draw something, what is moving on one layer, then it reaches border draw on another layer under this one and continue this moving. There is picture what i need
draw your balls first, and your yellow layer last, it will do what you want.
@jvm38 i cant, cuz it will be a lot of changes, yellow layer is under blue one
i thought i can do it neat way
@lupino8211 If you need an example.
displayMode(FULLSCREEN)
function setup()
x,y=0,WIDTH/2
end
function draw()
background(31, 93, 110, 255) -- draw blue background first
fill(255,0,0)
ellipse(x,y,100) -- draw red circle second
fill(255, 222, 0, 255)
rect(WIDTH/3,0,WIDTH/3,HEIGHT) -- draw yellow rectangle last
x=x+1
end
@dave1707 i know it, i wonder: can i jump from layer to layer by one circle. In case i need make only second way from picture, then one side of picture is still visible and second one is not
i tried det context, but it slows down my project
@lupino8211 - try this. use translate to separate your layers
function setup()
pos=vec2(0,HEIGHT/2)
speed=1
end
function draw()
background(0)
pushMatrix()
translate(0,0,1)
fill(0, 152, 255, 255)
rect(200,200,600,600)
translate(0,0,2)
fill(101, 255, 0, 255)
rect(400,400,200,200)
popMatrix()
translate(0,0,1)
fill(255,255,0)
ellipse(pos.x,pos.y,100)
pos.x=pos.x+speed
end