按照视频代码完成后,功能根本没实现。

hanfei2610 HTML5 Canvas 应用 最后由 极客学院_ASMITA 于2016年08月18日回复

  • 1 回答
  • 1.1k 浏览
var canvas;
var stage;
var sp;
var img = new Image();

window.onload = function () {
canvas = document.getElementById("canvas");
stage = new createjs.Stage(canvas);

stage.addEventListener("stageMouseDown",clickCanvas);
stage.addEventListener("stageMouseMove",moveCanvas);

var data = {
images:["2.png","1.jpg"],
frames:{width:20,height:20,regX:10,regY:10}
};

sp = new createjs.Sprite(new createjs.SpriteSheet(data));
createjs.Ticker.setFPS(20);
createjs.Ticker.addEventListener("tick",tick);
};


function tick(e) {
var t = stage.getNumChildren();
for (var i=t-1;i>0;i--){
var s = stage.getChildAt(i);
s.vY +=2;
s.vX +=1;