processing

let x = 0; let y = 0; let spacing = 30; let sweight = 0.5; function setup() { createCanvas(windowWidth, windowHeight); background(0); } function draw() { let colr = random(255); let colg = random(255); let colb = random(255); noStroke(); if(random(1) < 0.5) { fill(colr, colg, colb); //triangle(x-spacing, y-spacing, x, y, x-spacing, y+spacing); stroke(colr, colg, colb); strokeWeight(sweight); strokeCap(PROJECT); strokeJoin(MITER); line(x, y, x+spacing, y+spacing); } else { fill(colr, colg, colb); //triangle(x+spacing, y+spacing, x, y, x+spacing, y-spacing); stroke(colr, colg, colb); strokeWeight(sweight); strokeCap(PROJECT); strokeJoin(MITER); line(x, y+spacing, x+spacing, y); } x = x + spacing; sweight = sweight + 0.02; if(x > width) { x = 0; y = y + spacing; } }

Date de dernière mise à jour : 24/05/2023

  • Aucune note. Soyez le premier à attribuer une note !

Ajouter un commentaire

Anti-spam