Lab 2 cs1graphics: Transformations

The following designs will be added to your existing file.

Task 1: Pinwheel

Create the following design:

The design should be contained in it's own Layer, let's call it pinwheel, and it should be made up of 4 clones of the treat Layer.

Here is the pinwheel design with the grid and reference points shown via cs1graphicsHelper (drawGrid and drawReferencePoints):

In the image above, note how only one reference point is shown (at the center of the pinwheel). When a Layer contains other Layers, drawReferencePoints depicts the reference point of the topmost Layer only.

Recall that in cs1graphics, you can clone, rotate, flip and scale objects. Here are the lecture notes for reference.

Task 2: Firework

Next up, a firework pattern. As in the pinwheel task above, there are 4 clones of the treat Layer in this firework pattern. This firework pattern is shown centered in the Canvas.

Approach 1)

The reference point for the treat Layer is placed at the center of the scoop; thus, if you rotate the treat clones around this point, you'll need to then move the clones into position to replicate the design.

Approach 2)

Alternatively, you could move the reference point of the treat clones to the bottom point of the cone using cs1graphics adjustReference method. With the reference point at the bottom, then you can just rotate each treat clone around the center.

The adjustReference method changes the reference point of an object by a provided change in x-axis (dx) and change in y-axis (dy). (The d is short of delta).

For example, doubleTreat.adjustReference(0, 100) would move the reference point of a doubleTreat layer down like this:

What dy value would you need to use so that the reference point was at the bottom tip of a treat clone?

Once the reference point is moved to the bottom tip of the cone, all the clones can be placed in the same position and then rotated around that point.

Task 3: Wheel

Next, using the firework pattern, create this wheel design:

Task 4: That 70s design

Now let's combine some of these designs together.


Task 5: Collage

And finally, a master collage with all the designs!

Tip: The double scoop cone (on the right) is scaled 150% bigger.

Table of Contents