P5.js Study 011

Generative Design with p5.js / Sketch P_2_0_02 を試しながらアレンジ。
元ネタ:https://editor.p5js.org/generative-design/sketches/P_2_0_02

新たに覚えたコマンドなど

mouseIsPressed
// The boolean system variable mouseIsPressed is true if the mouse is pressed and false if not.

mouseButton
// which mouse button was pressed last. 
// LEFT, RIGHT, or CENTER

push();
pop();
// The push() function saves the current drawing style settings and transformations, while pop() restores these settings.
// allow you to change drawing style setting temporarily

マウスの左ボタンを押下している間、多角形が描かれる。
X座標が半径に、Y座標が頂点の数と先の太さに連動している。
フレームレートとの兼ね合いで、カーソルを早く動かせば疎に、ゆっくり動かせば密に描かれる。

DELETEキーで消去されるが、消去するために複雑な処理は行わず、単に背景色で塗りつぶすだけというのがシンプルで良かった。

Leave a comment

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です