Sie haben nicht gefunden, wonach Sie suchten?
Neuer Post6 Kommentare
-
Hello Shifa!
For future reference, you can check out the documentation found beneath any program to find out the use of these commands.
'push/popMatrix' will store the current matrix and allow you to make a new one.
'arc' requires 6 parameters: x, y, width, height, start, stop. An arc will be drawn based on these values.
'bezierVertex' is used in unison with 'beginShape' and 'endShape'
Let me know if you have any further questions.
-
HI Loyalty!
I am having the same problem, mostly with triangle, image and curvevertex, please can you help.
Thank You in advance!
-
Hello Jessica!
I would like to remind you that the documentation will be very helpful
'triangle' requires 6 parameters - each pair of numbers will control the x and y position of one of the three points on the triangle.
'image' will allow you to draw one of the images in Khan Academy's library.
'curveVertex' is also used in unison with 'beginShape' and 'endShape'
-
Thank you Loyalty!
I understand now, but anytime I try to use triangle I can only make it big or small but does not move to the position or direct sports I want it.
Hope you understand.
-
The triangle can be tricky. The syntax of the triangle function is:
triangle(x1, y1, x2, y2, x3, y3)
- x1 and y1 are the coordinates of the first point.
- x2 and y2 are the coordinates of the second point.
- x3 and y3 are the coordinates of the third point.
I think it helps if you think about where you want the endpoints to be before you try to draw your triangle. When you experiment with different numbers in live code, the triangle seems to jump all over the place and it can be hard to see how it all works. You could also comment the code (//) while you are writing it and then take away the // to see the finished triangle.
Using the Waving Snowman Challenge as an example, if we want to draw a triangle to represent a nose around the center of the ellipse that is the snowman's head and we want it to point downward. The code for the head ellipse is
ellipse(200, 120, 75, 75);
So, we know that the center of this ellipse is x = 200, y = 120. It is 75 pixels wide and 75 pixels tall.
Let's make the base of our triangle 18 pixels. (about 1/4 the width of the ellipse and an even number to make the arithmetic easier). If we want it centered at x = 200, we need it to start 9 pixels (half of 18) closer to the left (x = 191) and end 9 pixels farther from the left (x = 209). We can use y = 120 to make it a straight line.
All of this gives us the first two points of our triangle: x1 = 191, y1 = 120 and x2 = 209, y2 = 120.
We want our third point to be in the center and farther from the top than these two points. We know that the center is at x = 200. Since our base is 18 pixels, let's try placing the y coordinate of the last point 18 pixels further from the top than the y coordinates of our base (120 + 18). This would make the third coordinate x3 = 200, y3 = 138.
To finish, we want to pass all of these arguments to the triangle function, like this
triangle(191,120,209,120,200,138);
-
The documentation is great at explaining things but I still dont understand metrix
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.