radiance: simulation clock x1.5 (currents, spin, lifecycles, fluid) and cursor force +30%
This commit is contained in:
@ -799,7 +799,7 @@ export function startOrb(canvas, { onReady } = {}) {
|
||||
document.documentElement.addEventListener('mouseleave', onLeave);
|
||||
|
||||
// fluid tuning
|
||||
const FORCE = 1500;
|
||||
const FORCE = 1950;
|
||||
const RADIUS = 0.008;
|
||||
const VEL_DISSIPATION = 1.5;
|
||||
const DYE_DISSIPATION = 1.1;
|
||||
@ -891,6 +891,7 @@ export function startOrb(canvas, { onReady } = {}) {
|
||||
into(dye.write); tri(); dye.swap();
|
||||
}
|
||||
|
||||
const SPEED = 1.5;
|
||||
let simT = reduced ? 8 : 0;
|
||||
let last = performance.now();
|
||||
let ready = false;
|
||||
@ -902,13 +903,14 @@ export function startOrb(canvas, { onReady } = {}) {
|
||||
}
|
||||
|
||||
function frame(now) {
|
||||
const dt = Math.min((now - last) / 1000, 1 / 30) || 1 / 60;
|
||||
// everything (currents, spin, lifecycles, the cursor fluid) runs on one sped-up simulation clock
|
||||
const dt = (Math.min((now - last) / 1000, 1 / 30) || 1 / 60) * SPEED;
|
||||
last = now;
|
||||
// simulation clock: advances by clamped steps, so a backgrounded tab resumes without a jump
|
||||
if (!reduced) simT += dt;
|
||||
const t = simT;
|
||||
par.cx += (par.x - par.cx) * 0.04;
|
||||
par.cy += (par.y - par.cy) * 0.04;
|
||||
par.cx += (par.x - par.cx) * 0.04 * SPEED;
|
||||
par.cy += (par.y - par.cy) * 0.04 * SPEED;
|
||||
const ox = par.cx * 10, oy = par.cy * 6;
|
||||
|
||||
if (interactive) {
|
||||
|
||||
Reference in New Issue
Block a user