CMPS 160 -- Lab Assignment 1
Due date:
midnight Friday, April 8, 2016
NO LATE SUBMISSIONS ACCEPTED
Objectives:
Get familiar with Canvas and javascript.
Description:
-
From the examples of
Canvas element one can see that it has methods that allow you to draw
simple graphical shapes in javascript.
For this lab assignment,
your task is to first pick your favorite shape
e.g. rectangle, line, circle, etc., and learn the parameters
required for that shape.
-
Your second task is to create a program (i.e. html file with a separate
javascript file) that will draw 10 instances of your favorite shape
at random locations within the canvas.
While you may vary the size of your shape, do keep it the same size.
Observe what happens if the shape is placed near the border of the canvas.
Also make sure that there are 10 instances of the shape that are visible.
Overlapping instances are fine as long as one can make them out as more
than one instance of the shape.
-
Make sure that your program has proper documentation
e.g. header block with your name, student id; and comment blocks
for different sections of the code.
Bonus (10 points):
You'll need to work with javascript functions.
Replace the simple geometric shape (e.g. rectangle, line, circle, etc.)
with a composition of simple shapes e.g. make a smiley face or your
favorite emoticon, or a logo, etc.
So, each time your web page is refreshed, one should see 10 instances
of your complicated shape at random positions on the canvas.
Reference material:
Grading:
This lab assignment will form part of your CMPS 160L grade.
The other component of CMPS 160L grade is your attendance.
Here's what I told graders about grading this assignment:
10: has header block
10: has inline comments and comment blocks as needed
10: javascript code in a separate file
40: has 10 shapes visible within the canvas
20: they're in random locations
10: they're the same size
okay to have different colored shapes;
okay if the shapes change size but are all the same in each "run".
Who graded your assignment:
David: aassi - dtra24
Daniel: dwmarx - kmccotte
Joseph: kyalopez - nwendell
John(Andy) : oysong - zpeterse
Submission:
Your lab assignment should be contained in two files:
an index.html file and TenOfMyFavoriteShape.js.
Put both of these in a folder called lab1.
Zip up lab1 before submitting.
Submission must be done using the "submit" command from unix.ic.ucsc.edu
- submit cmps160-ap.s16 lab1 lab1.zip
Issue this command from unix.ic.ucsc.edu.
Last modified
Saturday, 09-Apr-2016 10:41:16 PDT.