xxxxxxxxxx
// This is the origin of the 3D visualization - created by jWilliam Dunn
// 2019.1014 tie node addition to frameRate
// 2023.1028 update to p5.js v1.8.0
// 2024.0914 update to p5.js v1.10.0, p5.easycam v.1.2.3, and minor tweaks for higher resolution
p5.disableFriendlyErrors = true;
let rootNode;
const nodes = [],
rt3 = Math.sqrt(3);
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
pixelDensity(2);
setAttributes('antialias', true);
createEasyCam({distance:400});
// suppress right-click context menu
document.oncontextmenu =()=> false;
strokeWeight(1);
rootNode = new Node(0, 0, 0, 1);
nodes.push(rootNode);
rootNode.addChildren(6);
}
function draw() {
background(0);
rotateY(frameCount*0.003);
if (frameCount % 180 === 60) rootNode.stimulate();
rootNode.draw();
}