Skip to content

BoiseState-AdaptLab/HS_02_ShapeMaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

ShapeMaker

In this lab you write functions to create different shapes: rectangles, triangles, and circles. You will then use your functions to create a picture.

Challenge 1

  • Implement the following functions

    • drawRectangle -- this is done for you, but it isn't quite right!!
    • drawTriangle
    • drawCircle
  • Practice calling your functions using different parameters to make sure they work correctly

Challenge 2

  • Modify the drawRectangle function your wrote so that you can add text to the rectangle in a different part of your program. Do this by adding a return statement to return the rectangle variable.

  • Declare a new variable (call it whatever you want). Then call drawRectangle and assign it to this new variable (see the code snippet below). Add text to your rectangle.

var myRectangle = drawRectangle(200, 10, 10);
  • Modify the drawCircle function your wrote so that you can change the background color of the circle in a different part of your program. Do this by adding a return statement to return the circle variable.

  • Declare a new variable as before, then call drawCircle and assign it to this new variable. Use the backgroundColor property to change the background color of the circle.

Challenge 3

  • Create triangles with different colors by replacing null with a color when you call makeTriangle. For example, the following code snippet would draw a pink triangle,

drawTriangle(100, 200, 200, "transparent", "transparent", "transparent", "pink");

Challenge 4

  • Create a picture of a "Winter Scene" using the functions you wrote. Your final image should incorporate at least 10 different elements and clearly resemble an image.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published