start
This commit is contained in:
parent
3dd2064c87
commit
398caf28b4
22
src/01-start/app.js
Normal file
22
src/01-start/app.js
Normal 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
15
src/01-start/index.html
Normal 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
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
BIN
src/assets/spider-web.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
Loading…
Reference in New Issue
Block a user