P5.js 日本語リファレンス(createCanvas)
このページでは「P5.js 日本語リファレンス」 の createCanvas関数を説明します。
createCanvas()
説明文
スケッチにキャンバス要素を作成してその寸法をピクセル単位で設定します。このメソッドは、セットアップの開始時に一度だけ呼び出す必要があります。スケッチで createCanvas() を複数回呼び出すと非常に予測できない動作が発生します。複数の描画キャンバスが必要な場合は createGraphics を使用できます(デフォルトでは非表示ですが表示できます)
システム変数 width と height は, この関数に渡されるパラメータによって設定されます。 createCanvas() を使用しない場合、ウィンドウのデフォルトサイズは100x100ピクセルになります。
キャンバスを配置するその他の方法については, キャンバスの配置Wikiページを参照してください。
構文
createCanvas(w, h, [renderer])
パラメタ
w
Number:キャンバスの幅h
Number:キャンバスの高さrenderer
定数:P2D または WEBGL(オプション)
戻り値
p5.Renderer
例
function setup() {
createCanvas(100, 50);
background(200, 250, 0); // 黄緑色
line(0, 0, width, height);
}
実行結果
著作権
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) に従います。
Author And Source
この問題について(P5.js 日本語リファレンス(createCanvas)), 我々は、より多くの情報をここで見つけました https://qiita.com/bit0101/items/6c1a4f2d8c9b2c91cef8著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .