xxxxxxxxxx
var screenSize;
var gB;
var gBRes = 2048;
var maxDistortion;
function setup() {
sizeWindow();
pixelDensity(1);
createCanvas(screenSize, screenSize);
colorMode(HSB, 360);
initiate();
gB = createGraphics(gBRes, gBRes);
gB.colorMode(HSB, 360);
gB.rectMode(CENTER);
maxDistortion = gBRes * 0.2;
noSmooth();
}
function initiate() {}
function draw() {
gB.clear();
gB.translate(gBRes * 0.5, gBRes * 0.5);
gB.stroke(0);
gB.strokeWeight(gBRes * 0.00125);
for (var i = 0; i <= 4; i += 0.0012) {
gB.push();
var radius = map(i, 0, 4, gBRes * 0.0125, gBRes * 0.75);
var mappedI = map(i, 0, 1, 0, TAU * 6);
var lineLength = map(i, 0, 1, 20, 20);
var xPos = radius * cos(mappedI);
var yPos = radius * sin(mappedI);
gB.translate(xPos, yPos);
gB.rotate(mappedI + PI / 2);
gB.line(0, 0, 0, lineLength);
gB.pop();
}
// Render image to canvas
background(360);
image(gB, 0, 0, width, height);
noLoop();
}
function sizeWindow() {
screenSize = min(windowWidth, windowHeight);
}
function windowResized() {
sizeWindow();
resizeCanvas(screenSize, screenSize);
}
function mouseClicked() {
initiate();
}