Kristina You is a multidisciplinary designer based in New York, NY and a recent graduate from the ITP Program at NYU. Her practice focuses on UI/UX, interaction design, print design, and brand development.


︎︎︎Introduction to Computational Media

Week 5 Exercise




PART 1


1. Create a random generator from an array of items, such that when you click a button a different item draws to the canvas, e.g. exercise moves, fortunes, jokes, poetry, etc. Can you avoid repeating items when clicking the mouse?

code
preview











2.  Part one: Use the same array, or create a new one, and use a For Loop to print the contents of your array to the Console sequentially from the first index position to the last index position. 


code
preview









Part 2: Program your sketch so that every mouse press iterates backwards through the array and displays the values in reverse order on the canvas.

code
preview








3. *I had some trouble with #3:(

4. Part 1: Duplicate and refactor this sketch by organizing the code into your own functions. The outcome on the canvas should be the same.

code
preview










Part 2: Make at least one function that takes arguments. Call this function as many times as you need to. 


code
preview









Part 3 : Look for a pattern or patterns and use a loop instead.

code
preview







Part 2: Creative Exercise

We can organize our code into discrete code blocks, functions, to reuse over and over, such as to create different expressions of similar elements (e.g. position, size, speed, color). The idea for next week is to practice writing and using your own functions.


code 
preview






What did you do?

-I created a simple sketch of flowers using 2D shapes and lines. For this, I created my own functions for each component of the repeated elements such as the petals, flower stem, leaves, etc. I also used loops for elements that are repeated on the sketch.


What worked?

-I think what worked well was that I started off writing all of the elements out manually, then worked on cleaning up my functions with the addition of loops and my own functions. Overall, I was able to eliminate a lot of the extensive lists of objects that I started off with which I was happy about. 


What didnt work, and what steps did you take to try to solve the issue? Did any code-related questions come up to you?
-I did run into some issues while working on this sketch- For example, I began to wonder if I can create loops for elements that have different attributes assigned to them such as the flower petals that have different colors. This is why the petals function is the only one that did not utilize a loop. Also, I did want to add some more animated features into this sketch such as mapping the mouse position and changing the position of the petals or the lines that are drawn around them. However, I ran into some trouble inputting these functions within the loop function and errors did occur. I think that I can do some more research and experimentation on this part to further extend this sketch. 














︎︎︎BACK TO ITP BLOG
Last Updated:  April 9, 2023
kristinayou00@gmail.com