programmering:hat3-code
var t; var HALF_WIDTH; var HALF_HEIGHT; var OFFSET; function x1(k) { return -sin(4*PI*k/1000)+sin(t)*sin(t/3)/5; } function y1(k) { return -cos(2*PI*k/1000)+cos(t)*cos(t/3)/2; } function x2(k) { return -0.5*sin(8*PI*k/1000)+cos(t)/2; } function y2(k) { return -0.5*cos(4*PI*k/1000)+sin(t)/3; } function setup() { createCanvas(800,800); stroke(255); background(0); HALF_WIDTH=width/2; HALF_HEIGHT=height/2; OFFSET=0; //HALF_WIDTH; t=0; } function draw() { background(0); stroke(240,55); translate(HALF_WIDTH,HALF_HEIGHT*1.2); for (i=0; i<1000; i++) { line(HALF_WIDTH*0.8*x1(i),-0.8*HALF_HEIGHT*y1(i), HALF_WIDTH*0.8*x2(i),-0.8*HALF_HEIGHT*y2(i)); } t=t+0.1; }
programmering/hat3-code.txt · Last modified: 2023/10/21 19:19 by 127.0.0.1