Skip to content
Amelia Yang edited this page Oct 5, 2024 · 147 revisions

Week 5

Homework Links


Week 4

  • RESOURCES FROM CLASS:

  • TEST YOURSELF: Complete Worksheet 4

  • DO: Our ability to see patterns is what makes us human. However we also see patterns where none exist because our brains are biased towards detecting certain kinds of patterns over others (e.g. faces). Create a pattern by making something with a lot of repetition. Is the resulting pattern easy to see or hard to see? What would it mean to create the illusion of pattern? Can you predict what the pattern will be when you run your code or does it surprise you? You could take something you've already done where there was a lot of repetition in the code (e.g. your self-portrait) and see if you can re-write it using a loop so that instead of 28 lines of code that call rect(), you have 1 line of code calls rect() inside of a loop that goes around 28 times. How do you need to rework the way you position that rect() in order to make it work in a loop? Try creating an algorithmic design with simple parameters. (One example is 10PRINT, example code).

  • READ / WATCH

    • Videos 5.1-5.3(~40min) in the learning p5.js series.
    • Getting Started with p5.js chapters 9-10
  • RUN CODE

  • ASK

    • Post at least 1 question here. Need help on asking a question?
    • Jinnie Shim: My browser died time to time doing this week's assignments. Are there best practices to keep this from happening?

Homework Links

Week 3


Homework Links: 1 Sketch Per Pair

Week 2

  • RESOURCES FROM CLASS:

  • TEST YOURSELF: Worksheet Post a url to your answers on the Google Doc.

  • DO:

    • Consider the following cliches / pearls of wisdom: No man is an island. There is no such thing as a new idea. Everything is related to everything else. It’s all relative. The world is defined through relationships and those relationships shape our perspectives. Use variables to build in some relationships between two or more elements in your sketch and think about how the perception of what’s happening is different depending on which element's perspective you take on. Think about:
      • What’s related to what?
      • How are they related?
    • You should definitely take a mathematical approach to answering these questions but you can also take a figurative, metaphorical approach.
    • The elements common to all of your sketches are: position, dimensions, stroke thickness, color values. Can you relate one or more of these elements to:
      • itself over time (so it changes over time)
      • a different element in your sketch
      • frameCount (which frame of animation is now)
      • mouseX or mouseY or the combined (mouseX, mouseY) mouse position
      • or something else!
    • You can revisit your self-portrait to build relationships (link the eyeballs together!) or create something new.
  • WATCH, READ, RUN CODE:

  • ASK

    • Audrey Dahyung Oh - When you draw a rectangle with four lines like no.2 of the worksheet, is there a way to "fill in" the rectangle without drawing an additional one that fits exactly with the line? In other words, can Javascript read four right angle lines that close into a shape a rectangle?
  • When x value increases by 1 (x++;), what is the way to make the increase stop when x hits a certain point? How do you define floor and ceiling ranges for conditional increments?
    • Will Xuan - In worksheet No.6, the square suppose to follow the mouse like the circle did before, but square never stops moving even passing the mouse. The only variable is that I define the if section with the center of each line rather than center of the square, but the lines are already in relationship with the center in code. What is the reason for square not following the movement of mouse?
    • Luna Park - When mouse is off to canvas I want the “mouseX” stop following but I am not sure how to do it.
    • Jinnie Shim - Can I define a series of numbers (e.g. (x, y)) that could go as part of the arguments of a certain function (e.g. rect((x, y), w, h))? How is defining a variable with let/initializing in setup different from declaring variable and initializing from the beginning?

Homework Links


Week 1

  • RESOURCES FROM CLASS:

  • SET UP:

  • DO:

    • Complete this worksheet. Our weekly worksheet become the basis for the next class. You must be logged in with your NYU account to access the worksheet.
    • Create a "self" portrait using 2D primitive shapes. Play with symmetry in your portrait. Shapes include – arc(), curve(), ellipse(), line(), point(), quad(), rect(), triangle() – and basic color functions – background(), colorMode(), fill(), noFill(), noStroke(), stroke(). Remember to use createCanvas() to specify the dimensions of your window and wrap all of your code inside a setup() function. Here's an example: Zoog
    • Write a blog post about how computation applies to your interests, due 24 hours before the next class. This could be a subject you've studied, a job you've worked, a personal hobby, or a cause you care about. What projects do you imagine making this term? What projects do you love? (You can review and contribute to the ICM Inspiration Wiki page). In the same post (or a new one), document the process of creating your sketch. What pitfalls did you run into? What could you not figure out how to do? How was the experience of using the web editor? Did you post any issues to github?
  • READ AND WATCH:

  • ASK

    • Post at least 1 question below. Examples of good questions...
    • Name (optional) -- Question: Why is it that this is like this and that is like that?
    • Amelia Yang -- When recreating an image and inputting the RGB values for 'fill()', I have been entering random values first and then adjusting them one by one to get as close as possible to the desired color. I find this method quite inefficient. Is there a more efficient way to quickly extract the RGB values of a specific color? Would using Photoshop or other tools be the best approach?
    • Luna Park -- During the using of arc(), (using PI, HALF_PI and Quarter_PI,) at the reference, some examples are put + sign with two PI, and some are not. I am not sure when I have to put + sign during use of arc()
    • Marven Ma -- Is there a way to notate the coordinates on the graph or have some kind of referencing points so it could be easier to figure out the what I should put in the parameter for x and y, especially when the graph gets larger and I want to get into the very details in my graph?
    • Audrey Oh: If you wanted to draw a square frame, I can think of many ways of doing this: You could 1) create an unfilled rectangle with a thick stroke, 2) create a rectangle and erase a smaller one from the inside, 3) create a rectangle and overlay on top another rectangle that has the same color as the background. 4) Four rectangles as each sides of the frame. What would be the most efficient way to complete this action? Is it how many lines of code? How do you calculate efficieny in coding?
    • Yafira Martinez: When it comes to color, RGB values are widely used. Is it more efficient than using Hex color codes? If so, why? (following up with Amelia's question, I also wish to know if there's an easier way to be more comfortable with using RGB values instead of adjusting them one by one)
    • Ranjani Ramakrishnan: Similar to the RGB values, I had a question regarding (X,Y) coordinates. I have been eyeballing the values so far which takes quite a lot of time. I also found a line of code which displays the coordinates wherever you point your mouse which was pretty helpful. Wouldn't it be more efficient if p5 had some sort of a ruler to figure out the exact coordinates?
    • Jinnie Shim -- Question: If x and y starts at a certain point why doesn’t it belong in the setup() but before that? Also, I did my version control on the web editor. How might I do that on gitHub? Is there a way to check what the default values or the current values are for arguments in certain functions? (e.g. strokeWeight)
    • Chris Toh: How do we draw irregular shapes? For example, I had this idea to draw hair for my character, but I realized I get stuck thinking about how to do it. Also similar to previous questions asked - I find myself guessing the coordinates to place different elements, is there an easier method to do this?
    • Will Xuan: Is there a way to see the grid point of the canvas with x and y coordinates on the right side of the screen when we are editing, so that we can map out the exact point of different shapes. At the same time, how do we know the exact curvature of the curve while we coding the coordinate?
    • Ping Lin: Is there a built-in feature or tool in p5* that allows you to track or display the coordinates of shapes or the mouse pointer in real-time while coding, to better visualize their position on the canvas? I often struggle to accurately place shapes and locate their points

Please make sure your posts are publicly accessible by testing them in an Incognito (Chrome) or Private Browser (Safari).