Week 4 Assignment: Generative Text

Inspiration

For this assignment, I aimed to build on my previous projects and utilize the concepts from class to create a generative piece of text. I felt a strong urge to extrapolate the design from my previous butterfly animated sketch in creating the outline of a text made by a set of moving butterflies. I also wanted to use my last name, Al-Towaity, as opposed to my first name. The reason for this is twofold: 1) it is amusing to use butterflies to represent an Arab, tribal name, and 2) I am using the number “280” [two-eighty], which, if read fast enough, approximates the pronunciation of my name. These two reasons bring in an additional layer of personalization to the sketch that extends beyond the design itself.

Process and Implementation

As for the technical implementation, I exported the Butterflyclass from my previous assignment into this sketch. I, then, modified the hyperparameters of the parametric function to scale it down and adjusted the rate of drawing the curves of each butterfly to give the illusion of moving butterfly wings. I also made sure to include replaying the drawing of each butterfly once the curves have spanned a given angle (4pi in this case).

// source: Sarah Al-Towaity-Intro to IM- Assignment 3.1 https://editor.p5js.org/sarah-altowaity1/sketches/YqvekMK43 

class Butterfly {
....
  drawButterfly() {
    push(); // save the current drawing state 
    translate(this.x, this.y); // move the origin to the object's position
    stroke(this.color); // set the stroke color based on the chosen color 
    rotate((this.angleRot * PI) / 4); // rotate the object 
    noFill(); 
    strokeWeight(1);
    beginShape();
    // draw the curve 
    for (let i = 0; i <= this.theta; i += 0.06) {
      // calculate the radius based on the parameteric equation for the butterfly curve 
      let r =
        exp(sin(i)) -
         this.a * cos(4 * i) +
        pow(sin((1 / this.b) * 12 * (2 * i - PI)), 5);
      // calculate x and y position of the curve 
      let x = r * cos(i) * 1.5 * noise(i, frameCount*0.01);
      let y = r * sin(i) * 1.5 * noise(i, frameCount*0.01);
      // draw circle 
      curveVertex(x, y, r);
    }
    endShape();
    if (this.theta < 2 * TWO_PI){
      this.theta += 0.09; // increment theta for animation 
    }
    else{ // reset theta to 0 once its value reach 4*pi to create the effect of flying effect
      this.theta = 0; 
    }
    pop(); // restore original sketch state 
  }
}

I also used the method of extracting points from text from Professor Aaron’s Circle word example to create butterflies centered around each extracted point.

function setup() {
  createCanvas(500, 500);
  // set background 
  background(148, 69, 71);
  
  // create a bounding box around the text 
  let boundingBox = font.textBounds(textString, 0, 0, textSize);

  // convert texts to an array of points 
  // sampleFactor and simplifyThreshold control the smoothness and quantity 
  // of generated points 
  points = font.textToPoints(
    textString,
    width / 2 - boundingBox.w / 2,
    height / 2 + boundingBox.h / 2,
    textSize,
    {
      sampleFactor: 0.07,
      simplifyThreshold: 0,
    }
  );
  
  // populate butterflies array with generated butterfly objects using the points
  // obtained above 
  for (let i = 0; i < points.length; i++) {
    let x = points[i].x;
    let y = points[i].y;
    butterflies.push(new Butterfly(x, y));
  }
}

For an added touch of animation, I added a resizing factor attribute to the Butterfly class that changes when the mouse is within a particular distance of the butterfly. This way, the butterflies enlarge when the mouse is over them and return to their normal size once the mouse moves further away.

function mouseMoved() {
  // resize butterflies that are within 40 pixels from the 
  for (let i = 0; i < butterflies.length; i++) {
    let distance = dist(mouseX, mouseY, butterflies[i].x, butterflies[i].y);
    if (distance < resizeDistance) {
      butterflies[i].resizeFactor = random([-1, 1]) * random(2,3);
    } else {
      butterflies[i].resizeFactor = 1; // restore normal size when the mouse is moved away
    }
  }
}

 

Embedded Sketch

Reflections and Ideas for the Future

