Category Archives: ICM

ICM classwork

ICM Week 5: Functions

This week we focused on creating our own functions within our  sketches. 

The first challenge was to modify the function within Exclamator so that it returns the text plus n exclamation marks.  I was able to do that by creating a new function called repeatStringNumTimes( string, n).  Check out the code here.   On line 10, you will want to edit the second argument within the function exclamate() in order to add as many exclamation points to the string as you desire. 

For our sketch this week, we were asked to refactor the code within a previous sketch by creating functions and objects, if possible.   I decided to refactor a sketch from Week 2.   The original code is here.   Within the new code, you are able to call the function moveTriangle() and fadeBackground() within the draw() function.  The parameters for moveTriangle(a, b, c) corresponds to the corners of the triangle.  by changing the arguments, you are able to speed up or slow down how quickly each particular corner moves through the space.  Within the function fadeBackground(), you are able to adjust the speed which the background fades out. 

 

ICM Week 4: Repetition Loops

See below for UPDATED sketch info.

This week we worked with creating repetitive designs using loops.  With Dan Shiffman’s 10PRINT Sketches as inspiration, I created the following: 


Code

I wanted to add the function mousePressed() into the sketch in order for the colors and overall design to reset into a new configuration.  In order to get the functionality I desire, one will need to either (1) refresh the browser or (2) enter in the Code and press play to get a new configuration of the design.  Here is a version of the same sketch without noLoop() but with mousePressed().   I’ve set the frame rate to 1 frame per second so that the animation is not spastic.  Click within the design and you will receive a new color configuration. 

 

Code

I would like to find a way to freeze the sketch then be able to reset the colors and shape placement by pressing the mouse. 

 

UPDATE:
In class, we were shown how to achieve what I was attempting.  By adding the for loop which created the sketch into mousePressed(), I was able to have the sketch update when the mouse is pressed. 

 

Code

ICM Week 3: Partner Assignment

Partner Assignment:

This week we were assigned a partners project where we were to work together to create using what we have learned so far which includes rule-based animation, motion, and interaction.  I got the opportunity to work with Mai Claro for this assignment. 

Process:
Mai and I met to discuss what we were thinking about and decided to create a painting app. Since I was feeling a bit behind in regards to fully comprehending everything so far, I decided to focus my contributions on designing some brushes that respond to mouse clicks.

I started by creating the following:

  • A color filled star brush that appeared when the left mouse button was clicked.
  • An unfilled star (outline) that appears when the right mouse button is clicked.
  • A transparent circle that appears behind the first star when the left mouse button is double clicked.
  • An eraser which is activated by pressing the mouse’s scroll wheel. All four of these items can be used to draw or erase connected areas by holding down its button.
    • I did notice after posting that this feature does make it difficult to use within the browser as, with my mouse, pressing the scroll wheel also controls movement around the browser window.
  • Lastly, I created 3 areas to hover ones mouse over in order to randomly change the color of the three items.

Below is my sketch prior to handing it over to Mai for more exciting features!


Code: https://editor.p5js.org/danielryanjohnston/sketches/izpODJcCU

Next, I handed what I had created off to Mai for additions (fireworks, sparkles, action, etc!). 

Update: Mai add sliders!  One slider allows the user to change the scale of the brush and the other switches between a square, a circle and a star.  I’m very motivated by how this turned out.   Due to how I had setup the background in setup(_), Mai was unable to add animation as well thought.  The bubbles worked but were functioning as the brush does by leaving duplicates of itself after each frame.  I wonder if there is a  way to parse out the sketch so that you can have both a component that needs the background refreshed each frame and one that does not?


Code: https://editor.p5js.org/MaiClear/sketches/yQ2bugnp8

Overall, this was a smooth collaboration with Mai and I look forward to working together again!  In regards to p5.js, I am feeling as though I better understand what we are being asked to create.   I am grateful that I was able to spend more time with the material this week and that I was also able to utilize Laurne McCarthy, Casey Reas and Ben Fry’s book Make: Getting Stated with p5.js

 

ICM Week 2: Animation with Variables

This week we worked with variables in order to animate 2D images. 

While watching the videos, I was able to to create the follow sketches:

Demonstrating mousePressed(), mouseX, and mouseY().  https://editor.p5js.org/danielryanjohnston/sketches/r33XVpViX

  • I really had a lot of fun playing with this piece myself.  I tried moving the mouse in a variety of patterns to see how layered the sketch could get. 

This following sketch demonstrates using an object to animate.  https://editor.p5js.org/danielryanjohnston/sketches/nW4r1-m_l

  • I would want to make this piece restart from the absolute beginning on a loop so that the viewer can see the background change colors and the triangle slide through space. 
  • UPDATE: Edited the code using mousePressed() in order to restart the animation. 

