LoginSignup
2
1

More than 3 years have passed since last update.

P5.js 日本語リファレンス(clear)

Last updated at Posted at 2020-05-02

このページでは「P5.js 日本語リファレンス」 の clear関数を説明します。

clear()

説明文

バッファ内のピクセルをクリアします。この関数はキャンバスのみをクリアします。 createVideo() や createDiv() などの createXXX() 関数によって作成されたオブジェクトはクリアされません。メインのグラフィックスコンテキストとは異なり createGraphics() で作成された追加のグラフィックス領域のピクセルは全体的または部分的に透明にすることができます。この関数はすべてをクリアしてすべてのピクセルを 100% 透明にします。

構文

clear()

//マウスを押すと画面がクリアされます。
function setup(){
  createCanvas(300, 300) ;
}

function draw(){
  ellipse(mouseX, mouseY, 20, 20) ;
}

function mousePressed() {
  clear();
}

実行結果

著作権

p5.js was created by Lauren McCarthy and is developed by a community of collaborators, with support from the Processing Foundation and NYU ITP. Identity and graphic design by Jerel Johnson.

ライセンス

Creative Commons(CC BY-NC-SA 4.0) に従います。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1