Here’s some code for a kaleidoscope. I didn’t put much time into it so it can probably be improved. Change the value of a
to increase or decrease to number of images used. Make it 10, 15, 20, 30, 45, 60, 90, 120. It uses the camera so point it at something colorful.
displayMode(FULLSCREEN)
function setup()
cameraSource(CAMERA_BACK)
a=20 -- change this in multiples of 360
x=math.cos(math.rad(a))*WIDTH
y=math.sin(math.rad(a))*WIDTH
myMesh = mesh()
myMesh.vertices = {vec2(0,0),vec2(WIDTH,0),vec2(x,y)}
myMesh.texCoords = {vec2(0,0),vec2(1,0),vec2(0,1)}
end
function draw()
background(40, 40, 50)
collectgarbage()
img=image(CAMERA)
translate(WIDTH/2,HEIGHT/2)
if img~=nil then
myMesh.texture = img
for z=1,360/a do
rotate(a)
myMesh:draw()
end
end
end