You are on page 1of 2

UXS-2071/UXS-3071: Scripted Media 2017

X071_06: BOUNCING BALL PATTERN (5PT)

THE REQUIREMENTS ARE

This sketch will be an animation of a small circle moving around the screen, leaving a trail of circles
behind until it fills the screen in a regular pattern.
The canvas should be a random width and height between 200 and 300 pixels.
The first circle should start at a random location on the canvas.
Each circle should be a different, random colour
The circles should have a random diameter less than 20px. No circle should be 5 px.
When the circle reaches an edge of the canvas, it should reverse direction and continue.
xSpeed = -xSpeed;
The movement of the circle is an illusion. The code should constantly create new circles. Create
xSpeed and ySpeed and add them to the x, y coordinates for frame of the animation. The speeds
should be random, but always greater than the diameter. The higher the speed, the greater the
distance between the circles and the weaker the illusion.
Use if structure to test for edges of the screen. If the circle reaches the edge, reverse the direction.
Do not put the background in the draw function (except to try it and see what happens).
Daniel Shiffman's site has an example of the basic algorithm:
http://learningprocessing.com/examples/chp05/example-05-06-bouncingball#

X071_06: BOUNCING BALL PATTERN (5PT)


UXS-2071/UXS-3071: Scripted Media 2017

UPLOAD TO BLACKBOARD

1. Put the following information as comments at the top of your program:


a. //Your name.
b. //Your bangor.ac.uk email address
c. //X071_06: Bouncing ball pattern
2. Name your project X071_06: Bouncing ball pattern.
3. Use a screen recorder to create a 3-minute explanation of your sketch code. Explain why you chose
the diameter and speed that you did. Point out how you created random colours for each circle and
kept the speed greater than the diameter. Save the recording on-line
4. Create a screenshot of the sketch output.
5. Save the project and download the files as a zip file
6. Go to the Sketch Journals on Blackboard. Open Sketch Journal 1 and create a new Journal Entry.
a. Name the journal entry X071_06: Bouncing ball pattern.
b. Upload the zipped sketch files (include all files required to view the functioning sketch)
c. Provide a link to the screencast recording from step 3.
d. Upload the screenshot from step 4.
7. Save the journal entry.

RANDOM([MIN], [MAX])
Return a random floating-point number.

If no argument is given, returns a random number from 0 up to (but not including) 1.


If one argument is given and it is a number, returns a random number from 0 up to (but not including)
the number.
If two arguments are given, returns a random number from the first argument up to (but not
including) the second argument.

X071_06: BOUNCING BALL PATTERN (5PT)