15
14

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.

CreateJSでcanvasに画像を読み込み表示する方法

Last updated at Posted at 2014-07-07

CreateJSを用いてcanvasに画像を読み込んで表示する方法です。

javascript
window.onload = function(){

	// Stageオブジェクトを作成
	// ※canvasタグのid名を引数に指定
	var stage = new createjs.Stage('canvas');
	
	// Bitmapオブジェクトを作成
	// ※画像ファイルパスを引数に指定
	var bitmap = new createjs.Bitmap('images/image_1.png');
	
	// stageにBitmapオブジェクトを配置
	stage.addChild(bitmap);
	
	// canvasの描画設定
	// ※30fpsで描画を繰り返す
	createjs.Ticker.setFPS(30);
	createjs.Ticker.addEventListener('tick', function(){
		stage.update();
	});

}

とりあえず描画のfpsは30にしておきました。

15
14
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
15
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?