Design and Code a Picture with Balloons and a Present Using Basic Drscheme Drawing Commands

Design and Code a Picture with Balloons and a Present Using Basic Drscheme Drawing Commands


OBJECTIVES

 Design and code a picture with balloons and a present using basic DrScheme drawing commands.

 Practice technical reading skills

 Practice plotting points and calculating values based on patterns, algebra and geometry concepts.

PREPARATION

  1. Review activity 2 where you plotted points on graph paper from the completed code for the person picture.
  2. Look at the sample balloon picture that I did. Look at pictures by other students to get ideas on creative attributes.
  3. Label a sheet of graph paper with your name, period, date, and the title “BALLOONS”
  4. Label grid numbers on that graph paper per sample in activity 2.
  5. Open up Scheme and start a canvas that has proportion of 4 by 3. (Ratio 4 : 3) with the horizontal length larger then 500 pixels. Remember, to solve proportion problems set up an equation with the widths on the top and heights on the bottom. One of the dimensions will be a variable. Cross multiply to solve the equation. Ask for help if needed.

DO: List 3 dimensions you could use in your journal. Show the calculations.

 STEP ONE

  1. Document the description of this segment of code by adding a comment with 2 semi-colons in front.
  2. Define a name for this section
  3. Draw a black rectangle the size of your canvas.

  • The coordinate of the position will be (0, 0) since you are starting at the top left corner. Remember that this is opposite what you do in math for the y-coordinate because you are working on a monitor, not the Cartesian plane. (0,0)
  • The horizontal length of the rectangle will be the first parameter in the start command that started your canvas.
  • The vertical height of the rectangle will be the second parameter in the start command that started your canvas.
  1. On graph paper plot where you would like to start the grass. Record the height of your rectangle on the graph paper by counting the lines. (0, 450)
  2. Draw a horizontal line on graph paper to show the location of the grass.

6. Draw a green rectangle to represent the grass.

  • The position will be the coordinates of the top left corner of the grass.

  • The horizontal length will be the same as in the black rectangle for the length
  • The height will be the difference between the vertical size of the canvas and the y-coordinate of the position of the start of the grass.

Subtract 480 and 450 (- 480 450) = 30

Sample Code:

;;Define a constant for black background with green grass on bottom

(define BACKGROUND

(and

(draw-solid-rect (make-posn 0 0) 640 480 'black)

(draw-solid-rect (make-posn 0 450) 640 30 'green))

Note: Do NOT use 30 as the height of the grass. Change the value!

You may use 640 by 480 for the canvas size.

  1. Click EXECUTE to see if your code worked.
  2. Look at the feedback on the Interaction window if there was an error.
  3. DO: Write down any error message you have in your journal.
  4. See if you can debug yourself by looking at the BOOK of ERRORS with possible solutions.
  5. Compare your code with the sample.
  6. If you can’t find the error type the sample code, study, and try again.

STEP TWO – Activity 3

Note: The directions will not be as detailed as in the first step.

You need to look at the sample code, think and apply previous learning.

  1. Draw 3 – 5 circles on your graph paper where you would like your balloons
  2. Plot the center coordinates of each point
  3. Use the commands draw-circle and draw-solid-disk to create the balloons, which takes 3 parameters:
  4. The position for the first parameter is the center of the circle you plotted.
  5. The next parameter is the radius. Count the lines to calculate an estimated size.
  6. Pick a color from ‘red, ‘blue, ‘yellow, ‘green, or ‘white and add as the 3rd parameter.

DO: In your journal answer: Why can’t you use ‘black for the color of a circle?









Sample Code:

(define BALLOONS

(and

(draw-circle (make-posn 150 200) 40 'red)

(draw-circle (make-posn 150 200) 39 'red) Note: The first circle is repeated 3 times to add thickness.

(draw-circle (make-posn 150 200) 38 'red) The radius is decreased by one. Try variations!

(draw-solid-disk (make-posn 320 150) 50 'yellow)

(draw-solid-disk (make-posn 450 250) 40 'blue)))

Note: Do NOT use the same positions or dimensions that I used. Change the value!

DO: In your journal

  1. Write a command that will draw a green circle with a radius of 70 pixels at the coordinates (100, 200).
  1. Write a command that will draw a red circle inside the previous circle from question 2 with a radius that is 10 pixels smaller.
  1. Write a command that will draw a blue circle inside the previous circle with a radius that is reduced using the same pattern established in question 2.
  1. What 2 parameters are changing, and what parameter is remaining constant?

5. Record how this pattern can be applied to create creative balloon designs.

 STEP THREE

  1. Draw lines from the center bottom of each balloon to represent the strings on your graph paper; estimate the length.
  2. Under each set of balloon code, add a command to draw a solid line, which takes 3 parameters.
  3. The first parameter is one of the end points.
  4. The X-coordinate of the point will stay the same as the X-coordinate of the circle the string is connected to.
  5. The Y-coordinate of the point will be the sum of the radius and the Y-coordinate of the circle above.

Sample Code:

;;Defines a constant for 3 balloons with strings

(define BALLOONS

(and

(draw-circle (make-posn 150 200) 40 'red)

(draw-circle (make-posn 150 200) 39 'red)

(draw-circle (make-posn 150 200) 38 'red)

(draw-solid-line (make-posn 150 240) (make-posn 150 350) 'white)

(draw-solid-disk (make-posn 320 150) 50 'yellow)

(draw-solid-line (make-posn 320 200) (make-posn 320 300) 'white)

(draw-solid-disk (make-posn 450 250) 40 'blue)

(draw-solid-line (make-posn 450 290) (make-posn 450 380) 'white)))

  1. Repeat that process with each balloon.

 STEP FOUR

  1. On graph paper draw a sketch of a present with ribbons.

Note: A challenge would be to draw a perspective as learned in the graphics module.

  1. Draw a rectangle for the box.
  2. Draw lines to add the ribbons.
  3. Decorate the box if you would like.

;;Defines a constant for present with a ribbon

(define PRESENT

(and

… You are on your own now since you know the commands. .. )))

DO: In your journal tell what the Boolean operator “and” does in each definition.

 STEP FIVE

  1. Draw a bow using the drawing commands.
  2. Define a constant for that bow per samples.
  3. Add anything else you would like to enhance your picture.
  4. Review the CODE CHART handout for reference as needed.

DO: Raise hand to get your final picture softcopy graded. After approved, print a final copy for your journal portfolio binder.

NEXT LESSONS

 ACTIVITY 5: Add your Balloon graphic to a web page with a description of how you created your graphics. Create a list of errors and a description of how you debugged these errors.

 PROJECT: Create a web page and add to your portfolio of all your programmed graphics and code.