xxxxxxxxxx
// This is a fork of svagozio's beautiful Triquid sketch.
// Just playing around here with some simple user controls!
// Move the mouse and click to adjust parameters! :)
/*
Triquid (trigonometric liquid)
#WCCChallenge Liquid 21.11.24
https://openprocessing.org/sketch/2460217/
This is a particular interval of the equation that
I have already partially used in the sketch from
which I made the "fork".
This trigonometric equation also has other different
and interesting intervals, but I highlight this one
because it is very "fluid" ... or rather "liquid"
*/
let j = 0;
let sequ_count = 0;
let plus_j = 0;
let plus_radnt = 0;
let scolor;
let ydiv=10000;
function setup() {
createCanvas(0.95 * windowWidth, 0.95 * windowHeight);
scolor = color(random(155, 255), random(155, 255), random(155, 255));
j = 2.3;
background(0);
}
function draw() {
plus_radnt = lerp(plus_radnt, map(mouseX, 0, width, 0.00001, 0.000001), 0.1);
plus_j = lerp(plus_j, map(mouseY, 0, height, -0.00003, 0.00003), 0.1);
ydiv = lerp(ydiv, map(mouseX, 0, width, 1000,1000000),0.1);
fill(0, 15);
noStroke();
rect(0, 0, width, height);
stroke(scolor);
strokeWeight(height / 300);
push();
translate(width / 2, height / 2);
let radnt = 0;
let ini = -width / 2;
j += plus_j;
for (let stp = ini; stp < 0; stp += 1) {
radnt += plus_radnt;
let x = stp + stp * sin(radnt);
if (j * x != HALF_PI) {
let y = pow(x, 3) * tan(j * x);
let x_for_canvas = x;
let y_for_canvas = y / ydiv;
point(x_for_canvas, y_for_canvas);
point(-x_for_canvas, y_for_canvas);
}
}
pop();
}
function mousePressed() {
j = random(-5, 5);
scolor = color(random(155, 255), random(155, 255), random(155, 255));
}
function keyPressed() {
if (keyCode == 49) j = -TAU;
if (keyCode == 50) j = -PI;
if (keyCode == 51) j = -HALF_PI;
if (keyCode == 52) j = 0;
if (keyCode == 53) j = HALF_PI;
if (keyCode == 54) j = PI;
if (keyCode == 55) j = TAU;
if (keyCode == 56) j = 3*PI;
if (keyCode == 56) j = 4*PI;
}