Codeaseption - experiments with setContext()

The code is slow because setContext is optimized(wrong word, setup?) for 3d

-- Setcontext
supportedOrientations(PORTRAIT_ANY)
displayMode(FULLSCREEN)
-- Use this function to perform your initial setup
function setup()
    pic=readImage("Cargo Bot:Codea Icon",WIDTH,HEIGHT)
    img=image(WIDTH,HEIGHT)
    setContext(img)
    sprite(pic,WIDTH/2,HEIGHT/2)
    setContext()
    local num=36
    for i=1,num do
        imgInImg(img,10*i,1-num/i)
    end
end

-- This function gets called once every frame
function draw()
    background(0)
    sprite(img,WIDTH/2,HEIGHT/2)
end

function imgInImg(i,a,s)
    setContext(i)
    pushMatrix()
    translate(WIDTH/2,HEIGHT/2)
    scale(s)
    rotate(a)
    sprite(pic,0,0)
    setContext()
    popMatrix()
end

Really cool!

@coder you probably can do it live with a shader.

It’s not very hard to do it with a shader, but nice.

I’ll have to try it with a shader next, thanks :slight_smile:

Beautiful effect, thanks for sharing !