One thing I struggled with was minimizing lags and delays while drawing. I would have loved for the sketch to be bigger and to have more sample points (and butterflies) for a fuller, more vibrant look. However, I noticed that the editor would get stuck and the animation would lag with more components. I attributed this to the many butterfly objects being drawn, a process that involved multiple looping iterations. Hence, as a future improvement, I would like to find ways to optimize the memory and space requirements of this sketch so that it can be seamlessly scaled up without issues.

 

Assignment 4 / Reading Response – Shaikha AlKaabi

For this week’s assignment the main goal was to make the letters of the word “Cotton Candy change color to shades of pink, purple, or blue and to float when the mouse hovered over them, with an automatic reset of the effect after a specified time.

One of the challenges faced was ensuring that the floating effect was smooth and visually appealing. This required fine-tuning the sine function used to calculate the floating amounts so that the movement would be gentle and continuous. Another challenge was to center the word on the canvas regardless of the window size, which involved calculating the correct positioning for each letter relative to the canvas dimensions for which I applied what we learned in class.

A highlight of the code that I’m particularly proud of is the implementation of the timed reset function. This feature automatically resets the color and floating effect every  seconds, which gives the sketch a dynamic feel as it periodically returns to its original state without user intervention. This was achieved by using the modulo operator with the `frameCount` variable that keeps track of the number of frames since the sketch started.

Here’s the snippet of the code responsible for the timed reset:

// Reset colors and floating effect 
if (frameCount % resetInterval == 0) {
  resetEffects();
}

// Function to reset colors and floating effect
function resetEffects() {
  for (let i = 0; i < letters.length; i++) {
    letterColors[i] = color(255, 182, 193); // Reset color to pink
    floatingStartFrames[i] = -resetInterval; // Ensures the effect is stopped
    floatingAmounts[i] = 0; // Reset floating amount
  }
}

This part of the code demonstrates the use of a simple yet powerful timing mechanism, allowing for periodic actions without the need for complex timing functions. It also shows how a clear understanding of the p5.js framework’s drawing loop can be used to create interactive and dynamic animations. Overall, despite the challenges, this project was an enjoyable and educational experience in using p5.js to create engaging visual effects.

Reading Response: 

In his book, “The Design of Everyday Things,” Don Norman hits on something we all kind of know but don’t always talk about: how everyday stuff around us can be super annoying when they’re badly designed. He’s not just talking about making things pretty, he’s diving deep into why we struggle with simple things like doors and switches and how good design can make our lives way easier.

Norman drops some real talk about design concepts, like affordances and signifiers. Affordances are basically what an object lets us do, and signifiers are like hints or clues on what actions we can take. It sounds fancy, but it’s really about making stuff user-friendly.

He brings up some wild examples that show just how weird design can get. Like, ever heard of a sink in a fancy London hotel that makes you dirty your hands again just to drain it? Or a wall in Korea that wasn’t meant to be a shelf but ended up as one because it looked like it could hold your coffee cup? These stories aren’t just funny, they show how designs can mess with our heads.

Then there’s the Coffeepot for Masochists – a design so backward it’s like a joke, but it actually makes a point about how not to design things. And those confusing doors that don’t tell you whether to push or pull? We’ve all been there, and Norman uses these everyday traps to show why design needs to be clear and intuitive.

Even digital watches get a shout-out for being needlessly complicated. Why do we need a manual to tell time? On the flip side, Norman props up car seat controls that just make sense because they mimic the seat’s layout. It’s like, why can’t all things be this straightforward?

So, what’s Norman really getting at? He’s saying that design isn’t just about looking good, it’s about making our interactions with objects smooth and natural. Designers need to think about how we, as humans, use stuff and then make it as easy as possible for us. It’s about getting the small things right, so we don’t end up fighting with a door or a coffeepot. In a way, Norman’s book is a call to make the world a less frustrating place, one well-designed object at a time.

Assignment 4 – “On My Nerves” by Sara Al Mehairi

Overview

Neurons Affected by Epilepsy Identified
Sourced from Genetic Engineering and Biotechnology News

