Concept:
For this week’s assignment, I used simple harmonic motion to create a cyclone-looking animation.
Sketch:
Code snippet:
// circles re-iteration for (let i = 0; i < total; i++) { let y = map(sin(angles[i]), -1, 1, -100, 100); let x = map(i, 0, total, -200, 200); push(); // saves the current state stroke(235); rotate(angles[i]); circle(y, x, r); pop(0); //pop() restores the previous state after rotation is complete // incrementation let increment = TWO_PI / 60; angles[i] += increment; }
This part of the code continuously draws the circles to create the animation. I used push() and pop() to not affect other parts of the code.
Reflection and Improvements:
- One of the difficulties I faced was getting the background to be a blue-ish color while also having it re-drawn to give the animation a fading effect.
- For improvement, I would want it to look more like a cyclone and have some sort of user interaction. I would also add sounds to it.