Skip to content

Commit c560146

Browse files
committed
commit old
0 parents  commit c560146

9 files changed

+25240
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/*

assets/theMan.png

13.5 KB
Loading

index.html

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
</head>
5+
<body>
6+
</body>
7+
</html>

main.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// The application will create a renderer using WebGL, if possible,
2+
// with a fallback to a canvas render. It will also setup the ticker
3+
// and the root stage PIXI.Container.
4+
const app = new PIXI.Application();
5+
6+
// The application will create a canvas element for you that you
7+
// can then insert into the DOM.
8+
document.body.appendChild(app.view);
9+
10+
// load the texture we need
11+
PIXI.Loader.shared.add('man', './assets/theMan.png').load((loader, resources) => {
12+
13+
// This creates a texture from a 'bunny.png' image.
14+
const bunny = new PIXI.Sprite(resources.bunny.texture);
15+
16+
// Setup the position of the bunny
17+
bunny.x = app.renderer.width / 2;
18+
bunny.y = app.renderer.height / 2;
19+
20+
// Rotate around the center
21+
bunny.anchor.x = 0.5;
22+
bunny.anchor.y = 0.5;
23+
24+
// Add the bunny to the scene we are building.
25+
app.stage.addChild(bunny);
26+
27+
// Listen for frame updates
28+
app.ticker.add(() => {
29+
// each frame we spin the bunny around a bit
30+
bunny.rotation += 0.01;
31+
});
32+
});

0 commit comments

Comments
 (0)