#Codevember day13: Black Hole
//クリフォード・アトラクタ // Xn+1 = sin( a * Yn ) + c * cos( a * Xn ) // Yn+1 = sin( b * Xn ) + d * cos( b * Yn ) //係数 let a = 1.374; let b = -1.764; let c = 1.582; let d = 1.056; //プロットする点,漸化式のn+1 let dx, dy; //点と初期値 let x = 0; let y = 0; function setup() { createCanvas(windowWidth, windowHeight); background(0); translate(width / 2, height / 2); for (let i = 0; i < 500000; i++) { //2-3行目の公式をそのまま使う dx = sin(a * y) + c * cos(a * x); dy = sin(b * x) + d * cos(b * y); x = dx; y = dy; stroke(255, 45); point(x * width / 6, y * width / 6); } }