THE ILLUSION
CONCEPT
I have a deep fascination for optical illusions, which I began exploring from a young age. Among my favorite illusions is the one depicted below, consisting of multiple squares of diminishing size stacked at various angles. I decided to recreate this illusion infusing it with a rotation effect to make It more appealing.

Initially, the squares rotated in fixed positions, but I visualized a more satisfying illusion with a deliberate pattern. After researching techniques, I stumbled upon a video tutorial explaining the application of sine and cosine functions to create intricate patterns. After hours of trial and error its look never failed to create a smile on my face.
Yet, my creation remained monochromatic. To enhance its visual allure, I refined the project by applying color adjustments using the frame count in combination with sine and cosine functions. This introduced a pleasing and seamless color transition, which I extended to the background to enhance its overall appeal.
Code Highlight
translate(width/2, height/2);
for(var i = 0; i < 200; i++)
{
push()
rotate(sin(frameCount + i ) * 100)
var r = map(sin(frameCount), -1, 1, 50, 255)
var g = map(cos(frameCount /6), -1, 1, 50, 255)
var b = map(sin(frameCount /2), -1, 1, 50, 255)
stroke(r,g,b)
rect(0, 0, 600 - i * 3, 600 -i * 3, 200 - i)
pop()
}
The Illusion
reflection and improvement
I am looking forward to incorporating user agency into this illusion project, enabling individuals to have control over aspects such as the spiral patterns and color schemes.