mouse press to change
mouse hover to change
The tangram puzzle consists of 7 geometric pieces which are normally boxed in the shape of a square. The pieces are used to create different patterns including animals, people, numbers, geometric shapes and many more. I tried to use the “function” syntax and slide bars in P5 to make these different patterns.
At first, I thought it would be eaiser to make it by using “rotate()” syntax, but I’m a little confused about its parameters. I can’t make each triangle or rectangle rotated at the relative coordinate of itself.
So, finally I use the (x ,y) as variable for each group of pattern. It took a lot of time to draw every seven pieces of each pattern.
When I tried to modify the switch effect of the slide bars this morning, I just clicked “Ctrl+Z”, then suddenly my code totally disappeared. The saved version also changed to a new sketch automatically.
This is the last screenshot of my sketch…
Finally, I finished the coding after I learnt about how to use rotate(a), push() and pop(). It’s easier to draw the seven pieces and make them up into different patterns. My codes are here: hover press
Leave a comment