/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.lnf65ge$HoP/rev.1330
*
* authors:
* Antti Leppänen
*
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// This sketch builds on a prior work, "Untitled Sketch", created by [Antti Leppänen]
// http://sketchpad.cc/sp/pad/view/ro.o5PMLDSZKbo/rev.0
// Pressing Control-R will render this sketch.
int i = 0;
//static int sizeX = 500;
void setup() { // this is run once.
// set the background color
background(255);
// canvas size (Integers only, please.)
size(500, 300, P3D);
// smooth edges
smooth();
// limit the number of frames per second
frameRate(30);
// set the width of the line.
strokeWeight(12);
// camera(width/2.0, height/2.0, (height/2.0) / tan(PI*60.0 / 360.0), //width/2.0, height/2.0, 0, 0, 1, 0);
}
void drawHeart() {
beginShape();
vertex(0,0);
bezierVertex( 0,-30, -50, -30, -50, 0);
bezierVertex( -50, 30, 0, 35, 0, 60 );
bezierVertex( 0, 35, 50, 30, 50, 0 );
bezierVertex( 50,-30, 0,-30, 0, 0 );
endShape();
}
void draw() { // this is run repeatedly.
// console.log(width/2,height/2);
//camera(eyeX, eyeY, eyeZ,centerX, centerY, centerZ,upX, upY, upZ)
// set the color
int heartRed = 55 + random(200);
if(heartRed < 150) {
stroke(255, 255, 255, 50);
fill(255,255,255,50);
} else {
stroke(heartRed, 0, 50);
fill(heartRed,0,0,50);
}
// box(random(100));
// draw the line
// line(i, 0, random(0, width), height);
//noFill();
pushMatrix();
translate(random(width),random(height));
rotate(radians(random(180)));
drawHeart(width/2,height/2);
console.log(frameCount, frameRate);
// move over a pixel
if (i < width) {
i++;
} else {
i = 0;
}
}