Go to back to Script Variable Projects

Script Variable Projects Mondrian Details

  1. Click on this image to load a script that is the outline of the algorithm that produced those designs.
    This list says what each block that you must edit and define should do. Think about when you want pen up and pen down.
    • draw outer frame uses a thick pen size to draw a black rectangle of the size you want for your work of art.
    • fill with random color sets sprite inside that rectangle, sets a random color, and uses Snap!'s fill block to color the rectangle.
    • Choose repeat's number (yourself) to say how many colorful rectangles.
    • go to random location could use go to x: y:.
    • set height and set width should use pick random, but with limits based on Sprite's location, so the colorful rectangles fit in the frame.
    • Draw a rectangle of the height and width you calculated.
    It is an "outline" because most of the blocks have no scripts in them. You will have to edit them to tell them how to do their job.

    This script uses two blocks that you may not have used before. When you draw a rectangle with draw rectangle, you will need to give it values for the height and width. The script variables block tells the computer it must keep track of two variables, and it gives those variables the name you want them to have. The set block lets you set the values of those variables. In this case, you'll have to write some code that gives them reasonable values that change randomly, but don't run over the edge of the outer frame.

  2. Draw outer frame; Fill with random color; Repeat the following steps some number of times; go to random location, set height to (unspecified number) that, at that location, won't extend beyond the frame; set width to (unspecified number)  that, at that location, won't extend beyond the frame; Draw rectangle of that height and width; Fill with random color