xxxxxxxxxx
63
// Triangles
let ww,wh, TSize, TCount, ori, cp
function setup() {
//noLoop()
noStroke()
angleMode(DEGREES)
ww=windowWidth
wh=windowHeight
if (ww>wh){
createCanvas(wh, wh)
TSize=wh*0.05
TCount=wh/TSize
cp=wh/2
ori='wh'
} else {
createCanvas(ww, ww)
TSize=ww*0.05
TCount=ww/TSize
cp=ww/2
ori='ww'
}
print ('ww',ww, 'wh',wh, 'TSize',TSize, 'TCount', TCount, 'ori',ori)
}
let ro = 0
function draw() {
background(0)
fill('white')
doTri()
ro+=1
push()
translate(cp,cp)
t.rotate(ro)
doTri()
pop()
}
let t
function doTri(){
t = beginShape()
for(let y=0;y<TSize;y++){
let yPoz=y*TSize
for(let x=0;x<TCount;x++){
t.vertex(TSize*x, yPoz+TSize)
t.vertex(TSize/2+(TSize*x), yPoz)
t.vertex(TSize+(TSize*x), yPoz+TSize)
} // end x loop
t.vertex(TSize/2,yPoz+TSize) // set to start of next line
t.vertex(0, yPoz+TSize)
} // end y loop
t.endShape(CLOSE)
// print('t',t._renderer )
}