2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Last updated at Posted at 2020-05-10

このページでは[「P5.js 日本語リファレンス」] (https://qiita.com/bit0101/items/91818244dc26c767a0fe) の windowResized関数を説明します。

windowResized()

説明文

windowResized() は、ブラウザウィンドウのサイズが変更されるたびに1回呼び出されます。これはキャンバスのサイズを変更したり、新しいウィンドウサイズに合わせてその他の調整を行ったりするのに適した関数です。

構文

windowResized()

例1

// ブラウザのウインドウサイズを変更すると、それに合わせて円のサイズが変わります。
function setup() {
  createCanvas(windowWidth, windowHeight);
}

function draw() {
  strokeWeight(windowWidth/20);
}

// ブラウザのウインドウサイズを変更すると、この関数が呼ばれます。
function windowResized() {
  resizeCanvas(windowWidth, windowHeight);
  ellipse(100, 100, windowWidth / 5);
}

実行結果

著作権

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?