LoginSignup
0
0

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-05-10

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

focused

説明文

p5.j​​s プログラムが置かれているウィンドウが「フォーカスされている」かどうかを確認します。つまり、フォーカスされているとスケッチはマウスまたはキーボードの入力を受け入れます。この変数は、ウィンドウがフォーカスされている場合は "true"、フォーカスされていない場合は "false" です。

構文

focused

function draw() {
  background(200);
  noStroke() ;
  fill(0, 200, 0);
  ellipse(25, 25, 50, 50);

  // p5スケッチが含まれているウィンドウをクリックすると、赤色のクロスラインが表示されます
  if(focused){
    stroke(200, 0, 0);
    line(0, 0, 100, 100);
    line(100, 0, 0, 100);
  }
}

実行結果

著作権

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) に従います。

0
0
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
0
0