On this page we start to explore an algorithm that can be used to draw lines and coloured squares in the style of Mondrian. Sequences need order and have to be precise to achieve the required outcome.
The code opposite controls a red square sprite.
Can you work out what will happen each time the Green Flag is clicked?
Write down your prediction
Click on the button below to run the code.
Did it do what you expected it to? Write down any differences.
- Which code instructions draw a line?
- If you run it again, why is the square a different colour? Write down which instruction achieves this.
- If you run it again, why is the shape a different size? Write down the instruction which achieves this.
- Each time you run the program, it draws the line in a different direction. Which instruction makes this happen?
- Write down the instruction that ensures the shapes are always in a different position.
Make small changes to the program, to adapt what it does.
- Change the program so that the line is longer. Write down what you changed.
- Change the program so that the squares are bigger. Write down what you changed.
- Add an instruction to the program so that it draws another square before drawing the line. Write down what you added and where.
- From the Pen menu, add an instruction that changes the line colour each time. Write down what you added and where.
Make your own art following the ideas below.
- Draw two lines with a right angle in between before stamping a square.
- Draw a line and then draw the square in a separate place.
- Use this idea to make up your own picture using lines and “stamping” a shape sprite.