Processing

Create a shape for later cutting or printing:

 

Code:

//Import librarie
import org.philhosoft.p8g.svg.P8gGraphicsSVG;

//Define an SVG object
P8gGraphicsSVG svg;

float noiseCounterA = random(100);
float noiseCounterB = random(100);
float x = 0;
float y = 0;

void setup(){

size(1200,1200);
x = width/2;
y = height/2;
svg = (P8gGraphicsSVG) createGraphics(width, height, P8gGraphicsSVG.SVG, “motifG.svg”);
beginRecord(svg);
println(“Use letter S to save image and letter Q to quit the sketch”);

}

void draw(){

x += 4 * noise(noiseCounterA) -2;
y = 400 * noise(noiseCounterB);
noStroke();
fill(random(255),random(255),random(255));
ellipse(x,y,y*.25,y*.25);
//increment counters

noiseCounterA += .01;
noiseCounterB += .0125;

}
//Fonction to use the keyboard
void keyPressed()
{
if (key == ‘s’)
{
svg.endRecord();
println(“Saved.”);
}
else if (key == ‘q’)
{
svg.clear();
exit();
}
}motifG

Leave a reply