Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
One of the extraordinary capabilities of Processing is the ability to take a sketch and to save it as standalone applications for Windows, Macintosh and Linux PCs with a single click. What I'm going to do is I'm going to take this particular sketch of the moving squares. I'll show it to you again, if I hit Ctrl+R on a PC or Command+R on a Mac to run it. These are blue squares that are changing around randomly. Now say, I wanted to share this with somebody else. All I need to do is hit the Export Application button.
I'm going to add one little line of code that can be helpful in certain circumstances. And I'll explain it after I get it in there. I need to put us in setup, so I'm going put it down right here, and it's a little Java command, although we don't need to open up the Java library to make this one work. I do frame.setBackground and then in parentheses new java.awt.Color and then in parentheses I put the color I want for a backdrop.
In this case, I'll just put a solid black (0, 0, 0). You can put other colors if you want, second parenthesis to close it and a semicolon, and this one command is going to make it so that, if for instance, I were to try running the application full screen, it would have a solid black background, otherwise sometimes you get some weird artifacts of shapes showing up. So now I'm going to save this sketch and I'm going to come up to Export Application, and you see that by default it has all three major platforms: Windows, Mac and Linux checked off. And for Windows and Linux it will actually do both 32 and 64-bit versions.
I also have the option of doing a Full Screen Presentation mode with a Stop button. Now I should mention the full screen does not work well in my experience on Windows, and so I'm going to the leave it in a standard windowed mode. But if you save it that way on a Macintosh, you can get a very nice solid black background with a Stop button down in the lower corner. But for right now, I'm going to leave it in its windowed mode and just hit Export. Then it goes to the sketch folder and it adds five new folders, linux32 and 64-bit versions, the Mac OS X and windows32 and 64-bit versions.
So I'm going to come right here and just open up this one folder, and the important one is this one right down here. I just double-click on that and up pops my sketch in a window. The beautiful thing about this is if I have an interactive sketch, I can hand this around to other people and they can use it on their own computer. They can interact with it. They can modify it. They can watch it without even having to have Processing or having the code behind it. And I can't think of an easier way to create an application in Windows, Mac and Linux that you can immediately share with other people than by doing it through Processing.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 98588 Viewers
61 Video lessons · 85887 Viewers
71 Video lessons · 69766 Viewers
56 Video lessons · 102075 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.