NOC – Week 3: Vectors – Andrew Joslyn

Link here.

For this week, I wanted to do something, and was thinking about updating last week’s sketch with the rain and umbrella, and converting the raindrops into vectors and having them reflect or “bounce” off the umbrella, but I thought it would be much more appropriate (and maybe much less original) to make fireworks. After looking at some other people’s examples online and not being very satisfied with any of them, I took a few hours to code my own. It’s a pretty simple program I think, and writing it all really helped to further solidify my understanding of objects and constructors, arrays, and conditionals, and I think spending the time this week to code something from more or less scratch instead of just improving on something old may help me in the future once the concepts become more rigorous, since admittedly, my coding skills were sub-par entering this semester, but are I am growing more and more comfortable with P5 after not having done processing in nearly 3-4 years (since freshman year). I used comments frequently this time, and plan on continuing that not only to help others but to help myself understand what my code was doing, they helped me “find my place” a lot of the time, since scrolling up and down over and over does make the code begin to kind of blur together. Overall this week was a fun step to take, and I managed to spend most of the time coding rather than fixing errors in my code, which was nice especially since I had tried to mess with createVector() last week before I even knew that they were the next topic in class, haha. Looking forward to class tomorrow.

NOC – Week3: Bouncing Balls – Jingyi Zhu

Date: 03/03/2019

Links: full screen: https://editor.p5js.org/jz1111/present/vEVlvdoEP

              sketches: https://editor.p5js.org/jz1111/sketches/vEVlvdoEP

Video: 

I simulated balls bouncing in a completely frictionless environment. The balls are generated by clicking the mouse, with an initial speed and a horizontal acceleration. There exists a constant force as gravity that gives the balls a constant vertical acceleration towards the “ground”. I slightly modified Professor Moon’s update() function by having the vertical acceleration remaining the same to simulate the constant gravity.

I created three buttons at the bottom. With every different button pressed, the balls generated will have a different elasticity. The balls will eventually stop bouncing, but their horizontal speed will remain because there are no horizontal forces.

I also created a head() function for the object to get the direction from the center of the balls to the mouse. In the function display(), the balls rotate an certain angle according to the direction. Thus, the little white ellipse near the edge of every ball will always face the mouse.

Nature of Code: Week 3 assignment–Moon(Candy)

Documented by: Candy Bi

Project name: Rect Map

Professor: Moon

Date: 3/5/2019

Video: final version

While playing around with vector and object, I came up with the idea of making a map of rectangles that could have some interesting interactions with “mouse”.

I first make a map of reactangles using objects.

rect map

For better user experience, I change the opacity of background in draw function, so that each rect could leave some trails of moving.

Then I add the interaction of mousePressed–when the mouse is pressed, all the rects get random speeds and fly away.

I add another fuction of “addforce()”, in which I compare the mouse position and the position of each rect. By using this function, I successfully achieve the effect of rect would only move when the mouse hover on it.

HeartShape Image I drew. “Lily” text I wrote.

NOC – Week 3: Petals in Flames II – Tiger Tian

Date: 03-02-2019

Click here to visit on P5 Web Editor

For this week’s vector assignment, I redid my “Petals in Flames” idea with vector. This time I made it more colorful, using more random function but in a way that doesn’t produce inharmonious combinations of colors. The small flower in the middle is made using HSB color mode, by mapping the hues of the ellipses to their positions. I also added a spinning effect to it. It spins clockwise by itself, and mouse movements make it spin faster.

I kept the petal number changing function, which increases and decreases the number of petals. When you hold the mouse, all the petals close inwards by a “freeze” function. Another function called “bloom” is triggered every time the mouse is released, making those squarish objects burst out of screen.

NOC – Week 3: Vector Fountain – Susan Xu

Link: https://editor.p5js.org/Susan_Xu/sketches/6w9uERpF5

I change the code from last week in form of vector. Everything is much clearer now. I follow Moon’s advise to scale the window to full size.

The interaction well reminds me of fountain, so I thought: why not a real fountain? I change the initial velocity in y to negative, so the particles are shooting up before falling down. For the best view of the fountain, I restrict the initial position to the bottom of the canvas. After all that, I alter the color to make it more realistic, and add velocity coefficient to ensure that the fountain stays in the canvas. Now, our users are able to create their own fountain (and even fountain sets! Check below:).

Fountain that burst wherever you click.

My change in color, though, is disliked by my boyfriend. He insists that pink is the perfect color. To make compromise, I add a keyboard interaction: once ‘p’ is clicked, the fountain will become pink, and will return to blue once other keys are pressed. Which color do you prefer? Let me know!

Fountain that can change color (pink or blue).