PAT 204/504: Creative Coding (Fall 2025)
Due at 11:59pm ET on September 8
“Hello, World!” is usually the first program we write when learning a new programming language. Although that’s not quite the case for Processing, we can do something cooler in Processing.
Let’s start from writing a Processing sketch that
Please submit your code as a PDE file and the final rendering as a PNG file.
Now, let’s make it a bouncing “Hello World!”. That is, the text box should
speedX
(defaults to 1) along the x-axis andspeedY
(defaults to 2) along the y-axis andPlease submit your code as a PDE file and the final rendering as an animated GIF file.
Here is a template sketch for you to get started with:
String msg = "Hello, World!\nThis is {YOUR NAME HERE}!";
float fontSize = 24; // font size
boolean saveFrames = false; // whether to save the frames
float speedX = 1; // speed along the x-axis
float speedY = 2; // speed along the y-axis
// DEFINE OTHER GLOBAL VARIABLES YOU NEED HERE
void setup() {
// Set the frame rate to 30 fps
frameRate(30)
// YOUR CODE GOES HERE
}
void draw() {
// YOUR CODE GOES HERE
// Save frames for making a GIF
if (saveFrames) {
saveFrame("frames/###.png");
}
}
Note that the template includes a boolean switch saveFrames
that controls if the saveFrame()
function at the end of the draw()
function will be executed. When saveFrames
is set to true, each frame generated by a call of the draw()
function will be saved to the folder frames/
in the project directory. You can then use the built-in movie maker (“Tools > Movie Maker”) to create an animated GIF. Also, the GIF standard does not support 60 fps, so we need to add frameRate(30)
to the setup()
function to set the frame rate to 30 fps.
bin/
folder) to “C:\Users\[USERNAME]\Documents\Processing\tools\MovieMaker\tool”You can use \n
to start a new line when calling text()
. For example,
text("Hello, World!\nThis is ______!", height / 2, width / 2)
will be rendered as
Hello, World!
This is ______!
textAlign()
to vertically center the text.textWidth()
, textAscent()
and textDecent()
useful in estimating the size of the text box. Note that these functions must run after you set the desired font size. Also note that sometimes it can be tricky to get the exact size of a text box in Processing, so feel free to make manual adjustments to the estimated values.