This art utilizes trigonometric functions such as sine (sin), cosine (cos), and tangent (tan) for color generation. It also incorporates geometry, including radii and angle math, to determine positions and more.
Enjoy this unique art, created entirely using JavaScript.
The position of the pen point (x, y) on the paper or canvas is determined by trigonometric equations.
The x-coordinate (horizontal position) of the pen point is given by the equation: x = (R - r) * cos(θ) + d * cos(((R - r) / r) * θ)
The y-coordinate (vertical position) of the pen point is given by the equation: y = (R - r) * sin(θ) - d * sin(((R - r) / r) * θ)
To create the Spirograph pattern, you start with an initial angle (θ).
You calculate the x and y coordinates of the pen point using the equations mentioned above.
You draw a point or a small shape (such as a circle) at this (x, y) position on the paper or canvas.
You increment the angle (θ) by a small amount (e.g., 0.01 radians) and repeat the process.
By continuously calculating the coordinates and drawing, the pen point traces a path on the canvas, creating the Spirograph pattern.