xxxxxxxxxx
79
var x, y, x1, y1, x2, y2;
var pg; //graphics
function setup() {
createCanvas(600, 600);
pg = createGraphics(600, 600);
background(6, 0, 76);
noStroke();
x = width / 2;
y = height / 2;
frameRate(3);
}
function draw() {
// var i identifies the number of lines - control density of flower with it!
for (var i = 0; i < 50; i++) {
//yellow
stroke(244, 217, 102, 30);
strokeWeight(2);
//angle
var t = random(2 *PI);
// line length?
var r = random(random(250, 300), random(350, 400));
x1 = x + sin(t) * r;
y1 = x + cos(t) * r;
line(x, y, x1, y1);
// for (var j = 0; j < 5; j++) {
// stroke(255, 150, 10);
// x2 = random(-2, 2);
// y2 = random(-2, 2);
// line(x1, y1, x1 + x2, y1 + y2);
// }
}
for (var q = 0; q < 50; q++) {
//red
pg.stroke(98, 9, 7, 50);
pg.strokeWeight(1);
//angle
var e = random(2 *PI);
// line length?
var w = random(random(35, 70), random(100, 150));
x1 = x + sin(e) * w;
y1 = x + cos(e) * w;
pg.line(x, y, x1, y1);
// for (var j = 0; j < 5; j++) {
// stroke(255, 150, 10);
// x2 = random(-2, 2);
// y2 = random(-2, 2);
// line(x1, y1, x1 + x2, y1 + y2);
// }
}
for (var a = 0; a < 80; a++) { //noprotect
//white
pg.stroke(255);
pg.strokeWeight(0.1);
var s = random(2 *PI);
var d = random(random(20, 50), random(75, 100));
x1 = x + sin(s) * d;
y1 = x + cos(s) * d;
pg.line(x, y, x1, y1);
// for (var j = 0; j < 5; j++) {
// stroke(255, 150, 10);
// x2 = random(-2, 2);
// y2 = random(-2, 2);
// line(x1, y1, x1 + x2, y1 + y2);
// }
}
image(pg, 0, 0);
}