Concept
Inspired by Memo Akten’s Simple Harmonic Motion, I wanted to create something that combines pendulums and electron orbits, both moving in harmony. Akten’s work is amazing because it shows natural forces and mathematical patterns as art, and I wanted to bring that same feeling into my own sketch. In my sketch, pendulums swing while electrons move around a nucleus, representing atomic motion. I wanted to show how harmonic motion, something we usually see in science, can also be artistic and full of life. The result is an abstract but dynamic experience that connects physics with art.
Code Highlight
A section of the code I’m particularly happy with is the part that updates and draws the electrons. I didn’t want them to just follow a fixed orbit; I wanted them to move more like waves, giving the sketch a more organic and alive feel.
// Electron class to represent electrons orbiting the nucleus class Electron { constructor(orbitalRadius, startAngle) { this.orbitalRadius = orbitalRadius; // Radius of the orbital this.angle = startAngle; // Starting angle for electron this.speed = 0.02; // Angular speed of electron this.amplitude = 40; // Amplitude for oscillating motion (to simulate wave-like behavior) this.frequency = 0.2; // Frequency of oscillation this.phase = random(TWO_PI); // Random phase offset for each electron } // Update electron's position with simple harmonic motion update() { this.angle += this.speed; // Increase angle for circular motion let displacement = this.amplitude * sin(this.frequency * time + this.phase); // Calculate oscillation in radius this.currentRadius = this.orbitalRadius + displacement; // Current radius based on oscillation } // Display electron and its trail display() { let x = cos(this.angle) * this.currentRadius; // Calculate x position based on current angle and radius let y = sin(this.angle) * this.currentRadius; // Calculate y position based on current angle and radius // Draw a trail behind the electron stroke(180, 100, 100, 0.2); // Light trail color noFill(); beginShape(); // Begin trail shape for (let i = 0; i < 20; i++) { let trailAngle = this.angle - i * this.speed; // Calculate trail angle let trailRadius = this.orbitalRadius + this.amplitude * sin(this.frequency * (time - i * 0.1) + this.phase); // Calculate trailing radius with oscillation let tx = cos(trailAngle) * trailRadius; // X position of trail point let ty = sin(trailAngle) * trailRadius; // Y position of trail point vertex(tx, ty); // Draw vertex at trail point } endShape(); // Finish trail shape // Draw the electron as a filled circle fill(180, 100, 100); // Bright blue electron color noStroke(); circle(x, y, 12); // Draw electron at current position } }
The key part here is the use of harmonic oscillation to give the electrons a wave-like displacement, which makes them feel less rigid and more alive. I think this detail makes the overall animation more interesting and adds a layer of depth to the movement.
Challenges
One of the biggest challenges I faced was getting the electron orbits to feel natural. At first, they moved too mechanically, just following a circle. It felt too predictable and didn’t fit with the kind of fluid, organic motion I was aiming for. To fix this, I added the harmonic oscillation to their radius, which made them move in and out as they orbit, giving the motion more life.
Embedded Sketch
Reflection and Future Work
I’m happy with how the pendulums and electrons came together in this sketch. The combination of pendulums swinging and electrons orbiting creates an interesting mix of science and art. I liked exploring how these motions can be turned into something visually engaging. In the future, I’d like to add some interactivity to the sketch. For example, letting the viewer control the speed or direction of the pendulums and electrons using their mouse. I think that would make the experience more fun and personal. Finally, using randomness (like Perlin noise) for the electron movement could make it look more natural and less predictable. There are a lot of ways I could continue improving this, but for now, I’m happy with what I’ve created!