The concept for this assignment came about after some self-reflection on the “workings of my mind” throughout past semesters. From those moments when deadlines approach to when things get on my nerves, I had hoped to capture this chaos visually, but not through random lines because we have come to an agreement that randomness is our biggest enemy, rather through nerve cells (cells that send messages all over your body to allow you to do everything from breathing to talking, eating, walking, and thinking). With that, my goal was to depict my genuine experiences, to the best of my capability. That’s when the idea came to utilize my actual Notion to-do lists, which have been my go-to resource since my first semester during freshman year.

Data Visualization

let courses = [
  { name: "Discrete Mathematics", tasks: { Assignment: 4, Quiz: 3, Other: 2 } },
  { name: "Intro to Computer Science", tasks: { Assignment: 6, Other: 2 } },
  { name: "Pre-Calculus", tasks: { Assignment: 14, Other: 4 } },
  { name: "Wayfinding", tasks: { Assignment: 9, Other: 2 } },
  { name: "Calculus", tasks: { Assignment: 15, Other: 2 } },
  { name: "Stereotyping", tasks: { Assignment: 9, Other: 4 } },
  { name: "FYWS", tasks: { Assignment: 17, Other: 2 } },
  { name: "UX Design", tasks: { Assignment: 12, Other: 2 } },
  { name: "Inequality", tasks: { Assignment: 5, Other: 8 } },
  { name: "Communications Lab", tasks: { Assignment: 18, Other: 4 } },
  { name: "Data Structures", tasks: { Assignment: 16, Quiz: 4, Other: 2 } },
  { name: "Techniques for Safety & Production", tasks: { Assignment: 2, Quiz: 2 } },
  { name: "Space Diplomacy", tasks: { Assignment: 7, Other: 2 } }
];

Each color within the visualization represents a course I’ve taken up until fall 2023, while the size of the circles correlates directly with the workload associated with each course (categorized into assignments, quizzes, and other tasks from my actual to-do list). The lines, aimed to create a nerve system-like structure, are meant to connect circles of the same color/course to illustrate the connections. Additionally, the back-and-forth motion that results from touching the edges was intended to mimic the beat of a human heart (so did the oscillating opacity), with the hope of adding a human touch to the art piece.

Challenges & REFLECTION

One of the challenges was trying to make the piece look like something from the human body. Although I didn’t perfect it, I tried drawing inspiration from images of what nerves would look like in our body. Another challenge was deciding the colors. Initially, I wanted to symbolize stress and complexity, so I started with reds and warm tones. However, they ended up looking more like a calm sunset, which led to the idea of using cool tones to oppose the idea of “nervousness” and “perplexity“, hence being “cool” and “relaxed.” Another challenge was definitely implementing the code. I had to use many of the things we had done in class and had a lot of debugging throughout. Many of the things you see happened by accident, but I’m happy with it. Through this attempt, I hope to give you a glimpse into my academic journey – the ups, the downs, everything in between, and more specifically, the things that got on my nerves. Pun intended.

ASSIGNMENT: Generative text output – Jihad Jammal

Concept:

For this assignment, I aimed to capture the feeling experience of encountering a the blue screen of death (BSOD). To enhance the immersion and create a tangible sense of interaction, I introduced the interaction of th words being disrupted from there wave by your mouse. As the mouse moves across the screen, letters seem to be ripped away into a circle, creating an illusion of them swirling around the cursor. This subtle yet effective layer of interactivity I feel engages with the user in a more direct way, improving my  digital.

A highlight of some code that you’re particularly proud of:

// Calculate the necessary width for a single repetition of the text, including some spacing
let textWidthWithSpacing = textWidth(myString) + 50; // Additional spacing to ensure no overlap