The final sketch, Are you okay?, was created to meet the requirements:
https://editor.p5js.org/danielryanjohnston/sketches/Oo6ii74G0

 

  • 1 element controlled by the mouse.
    • The whites of the eyes change color from white to black as the mouse travels along the y-axis. 
    • The mouth changes color from black to white as the mouse travels along the x-axis. 
    • mousePresses() is used to reset the background whenever the user presses the mouse.
  • 1 element that changes over time, independent of the mouse.
    • Triangles which have random x and y points for all parameters as well as a random selection of colors.
    • The pupils of the eyes have randomized colors selected.
  • 1 element that is different every time you run the sketch.
    • mousePresses() is used to reset the background whenever the user presses the mouse.
    • The text “Are you okay?” appears at a random location, in a text size ranging from 5-50 pts. when the sketch is restarted
      • I was not able to get the text to reappear when the mouse was pressed (see below for specific questions).

I was very much inspired by the work I did on sketch #1 for this week’s worksheet. 
https://editor.p5js.org/danielryanjohnston/sketches/03pgxBBDt

  • UPDATE: Edited the code using mousePressed() in order to restart the animation. 

The worksheet was fairly manageable except for the last two challenges.   I was not able to wrap my mind around how exactly to accomplish have the image move towards the mouse or moving the rectangle from Q3 towards the mouse. 

Questions:

  • How do I place have text within the code so that it also reappears on the background after the mouse is pressed?  I have tried placing the text within the functions setup(), draw() and mousedPressed() with no success.  Both setup and draw allow the text to appear when the program first starts or is restarted. 
  • How do I embed the sketches into WordPress without having the scroll bars?  I’ve tried editing the iframe unsuccessfully as the text reverts back to the original after saving. 

 

ICM Week 1: How Computation Applies to My Interests

I view the world through the lens of an optimistic realist with a fascination in the world of science fiction.  I dream about all the amazing items from books and  TV while delving headfirst into researching theories around making those things a reality.  With a background in sustainable materials as well as operations, I find myself drawn towards speculating around (1) the potential material innovation, (2) the social and political impact and (3) the user interface of these science fiction innovations.

Material Research and Development

I began my research journey into new and sustainable materials while in fashion school.  There, I was introduced to fabrics made out of everything from recycled ocean plastics to orange peels.  The materials that peeked my interest the most were those made using bio-technology.  The idea of being able to grow a garment using bacteria was fascinating.  (Check out Suzanne Lee’s TED Talk on Growing Your Own Clothes if this interests you as well!)  This fascination lead me down the path towards researching the current production of these innovative bio-materials.  Here are just a few of the products and companies I found inspiring: Hemp Bio Leather, Zoa by Modern Meadow, hemp-based ink by Hemp Black, a vegan spider silk called Microsilk by  Bolt Threads.  In addition to innovation in materials, we as a society must be innovative in our thinking around why we need a particular material as well as what is the impact of every step of that materials life. 

I hadn’t originally thought much about how computation applied to the development and implementation of new materials, however,  it is now clear that computation is a necessary component in that development and implementation.  Having already highlighted a few commercial ventures, I would like to share are few inspirational creatives using computation to explore new materials.

The Mediated Matter Group, part of the MIT Media Lab, “focuses on Nature-inspired Design and Design-inspired Nature.”  This incredible group of designers and scientists have explored areas including bio-designed death masks (Vespers I and Vespers II) and Silkworm inspired/created architectural pieces (Silk Pavilion and Silk Pavilion II).

Social innovation

Computation also has the ability to uncover areas where we need to redirect resources and attention towards so that we all have a better, healthier society.  Here are just a couple projects/artists using computation to track, visualize and innovate using code. 

  • NYC Street Trees uses data to create a map showing all the trees located through out NYC. 
  • Avena+ Test Bed uses agriculture, digital fabrication and mapping to challenge EU farming economies though generative farming and tech.

Organic User Interfaces

Even though electronics are so ubiquitous in our daily lives, I do consciously make an effort to  step away from them.  Having recently discovered the following projects, I see how computation can be used to bring the natural world into our experiences with hardware and software.

  • Mud Tub by Tom Gerhardt uses mud to control a computer.
  • Stone Mouse also by Tom Gerhardt which uses a stone as the computer’s mouse.
  • In Order to Control by NOTA BENE Visual which uses dance to interact with the display of text.

As I move forward in this adventure of ITP NYU, I am sure to find more fascinating and unbelievable inspirations to draw from. 

Thanks for reading!