xxxxxxxxxx
43
/*
----- Coding Tutorial by Patt Vira -----
Name: Oscillating Hexagons (Inspired by Bees and Bombs)
Video Tutorial: https://youtu.be/g3A9ZPiOlwU
Connect with Patt: @pattvira
https://www.pattvira.com/
----------------------------------------
*/
let sides = 6; let r = 18; let dotSize = 8;
let layers = 5;
let hexPatterns = []; let num = 3;
let step = 0.08; let scl = 0.55;
let c;
function setup() {
createCanvas(400, 400);
c = [color(0, 0, 255), color(255, 0, 0), color(0, 255, 0)];
for (let i=0; i<num; i++) {
let sp = (i+1);
hexPatterns.push(new Hexagon(sp, c[i]));
}
}
function draw() {
background(240);
translate(width/2, height/2);
fill(0);
ellipse(0, 0, dotSize, dotSize);
push();
blendMode(DIFFERENCE);
for (let i=0; i<num; i++) {
hexPatterns[i].update();
}
pop();
}