For this project, create a class that represents a complex shape. Wherever the user clicks, create a
Question:
For this project, create a class that represents a complex shape. Wherever the user clicks, create a new instance of your shape class and place it where the mouse was clicked. Give it a random rotation and a random scale between 0.5 and 2.0. Track all of the shapes that you have created so far in an array.
Each click should produce a single shape.
The shape should consist of at least three primitive shapes.
The shape should exist alongside all of the previously placed shapes.
The shape should be produced at a random rotation and a random uniform scale. (Spoiler: you can either use the same number for both arguments of your scale() function, or just pass in a single number.)
The shape, when placed, should be centered where the mouse was clicked (or at least close) and it must not be distorted other than being uniformly scaled.
Every frame, you must clear the screen and redraw all shapes created thus far.
You must use a class for this assignment, and you must use an explict class declaration in a separate file, linked in to your project in the HTML.
Put as much functionality in your class as possible.
You are allowed to use more classes if you can make something easier.
Validate all assignments to properties in your class.
Scale should reject values outside of the 0.5-2.0 range.
Log a stack trace if this happens. Rotation should normalize to 0-360 degrees.
Position should clamp to the size of the screen.