この記事を書いた人
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-user-profile-illustrationi-light-blue.png)
- クリエイティブコーディングで制作した作品と、上達のためにやったこと・学習過程を発信
- コンセプトは「クリエイティブコーディング1万時間の歩き方」
- 2024年にProcessingの構文のアウトプットを終え、2025年から作品制作開始(クリエイティブコーディングで作成した作品集)
目次
作品の画像とコード
![【作品No.34】写真のモザイク化を繰り返す【Processing 2025年2月13日】](https://watataku-artist-katsuyaku.com/wp-content/uploads/2025/02/photo-mosaic-repeats-34-eye-catching-image.jpg)
アニメーション。
// 参考にさせていただいたページとURL
// Processing クリエイティブ・コーディング入門 - コードが生み出す創造表現 150ページ
// マウスを移動させてモザイク化するのを、マウスを使わずに、自動でモザイク化するように工夫
PImage img;
void setup() {
size(1000, 1000);
img = loadImage("16, Landscape, Croatia, Dubrovnik.jpg");
img.resize(width, height);
}
void draw() {
background(0);
noStroke();
int period = 600;
float factor = abs(sin(TWO_PI * (frameCount % period) / period));
int step = int(map(factor, 0, 1, 1, 100));
for (int j = 0; j < height; j += step) {
for (int i = 0; i < width; i += step) {
color col = img.get(i, j);
fill(col);
rect(i, j, step, step);
}
}
}
作った感想
実際に撮影してきた写真を活かせるのが嬉しい。
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
それでは今日もレッツワクワクコーディング。