CodingTrain / CodingTrain/Suggestion-Box
P5.js - Dealing with canvas in the background
- 主要言語
- 言語のデータがありません
- スター
- 570
- フォーク
- 85
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Hi, for one of my own project, I needed to realize a full screen animation (character walking on a terrain made of tiles) with dom elements as a user interface. My problem soon became clear : if my canvas was full screen, I couldn't access the dom elements layered "on top" of the canvas (click buttons and such was impossible) .
I found a solution myself, but I believe there are others and would love to see how you'd handle it. I really struggled myself, and I thinks it's a problem (although not a hard one) that is sufficient for a small video in the dom playlist.
My solution :
//________________________________________________________________
var canvas;
var domElement;
function setup(){
canvas = createCanvas(windowWidth, windowHeight)
canvas.position(0,0);
domElement = createButton('You can't click me');
domElement.style("height", "100px");
domElement.style("width", "100px");
domElement.position(0,0));
/*Using this line, the button is clickable. Good thing is, the canvas' surface which is not covered by a dom element is still clickable. I'm literally using this all the time. Allows for easy UI making. */
canvas.style("z-index", "-1");
}
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
この issue では、フルスクリーンの p5.js キャンバス、DOM ボタン、createCanvas、windowWidth、windowHeight、canvas.position、canvas.style について言及されていますが、リポジトリのファイルやテストは指定されていません。まず既存の DOM プレイリストの資料を確認し、キャンバスと DOM のレイヤリングに関するガイダンスが動画のトピックとして文書化された時点で完了とみなしてください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- content, documentation, web-dev
- issue の種類
- ドキュメント
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100