【Processing】リサージュ曲線を描画に使う
#Processing pic.twitter.com/kJpDV2ixiM
— 94 (@_94_94) November 21, 2018
つかれた
float degree; //角度 int[] a = new int[8]; void setup() { size(800, 800); background(0); degree = 0; for (int i = 0; i < 8; i++) { a[i] = ((2*(int)random(i+2)) )+ 1; //絶対奇数の整数にする } } void draw() { translate(width/2, height/2); //座標を中心に移動 float x = (20*a[0])* cos(radians(degree*a[1])); float y = (20*a[0])* sin(radians(degree*a[1])); float _x = x + (40*a[2])* cos(radians(degree*a[3])); float _y = y + (40*a[2])* sin(radians(degree*a[3])); float __x = _x + (40*a[4])* cos(radians(degree*a[5])); float __y = _y + (40*a[4])* sin(radians(degree*a[5])); float ___x = __x + (40*a[6])* cos(radians(degree*a[7])); float ___y = __x + (40*a[6])* sin(radians(degree*a[7])); stroke(255, 180, 210, 90) ; line(x, y, _x, _y); line(_x, _y, __x, __y); line(__x, __y, ___x, ___y); degree+=0.5; //角度を足す //一周したらストップ if (degree == 360) { save("save/save.jpg"); stop(); } }