我正在使用 EaselJS 在 Canvas 中创建动画背景。我想知道为什么一旦我将画布设置为窗口大小,我的精灵就会被缩放......图像看起来很拉伸......
$('body').append(''); $('#backgroundCanvas').height($(window).height()); $('#backgroundCanvas').width($(window).width());
var sprite = new createjs.SpriteSheet({
"animations":
{
"run": [0, 6, "run", frequency]},
"images": [url],
"frames":
{
"height": height,
"width":width,
"regX": 0,
"regY": 0,
"count": count
}
});
var item = new createjs.BitmapAnimation(sprite);
item.height = height;
item.width = width;
//item.scale = item.scaleY = item.scaleX= 0.5;
item.x = positionX;
item.y = positionY;
item.dirX = 1;
item.dirY = 1;
item.vX = 4;
item.vY = 4;
item.gotoAndPlay("run");
stage.addChild(item);