87
79

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 5 years have passed since last update.

背景をCanvasにする

Posted at

背景をCanvasにしてグリグリ動かすとインパクトがあって良い。(これとかこういう感じ)
少し工夫しないとCanvasが前面に来てボタンの操作とかができなくなるので、下記のようなHTML/CSSを書いてやる。

<body>
  <canvas id="canvas"></canvas>
  <section id="body>
    /* 実際のbodyはここに書く */
  </section>
</body>
#canvas { position:fixed;    top:0; left:0; width:100%; height:100%; }
#body   { position:absolute; top:0; left:0; }

キャンバスサイズを小さめにしておくと拡大されてボワッとした感じになるけどそのぶん軽量。

var canvas = document.getElementById("canvas");
canvas.width  = 480;
canvas.height = 320;
87
79
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
87
79

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?