吸い込まれる手書き風の形 Form of handwritten wind sucked in
吸い込まれていく手書き風四角形です。 プログラムを書きかえれば、三角形にもできます。 画像は使用せず、プログラムで手書き風四角形を描いています。
What is sucked in is a handwritten wind square. When rewriting a program, you can also make it a triangle. Draw a handwritten-style rectangle programmatically without using images.
Download zip file here ↓
ソースコードは、こちら↓Source code is here
boolean sec;
int fc = 0;
float n = 0;
void tegakirect(float xx, float yy, float sxx, float syy) {
strokeWeight(1);
int x = int(xx);
int y = int(yy);
int sx = int(sxx);
int sy = int(syy);
float a = 0.1;
float w = 2;
float temp = n;
int t = 5;
for (int i = x; i < x+sx-t; i += t) {
line(i, y+(noise(n)*(w*2)-w), i+t, y+(noise(n+a)*(w*2)-w));
n += a;
}
for (int i = x; i < x+sx-t; i += t) {
line(i, y+(noise(n)*(w*2)-w)+sy, i+t, y+(noise(n+a)*(w*2)-w)+sy);
n += a;
}
for (int i = y; i < y+sy-t; i += t) {
line(x+(noise(n)*(w*2)-w), i, x+(noise(n+a)*(w*2)-w), i+t);
n += a;
}
for (int i = y; i < y+sy-t; i += t) {
line(x+(noise(n)*(w*2)-w)+sx, i, x+(noise(n+a)*(w*2)-w)+sx, i+t);
n += a;
}
n = temp;
sx += 1;
sy += 1;
//if (sec) {
n = random(32);
//sec = false;
//}
}
boolean sec() {
fc++;
if (fc > frameRate/10) {
sec = true;
fc = 0;
}
return sec;
}
void setup() {
frameRate(60);
//noStroke();
stroke(0);
size(720, 480);
//noSmooth();
}
int a;
float x = 15;
float y = 30;
float xs;
float ys;
float s = 10;
void draw() {
background(255);
/*
tegakirect(x-(s/2), y-s, s, s);
//x++;
x += xs/(((s-10)/10)+1);
y += ys/(((s-10)/10)+1);
ys += 0.1;
xs /= 1.1;
if (y > 470/1000){
if (y > 480)ys = -0.3;
if (x > mouseX)xs -= 0.4;
if (x < mouseX)xs += 0.4;
}
//if (y > mouseY && y > 478)ys = ((mouseY-y)/60);
s *= 1.001;
*/
/*
for (int f = 0; f < 48/8; f++) {
for (int i = 0; i < 72/8; i++) {
tegakirect(i*80+2,f*80+2,80-4,80-4);
}
}
*/
for (int i = a; i < 480; i += 40) {
tegakirect(0+i/2, 0+i/2, 720-i, 480-i);
}
a++;
if(a >= 40)a = 0;
println(frameRate);
sec();
}