Created
February 9, 2019 15:44
-
-
Save nataliefreed/363effc3da3f646a8e77d266cd9617be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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