Brittany Price

Form Generator

Initial Sketch:


Design Process

The form I chose was a die. After watching the tutorials, I developed an idea of how I could draw my die. I started with a rectangle and played around with mouseX and mouseY. Next, I setup the mouse clicked function. I had trouble getting my rectangle to change colors using random. For the time being, I drew on of the dots but had trouble getting it to stay within my rectangle. In lab, we discussed ways to use random. Cassandra used color as an example. I tried it in my program and got it to work.


I asked her how I could get the dot to stay in the die. She suggested trying something mouseX and/or mouseY. After some experimentation, I realized I needed to connect my dots with the rectangle. I created variables for my rectangle's width and height and moved my mouseX and mouseY there. Afterwards, I created variables for my dots' x and y positions and used the rectangle's width and height variables and did some math with the width and height. From there I made some adjustment to my math to position each dot.


Next, I created an if statement that allowed the color of the die to be changed only if the mouse is clicked within the die. I had some trouble with it but after following Cassandra advice I got it to work. I also added text at the top of the canvas. Lastly, I did not want the user to have the ability to change the shape of the die unless the mouse is inside of the die. Also, I want the dots to move with the rectangle when the mouse is within the rectangle. Jason Li said the first part would be complex and suggested booking a tutoring appointment. Before I could, tutor Bolor Amgalan shared a sketch of hers that was a calculator whose buttons moved the way I want my dots to. I decided to leave the scaling of the rectangle alone. After adjusting my math for my dots I got them to resize and move with the rectangle. Another idea I had was to change the number of dots depending on the size of the rectangle but that was complex too and I left it alone. I may try it again one day.


Reflection on Form


Form can be complex especially when user interaction is involved. Placement of shapes matter and can be difficult unless we figure out how to execute our plan. Like the last assignment, it is important to break down the assignment into shapes and use them as a foundation.