diff --git a/src/01-start/app.js b/src/01-start/app.js new file mode 100644 index 0000000..9e31001 --- /dev/null +++ b/src/01-start/app.js @@ -0,0 +1,22 @@ +window.onload = function() { + let app = new PIXI.Application({ width: 640, height: 360 }); + document.body.appendChild(app.view); + let elapsed = 0.0; + + let spriteSkull = PIXI.Sprite.from('/assets/skull.png'); + let spriteSpiderWeb = PIXI.Sprite.from('/assets/spider-web.png'); + spriteSpiderWeb.y = (360 / 2) - (spriteSpiderWeb.height / 2) + + app.stage.addChild(spriteSkull); + app.stage.addChild(spriteSpiderWeb); + + app.ticker.add((delta) => { + elapsed += delta; + spriteSkull.x = 100.0 + Math.cos(elapsed/50.0) * 100.0; + }); + + app.ticker.add((delta) => { + elapsed += delta; + spriteSpiderWeb.x = 100.0 + Math.cos(elapsed / 50.0) * 100.0; + }); +} diff --git a/src/01-start/index.html b/src/01-start/index.html new file mode 100644 index 0000000..1b262e9 --- /dev/null +++ b/src/01-start/index.html @@ -0,0 +1,15 @@ + + +
+ + +