LoginSignup
1
2

More than 5 years have passed since last update.

CreateJS とりあえず画像表示

Posted at

CreateJS研究中。とりあえず画像表示できたのでメモ

sample.html
<canvas id="canvas" width="500" height="500"></canvas>
<script src="//code.createjs.com/easeljs-0.8.0.min.js"></script>
<script>
;(function(){

  document.addEventListener('DOMContentLoaded', function(){

    // image読み込んでキャンバス上の描画
    var canvas = document.getElementById('canvas');
    var stage = new createjs.Stage(canvas);
    var img = new createjs.Bitmap('img/hoge.png');
    img.x = 100;
    img.y = 100;
    stage.addChild(img);

    // 静止表示させるだけでもくるくる回さなきゃだめなんですね。
    createjs.Ticker.setFPS(60);
    createjs.Ticker.addEventListener('tick', update , false);

    function update(){
        stage.update();
    }

  }, false);

})();
</script>
1
2
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
1
2