Skip to content
Daniel Shiffman edited this page Mar 15, 2017 · 52 revisions

Review

In-class Examples

Assignment: Choose one or create your own.

  • Design a creature with oscillating parts (legs, wings, antennae, etc.) Consider tying the speed of oscillation to the speed of the creature's linear motion. Can you make it appear that the creature's internal mechanics (oscillation) drive its locomotion? Example solution.
  • Experiment with polar roses - Video Tutorial
  • Create a simulation where objects are shot out of a cannon. Each object should experience a sudden force when shot (just once) as well as gravity (always present). Add rotation to the object to model its spin as its shot from the cannon. How realistic can you make it look?
  • Create a simulation of a vehicle that you can drive around the screen using the arrow keys: left arrow accelerates the car to the left, right to the right. The car should point in the direction it is currently moving.
  • Simulate the spaceship in the game Asteroids. In case you aren't familiar with Asteroids, here is a brief description. A spaceship (represented as a triangle) floats in two dimensional space. The left arrow keys turns the spaceship counter-clockwise, the right clock-wise. The space bar applies a “thrust“ force in the direction the spaceship is pointing. Example Solution
  • String together a series of pendulums so that the endpoint of one is the origin point of another.
  • Use trigonometry to model a box sliding down an incline with friction. Note that the magnitude of the friction force is equal to the normal force.
  • Rework the wave examples to have a Wave class and visualize the wave using something other than circles. Example Answer (minus the change in visualization)
  • Using the Spring example as a basis, create a system of multiple bobs and spring connections. How would you have a Bob connected to a Bob with no fixed anchor? (Sample Answer 1, Sample Answer 2)
  • Apply other forces (liquid drag, wind) to the spring and pendulum simulations.
  • Research and implement a simulation of Torque.
  • Oscillation in other mediums
    • Oscillating colors? sizes? number of elements on the screen?
    • Use oscillation to control the timing of events on the screen: sounds, the appearance and disappearance of elements.
    • Create polyrhythms with different oscillating patterns that come in and out of phase with each other.
    • Create oscillating pitch patterns in sound.
    • Oscillate playback position or speed of a video.

Directions

  • Document your work on the web and link to it below.
  • If you are using Processing or some other offline tool, add a copy of your work to our shared Google Drive folder. If you are using the p5.js web editor or other online editor like codepen, you do not need to share your code this way.
  • Try to post by the evening before class if at all possible.
  • Add any questions below.

Questions

  • your question here -- your name (optional)
  • vector.rotate does not give the correct angle Sample--Ada
  • I think my question is I couldn’t successfully get the object to attract each other and I don’t know why it’s not working. I tried to get the mover’s object(flower) to animate according to the attractor’s radius(circle in the middle). The circle would be getting bigger and smaller in the middle. --Mint
    • return force? didn't return the correct force?
  • Can we do an example of subtracting vectors in P5?-Pilar
  • Is is possible to map to just one of the values of a vector? (eg. just the loc.y component of a location vector)-Pilar

Post your work - Wednesday Section!

Post your work - Tuesday Section!