This commit is contained in:
Alexander Popov 2022-08-11 00:20:29 +03:00
parent 3dd2064c87
commit 398caf28b4
Signed by: iiiypuk
GPG Key ID: D8C9B59A9F04A70C
4 changed files with 37 additions and 0 deletions

22
src/01-start/app.js Normal file
View File

@ -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;
});
}

15
src/01-start/index.html Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>pixi - test</title>
<script type="text/javascript" src="/pixi.js"></script>
</head>
<body>
<div class="container">
<!-- -->
</div>
<script type="text/javascript" src="app.js"></script>
</body>
</html>

BIN
src/assets/skull.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
src/assets/spider-web.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB