この記事を書いた人

- クリエイティブコーディングで制作した作品と、上達のためにやったこと・学習過程を発信
- コンセプトは「クリエイティブコーディング1万時間の歩き方」
- 2024年にProcessingの構文のアウトプットを終え、2025年から作品制作開始(クリエイティブコーディングで作成した作品集)
目次
作品の画像とコード

アニメーション。
// 参考にさせていただいたページとURL
// 第6回: 画像の分析・再合成 (画像データ、ピクセル、ラスタ画像)
// https://yoppa.org/geidai_media1_18/8916.html
PImage img;
void setup() {
size(1000, 1000);
img = loadImage("179, Landscape, Spain, Arcasal de fuan.jpg");
img.resize(width, height);
background(0);
}
void draw() {
noStroke();
for (int i = 0; i < 10000; i++) {
PVector location = new PVector(random(width), random(height));
color col = img.get(int(location.x), int(location.y));
fill(col, 127);
float brightness = red(col) + green(col) + blue(col);
float size = map(brightness, 0, 255 * 3, 0, 60); // サイズの最大値を60に設定
drawTriangle(location.x, location.y, size);
}
}
void drawTriangle(float x, float y, float s) {
beginShape();
vertex(x, y - s / 2);
vertex(x - s / 2, y + s / 2);
vertex(x + s / 2, y + s / 2);
endShape(CLOSE);
}

それでは今日もレッツワクワクコーディング。