Assignment 4 – Waves After Waves

Concept

I was inspired by my love for the beach and how it resonates peace and calmness within me. So, I decided to create a digital representation of a tranquil beach scene at night. The idea was to capture the essence of the ocean waves, a crescent moon, and embed generative text that represents the soothing and rhythmic nature of the waves. For the generative text, I chose lyrics from the song ‘Waves’ by Mr. Probz, as it perfectly encapsulates the feeling of being by the ocean, and it’s a song that holds personal significance to me.

Highlight of the Code

One particular aspect of the code that I’m particularly proud of is how I created the wave-like motion for the generative text. Specifically, the following block of code:

let waveOffset = sin(frameCount * waveSpeed) * waveAmplitude;
  xPosition += direction * 1; // here we can adjust the speed (horizontally)

  // Reverse direction when text goes off-canvas
  if (
    xPosition > width + textWidth(myString) ||
    xPosition < -textWidth(myString)
  ) {
    direction *= -1;
  }

  // Draw the characters of myString with wave motion
  for (let i = 0; i < myString.length; i++) {
    let myChar = myString.charAt(i);
    
    // Calculate the horizontal position for each character
    let x = xPosition + textWidth(myChar) * i;
    
    // Display each character of myString with vertical wave-like motion
    text(myChar, x, yPosition + waveOffset);

This code combines the use of “sin()” to create a smooth wave effect and dynamic movement of the generative text as it moves horizontally across the canvas. It seamlessly simulates the rise and fall of ocean waves, adding a captivating visual element to the scene.

Reflection/Improvements

Creating this beach scene with generative text has been an engaging journey where I combined my passion for art and coding to express a personal connection with nature and music. For future improvements, I envision extending the project by incorporating interactive elements, different times of day, realistic sound with the song ‘Waves’ playing, and user customization of lyrics. These improvements would create a more immersive and user-friendly experience, making the artwork more fascinating and interactive for viewers.

Edit Link

Update: 2 October 2023

I wanted to share an update on this assignment! As mentioned in my class presentation, I was initially working on creating a digital representation of a tranquil beach scene with generative text that captures the soothing essence of ocean waves. However, due to time constraints, I was unable to achieve the exact wave-like motion I had envisioned for the generative text before the submission deadline.

But, I didn’t give up on my assignment. I continued to work on it, digging deeper into the code and experimenting with different techniques. After some additional research and coding, I finally figured out how to make the generative text move in a wavelike motion, just as I had initially planned.

Initially, the text was moving as a straight sentence going up and down in motion. However, with the new update, I have successfully implemented the wave-like motion, simulating the rise and fall of ocean waves. I’m incredibly proud of how it looks now, and I believe it truly captures the essence of the beach scene I aimed to create.

here is a snippet of the edited code:

// Draw the characters of myString with wave motion
for (let i = 0; i < myString.length; i++) {
  let myChar = myString.charAt(i);
  
  // Calculate the horizontal position for each character
  let x = xPosition + textWidth(myChar) * i;
  
  // Calculate the vertical position with wave-like motion
  let y = sin(frameCount* waveSpeed + i * waveAmplitude + waveOffset) * 5; 
  
  // Display each character with vertical wave-like motion
  text(myChar, x, yPosition + y * 3);
  
  // Display each character of myString with vertical wave-like motion
}

Here is the final result:

Leave a Reply