This project explores the creation of dynamic wave-like patterns and oscillatory motion. It incorporates both random and mathematical elements to create a unique visual experience, demonstrating basic principles of physics and mathematical wave behavior.
I started with creating a canva. Variables x1, x2, x3, x4 are used to define the positions of the moving particles, and y1, y2, y3, y4 hold their respective Y-axis positions, which are dynamically modified using noise functions. Random starting Y positions are set to ensure varied vertical motion of the particles.
The frame count is used to create smooth, time-dependent oscillation by adjusting the position of particles based on sine and cosine functions. I also used noise to add an organic, erratic motion to Y position, simulating more natural, less uniform oscillations. Specially, I make the background slightly cleared every few frames to create a fading effect, allowing previous positions to blend with the current ones and add motion blur.
The second part of the sketch uses the translate() to move the origin to the center of the canvas. This makes the wave-like motion of the lines appear to rotate around the center of the canvas. The wave pattern is further affected by using sine functions for radial distance and noise functions for dynamic position adjustments. This creates a fluctuating radius for the wave lines, adding variation to their motion, creating a motive shape.
Key functions used include:
sin(), cos(): Used for calculating positions along a circular path and wave-like oscillations.
noise(): Introduces randomness into the movement, making the particles' motions appear more organic and less uniform.
map(): Used to scale noise values to the appropriate range for visual effects.
translate(), push(), pop(): Transformation functions used for altering the coordinate system and maintaining a clean canvas for each frame.
Fine-tuning wave behavior was the main challenge of this project. Adjusting the frequency, amplitude, and speed of the waves through experimentation with different noise() and sin() values allowed for finding smooth and dynamic motion. Managing the speed of the animation and ensuring the smoothness of the movement took several iterations. The visual clarity was also a challenge, and ensuring that the particles' motion and the wave pattern did not become too cluttered required clear parameters for particle size, stroke weight, and background fading.
Through this project, I gained a deeper understanding of wave behavior and how mathematical functions can be applied to simulate periodic motion. I also learned how randomness can be integrated into animations with the noise() function, resulting in more complex and natural movements. Using transformation functions such as translate() and rotate() helped manipulate the drawing context and allowed me to generate rotating patterns centered on the canvas. Additionally, managing frame-based animations and achieving smooth transitions in visual patterns was an important takeaway.
To further improve the project, I may enhance the interactivity by allowing the user to control parameters like speed, frequency, or amplitude via mouse clicks or sliders. Implementing an object-oriented approach with classes for particles and wave objects would improve the modularity and organization of the code, making it easier to expand the project with additional elements or interactions.