23 lines
664 B
JavaScript
23 lines
664 B
JavaScript
|
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;
|
||
|
});
|
||
|
}
|