Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//This example saves out two images of a star,
//a PNG (bitmap/raster) and a SVG (vector)
//SVG export: http://processing.org/reference/libraries/svg/
import processing.svg.*;
size(300, 300);
//begin creating the SVG
beginRecord(SVG, "vector.svg");
strokeWeight(6); //wider line
noFill(); //no fill color
//connect-the-dots star
beginShape();
vertex(90, 230);
vertex(251,112);
vertex(51, 112);
vertex(213, 229);
vertex(151, 39);
vertex(90, 230);
endShape(CLOSE);
//record and save the bitmap image
saveFrame("bitmap.png");
//record and save the SVG
//note: depends on corresponding beginRecord!
endRecord();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.