// Draw the text repeatedly across the width of the canvas
for (let x = offset % textWidthWithSpacing - textWidthWithSpacing; x < width; x += textWidthWithSpacing) {
  for (let j = 0; j * lineSpacing < height; j++) {
    let yPos = j * lineSpacing; // Vertical position for each line

    for (let i = 0; i < myString.length; i++) {
      let myChar = myString.charAt(i);
      let waveTime = (frameCount + i * 10) * 0.05;
      let waveHeight = sin(waveTime) * 20; // Wave height for a pronounced effect

      // Original character positions
      let charX = x + (textWidth(myString) / myString.length) * i;
      let charY = yPos + waveHeight; // Apply wave motion

Embedded sketch:

Reflection and ideas for future work or improvements:

Reflecting on the project, I’m genuinely pleased with the outcome and the creative journey it took me on. However, if given the opportunity to revisit and refine the project, I would consider enhancing the virus aspect to make it more pronounced. This could involve more explicit visual cues or even integrating disruptive patterns that more closely mimic the erratic behavior of a computer under the influence of a malicious virus. By doing so, the piece would not only capture the viewer’s attention more forcefully but also deepen the narrative, making the experience even more memorable and impactful.

Reading Response Week 5: The Psychology of Everyday Things – Jihad Jammal

Jihad Jammal

Intro to Interactive Media

Professor Aaron Sherwood

Reading Reflection Week 5

Feb. 18, 2024

 

A Journey Through User-Centered Design

 

Reflecting on the first chapter of “The Psychology of Everyday Things” by Don Norman, it becomes evident how the intricacies of design profoundly impact our interaction with everyday objects. Norman delves into the paradox that as technology advances, intending to simplify our lives, it simultaneously introduces complexity that can hinder usability. This duality is a crucial reminder of the importance of human-centered design, which aims to make products intuitive and accessible, yet often falls short in the race towards innovation and feature enhancement.

 

Norman’s discussion about the conceptual models and the system image highlights a critical gap between designers’ intentions and users’ perceptions. It’s a compelling argument for the necessity of clear, intuitive design cues that guide users rather than confuse them. This point resonates deeply with the frustration many of us experience with modern devices, where functionality is obscured by complexity, leading to a reliance on trial and error or the dreaded instruction manual. The example of the refrigerator controls serves as a potent illustration of how misleading or inadequate system images can lead to user frustration and inefficiency, underscoring the importance of aligning the designer’s model with the user’s model through clear, intuitive design.

 

Moreover, Norman’s insights raise important questions about the responsibility of designers and manufacturers in ensuring their products enhance rather than complicate our lives. It challenges the reader to consider how products could be designed differently, with a focus on the user’s experience above all. This chapter not only changes the way one might view the objects around them but also emphasizes the role of thoughtful design in improving everyday life. It’s a call to action for designers to prioritize usability and for users to demand more intuitive products, highlighting the ongoing dialogue between design and user experience in shaping the tools of our daily lives.

 

Citations:

Norman, D.A. (2013). The design of everyday things. New York, New York: Basic Books.

 

Assignment #4 – life.

For this assignment I decided to combine data visualization and text in a relatable, motivating and interesting theme. My project is called life and it shows the unpredictability of our everyday life as well as the highs and lows we all go through.

To make my idea come true, I created a .csv file which would interpret life as a line that goes up and down, representing the battles we fight. I later uploaded the csv file to my sketch and decided to add some effects.

When we hover over the lowest point, a text that says “It has its lows” appears. Similar to that when we hover over the highest point, a text that says “It has its highs” appears. Apart from those two effects, whenever u hover over the straight parts of the line (beginning and end) the line starts to wobble up and down, simulating the unpredictability of life. To add an artistic touch I filled the insides of the line with black.

The code that does all of this can be seen below:

if (x < 150 || x > 450) {
      if (dist(mouseX, mouseY, x, y) < 50)
        y += map(noise(frameCount * 0.01, i * 0.01), 1, 0, -400, 400);
    } else if (mouseX > 250 && mouseX < 330 && mouseY > 400 && mouseY < 550) {
      text("It has its lows", mouseX, mouseY);
    } else if (mouseX > 330 && mouseX < 410 && mouseY > 20 && mouseY < 150) {
      text("It has its highs", mouseX, mouseY);
    }

And finally, enjoy:

Reading Response: Design Principles in Everyday Objects

Don Norman’s refrigerator example from “The Design of Everyday Things” is a significant example that highlights several important design, user experience, and cognitive processes related to human-machine interaction concerns. The idea of cognitive dissonance in design, which occurs when users’ expectations and reality are distinct which causes annoyance and inefficiency, is embodied by the refrigerator’s confused controls. In my opinion, this example is a smaller issue of a much larger issue in the fields of design and technology.

The controls on the refrigerator expose a basic breakdown in the way designers and consumers communicate. The designers have a high in-depth knowledge of how the product works, but they often neglect what information users need to comprehend and utilize the product as intended. The belief that consumers will “figure it out” might result in designs that make sense to the designer but seem complex to the user.

After reading about the refrigerator it reminded me of “Computer Space” by Nolan Bushnell. This was one of the first arcade games which was made and did not conquer the market as the controls on the machine were way too complicated/complex for the user to comprehend. Although the vision of the game was intuitive, no one would want to read instructions to play a video game so the controls for the game became very hard for the users.

All of this made me wonder, how does the design of everyday objects influence our behavior and interactions with technology?

 

Assignment 4 / Reading response – Hamdah AlSuwaidi

For this assignment, the goal was to combine various elements such as text, background scenery, and interactive components to create a visually appealing and engaging composition.

In this particular assignment, the background consists of a gradient sky with clouds, which provides a serene and calming atmosphere. The addition of colorful butterflies adds a touch of whimsy and liveliness to the scene. The choice of background and butterflies was made to create a harmonious and cohesive composition that aligns with the theme of nature and tranquility. Additionally, using a similar background pattern as the previous assignment helps create a consistent visual theme across multiple assignments, reinforcing the idea of a recurring pattern or motif.

 

1. Setup Function:
– Initializes the canvas and creates arrays to hold instances of butterflies, clouds, and flowers.
– Generates multiple instances of butterflies, clouds, and flowers with random positions on the canvas.

2. Draw Function:
– Renders the background with a gradient sky and clouds.
– Updates and displays each cloud’s position on the canvas.
– Updates and displays each butterfly’s position and appearance.
– Displays each flower on the canvas.

3. Butterfly Class:
– Represents a butterfly object with properties such as position, velocity, color, and size.
– The `update()` method updates the butterfly’s position and may change its direction randomly.
– The `display()` method renders the butterfly’s wings with a specified color pattern.

4. Cloud Class:
– Represents a cloud object with properties such as position, velocity, and size.
– The `update()` method updates the cloud’s position, ensuring it moves across the screen.
– The `display()` method renders the cloud as a set of ellipses representing its shape.

5. Flower Class:
– Represents a flower object with properties such as position, size, and color.
– The `display()` method renders the flower as an ellipse representing its center and a smaller red ellipse above, representing its stigma.

6. Interactivity:
– The `mouseClicked()` function triggers a change in butterfly colors when the mouse is clicked. This adds an interactive element to the artwork, allowing users to alter the visual composition dynamically.

let butterflies = [];
let clouds = [];
let butterflyColors = [
  [255, 20, 147], // Pink
  [128, 0, 128], // Purple
  [255, 255, 0] // Yellow
];
let currentColorIndex = 0;

function setup() {
  createCanvas(700, 500);
  
  // Create a flock of butterflies
  for (let i = 0; i < 10; i++) {
    let butterfly = new Butterfly(random(width), random(height), currentColorIndex);
    butterflies.push(butterfly);
  }
  
  // Create some clouds
  for (let i = 0; i < 5; i++) {
    let cloud = new Cloud(random(width), random(height));
    clouds.push(cloud);
  }
  
  
}

function draw() {
  // Draw gradient sky background
  background(135, 206, 250); // Light blue
  for (let y = 0; y < height; y++) {
    let inter = map(y, 0, height, 0, 1);
    let c = lerpColor(color(135, 206, 250), color(255, 255, 255), inter);
    stroke(c);
    line(0, y, width, y);
  }
  
  // Display and update clouds
  for (let cloud of clouds) {
    cloud.display();
    cloud.update();
  }
  
  // Update and display each butterfly
  for (let i = 0; i < butterflies.length; i++) {
    butterflies[i].update();
    butterflies[i].display();
  }
  

  
  // Display "Hamdah" text
  textSize(80);
  textAlign(CENTER, CENTER);
  fill(0); // Black color
  text("Hamdah", width / 2, height / 2);
}

function mouseClicked() {
  // Change butterfly colors on mouse click
  currentColorIndex = (currentColorIndex + 1) % butterflyColors.length;
  for (let i = 0; i < butterflies.length; i++) {
    butterflies[i].changeColor(currentColorIndex);
  }
}

class Butterfly {
  constructor(x, y, colorIndex) {
    this.position = createVector(x, y);
    this.velocity = createVector(random(-1, 1), random(-1, 1));
    this.colorIndex = colorIndex;
    this.size = random(20, 40);
    this.angle = random(TWO_PI);
  }
  
  update() {
    // Update position
    this.position.add(this.velocity);
    
    // Change direction randomly
    if (random() < 0.01) {
      this.velocity.rotate(random(-PI / 4, PI / 4));
    }
    
    // Wrap around screen
    this.position.x = (this.position.x + width) % width;
    this.position.y = (this.position.y + height) % height;
  }
  
  display() {
    // Draw butterfly wings with pattern
    fill(0); // Black
    noStroke();
    ellipse(this.position.x, this.position.y, this.size, this.size / 2);
    let wingOffset = this.size / 4;
    let wingSize = this.size / 2;
    push();
    translate(this.position.x, this.position.y);
    rotate(this.angle);
    fill(butterflyColors[this.colorIndex][0], butterflyColors[this.colorIndex][1], butterflyColors[this.colorIndex][2]); // Butterfly color
    ellipse(-wingOffset, 0, wingSize, wingSize * 2);
    ellipse(wingOffset, 0, wingSize, wingSize * 2);
    fill(0); // Black
    ellipse(-wingOffset, 0, wingSize / 2, wingSize);
    ellipse(wingOffset, 0, wingSize / 2, wingSize);
    pop();
  }
  
  changeColor(colorIndex) {
    this.colorIndex = colorIndex;
  }
}

class Cloud {
  constructor(x, y) {
    this.position = createVector(x, y);
    this.velocity = createVector(random(-0.5, 0.5), 0);
    this.size = random(50, 100);
  }
  
  update() {
    this.position.add(this.velocity);
    if (this.position.x > width + this.size) {
      this.position.x = -this.size;
    }
    if (this.position.x < -this.size) {
      this.position.x = width + this.size;
    }
  }
  
  display() {
    noStroke();
    fill(255);
    ellipse(this.position.x, this.position.y, this.size * 1.5, this.size);
    ellipse(this.position.x - this.size / 3, this.position.y - this.size / 4, this.size, this.size * 0.8);
    ellipse(this.position.x + this.size / 3, this.position.y - this.size / 4, this.size, this.size * 0.8);
  }
}

  

Reading Response:

In his seminal work, “The Design of Everyday Things,” Don Norman meticulously dissects the intricate relationship between design and user experience, shedding light on the fundamental principles that govern successful product interaction. Norman’s exploration of affordances resonates deeply with my own understanding of design, emphasizing the pivotal role of intuitive functionality in fostering seamless user-product relationships.

Consider, for instance, the ubiquitous smartphone interface. A well-designed interface intuitively guides users through its myriad functions, leveraging affordances and signifiers to streamline interactions. Icons and gestures serve as visual cues, effortlessly communicating their intended actions. When users tap an icon, they anticipate launching an app; when they swipe, they expect to navigate between screens. These intuitive interactions not only reduce the cognitive burden on users but also enhance their overall satisfaction with the device.

However, the efficacy of design extends beyond mere functionality; it encompasses a nuanced understanding of users’ evolving needs and technological literacy. As technology continues to evolve, so too does the language of interactive design. Novel features such as facial recognition and fingerprint identification, once considered exotic, have now become commonplace, ingrained within the lexicon of modern devices. Yet, the assimilation of these innovations into the user experience requires careful consideration of contextual factors and prior familiarity.

For instance, imagine a scenario where a user encounters a new smart home device equipped with voice recognition capabilities. To a tech-savvy individual accustomed to interacting with virtual assistants, such as Siri or Alexa, the process may feel intuitive, akin to conversing with a familiar friend. However, for someone less acquainted with these technologies, the experience may prove bewildering, necessitating a more gradual onboarding process to bridge the gap between novelty and comprehension.

This underscores the dynamic nature of interactive design, which continually adapts to accommodate emerging technologies and diverse user demographics. As designers, we must strive not only to anticipate users’ needs but also to cultivate inclusive and accessible interfaces that resonate across varying levels of technological proficiency. By embracing this iterative approach and prioritizing intuitive design, we can forge meaningful connections between users and products, enriching lives and experiences in the process.

 

Afra Binjerais – Assignment 4

In this assignment, I wanted to do a generative text that moves.  I did that by doing an array and watching a YouTube tutorial that taught me how to move the fonts, which was quite easy to do.

Then, I was thinking of adding an interactive element with the mouseClicked element but I wasn’t sure how to do that, as I kept getting errors as the font oscillates back to forth (using sin waves) by default.

With the help of Pi (thanks Pi) I was able to do that, where each time the mouse was clicked the fonts oscillated back and forth faster and faster.

So this is the code

let font;
let points = [];
let r = 4;  
let angle = 0;
let angleIncrement = 1;  // New variable to control the angle increment rate
var landscape;

function preload() {
  font = loadFont("fonts/Inconsolata_Condensed-Light.ttf");
  landscape = loadImage('background.jpg');
}

function setup() {
  createCanvas(510, 400);
  points = font.textToPoints("AFRA", 0, 300, 300, {
    sampleFactor: 0.1
    // simplifyThreshold: 0
  });
  angleMode(DEGREES);
}

function draw() {
  background(landscape);
  for (let i = 0; i < points.length; i++) {
    ellipse(points[i].x + r * sin(angle + i * 20), points[i].y, 10, 10);
  }
  angle += angleIncrement;  // Use the angleIncrement variable
}

function mouseClicked() {
  angleIncrement += 5;  // Increase the angle increment rate on each click
}

and this is the final product 🙂

Honestly, I’m proud of my work so far, with this being my 4th assignment with code, but in the future, I would love to work with Arabic letters and see what it would look like.

Reference to the video I watched:

https://www.youtube.com/watch?v=eZHclqx2eJY

Week 4 Assignment – Khalifa Alshamsi

For this assignment, I drew my inspiration from the YouTube channel called “Short Coding Skills MoCCAモカ,” where he created a nice generative art style, but I could not understand the code he had.

A=97;
ATOZ=122-A+1;q=99;
draw=_=>{frameRate(10);
background(0,10);fill(200,0,0);
textSize(random(45));j=frameCount;
text(String.fromCharCode(j%30+A),noise(j)*q,noise(j+1)*q);         
         j= frameCount;text("*".repeat(ATOZ).split("").map((c,i)=>String.fromCharCode(i+A))[j%(ATOZ)],noise(j)*q,noise(j+1)*q)
}

So I took a shot at creating a similar feel to the one he made but instead it would say “STONKS,” because why not…

Sketch:

Description:

Randomized order of “STONKS”and random positioning where each selected letter is randomly displayed in different positions on the canvas.

Script:

let letters = "STONKS"; // Letters to be displayed
let displayDuration = 50; // How long to display each letter (in frames)
let nextChangeTime = 0; // When to change to the next letter

function setup() {
  createCanvas(640, 684);
  textSize(64);
  fill("grey"); // Set letter color to blue
  frameRate(60); // Set the frame rate
}

function draw() {
  if (frameCount >= nextChangeTime) {
    // Clear the background each time before displaying a new letter
    background(0);

    // Select a random letter from the string
    let letter = random(letters.split(""));
    
    // Pick a random position for the letter
    let x = random(width);
    let y = random(height);
    
    // Display the letter
    text(letter, x, y);
    
    // Set the time for the next change
    nextChangeTime = frameCount + displayDuration;
  }
}