Creative Coding: Celestial Patterns
Coding the movements of planets in relation to each other as they travel around the sun.
Within the Milky Way Galaxy, little is known about each planet, but their paths around the solar system have been documented by scientists. When looking at one of their paths around the sun combined with another planet’s, an pattern is made, creating an invisible piece of artwork in the sky. I wanted to create a visualization of these unique patterns inspired by the movements between multiple planets using code in the p5.js editor.
Role
Designer
Institution
Temple University, Tyler School or Art and Architecture
Art Direction
Jenny Kowalski
The Plan, Experimentation, and Research
Some helpful tutorials and resources included:
I began the project by mapping where each planet sits in relation to Earth. I chose not to make their orbits exact because I wanted to focus on experimentation. I created digital paintings to represent the planets, stars, and asteroid field.
Experimenting allowed me to learn the most about code. I used tutorials and references to help with aspects of the code like moving patterns.
I researched the planets’ speed and location and used trigonometry to create the planets’ orbits. Researching mathematical roses also helped me in creating the planet’s paths. I followed a tutorial by The Coding Train as well.
Code Example: Neptune
Earth is represented by the coordinates e, f/E, F and Neptune by m, n/ M, N
if (developer === true) { // Neptune, set the radius of circle var scalar7 = 230; //Neptune var startM = 300; // x for circle center var startN = 300; //y for circle center Code for drawing ellipse on canvas: //Neptune // fill(“blue”) //noStroke(); // ellipse(300,300,460); //Changed code with Image for planet: stroke(“white”); noFill(); extraCanvas.ellipse(m,n,.1); rectMode(CENTER); image(neptune,m,n,10,10); }
Creating the Orbiting Lines
I began coding lines to connect Earth with another planet to create the patterns. I had trouble figuring out how to connect the points, but after research and watching tutorials I figured it out. Here is the rotation and lines for Neptune(m,n), and to Earth (e,f):
if (developer === true) { //Neptune extraCanvas.line(e, f, m, n); }