xxxxxxxxxx
88
const flowerCount = 1;
const strokeColor = "#FF0C2D";
const length = 20
const h = length / 2 * Math.sqrt(3)
const flowerSize = length * 2 + h * 2
const flowerTranslateX = flowerSize/2 + length/2
const flowerTranslateY = length/2 + h
const flowerTranslateX2 = flowerSize + length
const flowerTranslateY2 = length/2 + h
const flowerSizeCalc = length + h / 2
function setup() {
createCanvas(960, 540);
stroke(strokeColor);
noFill();
noLoop()
}
function flower() {
const cX = 0;
const cY = 0;
for ( let r = 0; r < 1; r++ ){
// circle( cX, cY, 10 )
// triangle
beginShape(LINES);
vertex(cX, cY);
vertex(length/2,h);
vertex(length/2,h);
vertex(-length/2,h);
/*vertex(-length/2,h);
vertex(-length/2,h+length);*/
/*vertex(length/2,h);
vertex(length/2,h+length);
vertex(-length/2,h+length);
vertex(length/2,h+length);
vertex(-length/2,h+length);
vertex(-length/2-h,h+length/2);*/
endShape();
rotate(60 * PI/180);
}
}
function draw() {
background(255);
translate(width/2,height/2)
flower()
/*
for( let ht = 0; ht <= (height/flowerSizeCalc) + 2; ht++ ){
for( let w = 0; w < (width/flowerSizeCalc ); w++ ){
push()
translate( flowerTranslateX2 * w, flowerTranslateY2 * ht )
flower()
pop()
}
if( ht % 2 == 0 ){
translate( flowerTranslateX2 / -2, 0 )
}else{
translate( flowerTranslateX2 / 2, 0 )
}
}
*/
}