Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In this next movie we're going to start looking at the seven primitive shapes, or basic geometrical shapes, that Processing can draw. The most basic one of these is a simple point in a field. What I'm going to do is I'm first going to put a comma (,) to give the name of this particular sketch. I do the two slashes (//) and you can see when I started typing that we got a section sign at the end of the name of the file on the tab that indicates that they are unsaved changes. If I just do Ctrl+S to Save on a PC or Cmd+S on a Mac, now it goes away because I'm saved.
So, what I'm going to do right now is I'm going to draw a point. The first thing I'm going to do is set the size of the sketch display window. For most of the sketches in this course, I'll be using a window that is 600 pixels wide and 200 pixels tall, this is an arbitrary choice; it's just the one that seems to work nicely. So, what I do is I type size for the function, and then in parenthesis I put the dimensions 600 pixels wide and 200 pixels tall, close the parenthesis, and then put a semicolon (;) to end the function. And so right now, I could Run this sketch, Ctrl+R on a PC, Cmd+R on a Mac and I'll get my window that's 600 pixels wide and 200 pixels tall.
I'm also going to turn on anti-aliasing, this is something I do on every sketch and that's just smooth with the open and closing parenthesis (), because there are no arguments for this function. But, it does have to have that space and a closing semicolon (;). Now, what I'm going to do is I'm going to drawn a number of points and all I need for a point is an x, y coordinate. The first point is going to be 100 pixels over and 100 pixels down. I'm going to draw a several more and I'm going to put them 50 pixels away from each other.
I'm just going to copy and paste to do this. And then I'll change these manually and when I draw it, this is what you'll see, is a series of very, very small points. Now, they are small, because they are points. And, in fact, given the compression that we used, you may not be able to see them at all. In fact, what I'm going to do is change it to make it so you can see them better. When I close this sketch, and I'm going to make a couple of changes; Number one is, actually I'm going to change the color of the background.
I'd like to use something else. In this particular case, I'm going to type in background and I'm going to be using a background with a hex code. Hex codes are hexadecimal numbers and they are another way of indicating color codes. It's still the RGB Red, Green, Blue system and its' still on an 8-bit 0 to 255. But, it represents it in a different way that's a little more compact. And we have to do is first type the pound sign (#). And then you type the 6-letter number code that you're going to use.
Now, this one is going to be 666666, so now you see when I draw it, it's a darker gray. Then what I'm going to do is I'm going to change the color for the dots themselves. I'm going to change this by using the Stroke command. Now, if this were a circle or a square, I would use the Fill command. But, a point is just a point that theoretically doesn't have a Fill in it, it's just an outline of itself. The way I do this is I type in stroke, all lowercase, and then I'm going to use the hex command for the color that I'm using.
In this case, I'm using 607F9C. In case you wonder, I am consulting an external file with the palettes that I've put together earlier. Also, to make this so you can actually see these points, I'm going to increase their size substantially, and the way I can do that is by using strokeWeight. And this is where we get into the issue of Bumpy Caps or Camel Caps. And what we have here is that the functions almost always start with lowercase letters. But, if you want to distinguish words in them, you can then go to capitalization.
So, strokeWeight is the name of that function. And then in parentheses () I'm going to put the number of pixels that I want each of these points to be. I'm going to pick 20 pixels; close the parenthesis and a semicolon. Then I'm going to Save the file and Run it by hitting Ctrl+R on a PC or Cmd+R on a Mac. And now, what you see is a collection of points that are now large enough to be circles against a darker gray background. So, this is the very first primitive geometric shape that we deal with in Processing, is this simple point.
And this will serve as an excellent starting point for the other sketches that we'll be working with in the rest of the movies.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97196 Viewers
61 Video lessons · 84482 Viewers
71 Video lessons · 68688 Viewers
56 Video lessons · 101172 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.