![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
今回の記事の目的はProcessingの「delay()
」を理解し、自分なりに使ってみること。
この記事を書いた人
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-user-profile-illustrationi-light-blue.png)
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-user-profile-illustrationi-light-blue.png)
- クリエイティブコーディングで制作した作品と、上達のためにやったこと・学習過程を発信
- コンセプトは「クリエイティブコーディング1万時間の歩き方」
- 2024年にProcessingの構文のアウトプットを終え、2025年から作品制作開始(クリエイティブコーディングで作成した作品集)
目次
【Processing】delay()について
- “delay”(ディレイ)の意味は、「遅延」や「遅れること」
delay()
関数は、指定したミリ秒だけプログラムを一時停止するために使われる
【Processing】delay()の使い方【画像とコード】
![【Processing】delay()の使い方【画像とコード】](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/11/processing-delay-function-guide-pause-in-milliseconds1.png)
![【Processing】delay()の使い方【画像とコード】](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/11/processing-delay-function-guide-pause-in-milliseconds1.png)
int count = 0; // カウントする変数
void setup() {
size(200, 200); // ウィンドウサイズを設定
background(255); // 背景を白に設定
}
void draw() {
count++; // カウントを1増やす
println("カウント: " + count); // カウントを表示
delay(500); // 0.5秒間一時停止
if (count == 10) { // カウントが10になったら
noLoop(); // プログラムを停止
println("終わり!"); // 終了メッセージを表示
}
}
【Processing】delay()を使ってみた感想
表示を遅らせることは、僕がする表現の中で役に立ちそう。
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
![](https://watataku-artist-katsuyaku.com/wp-content/uploads/2024/03/watataku-hukidashi-light-blue.png)
それでは今日もレッツワクワクコーディング。