Skip to content

Instantly share code, notes, and snippets.

@matt0rtega
Last active October 25, 2021 08:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matt0rtega/bbb61e5ef2c422b48dc29ed3a3229952 to your computer and use it in GitHub Desktop.
Save matt0rtega/bbb61e5ef2c422b48dc29ed3a3229952 to your computer and use it in GitHub Desktop.
PGraphics pg;
// We need to create variables for the width and height we want to use.
int scaleFactor = 2;
int w = 1080 * scaleFactor;
int h = 1920 * scaleFactor;
// In later versions of Processing, you need to use settings if you want to do any operations on the width and height
void settings(){
size(w / 8, h / 8);
}
void setup() {
pg = createGraphics(w, h);
}
void draw() {
background(150);
pg.beginDraw();
pg.background(150);
pg.ellipse(w/2, h/2, 100, 100);
pg.endDraw();
image(pg, 0, 0, width, height);
if(keyPressed){
if(key == 's') pg.save("image.png");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment