Skip to content

Commit 8b6e2af

Browse files
author
sandru
committed
cleanup
0 parents  commit 8b6e2af

File tree

9 files changed

+47720
-0
lines changed

9 files changed

+47720
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
media/images/bunny.png:Zone.Identifier

dist/bundle.js

Lines changed: 44198 additions & 0 deletions
Large diffs are not rendered by default.

index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
5+
<meta charset="utf-8" />
6+
<title>SAPUI5 Walkthrough</title>
7+
<script src="dist/bundle.js"></script>
8+
</head>
9+
<body></body>
10+
</html>

media/images/bunny.png

80 KB
Loading

package-lock.json

Lines changed: 3413 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "pixi-play-test",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.ts",
6+
"scripts": {
7+
"start": "start"
8+
},
9+
"author": "sandru",
10+
"license": "ISC",
11+
"dependencies": {
12+
"pixi.js": "^6.4.2"
13+
},
14+
"scripts": {
15+
"build": "webpack --config webpack.config.js",
16+
"start": "webpack --config webpack.config.js -w"
17+
},
18+
"devDependencies": {
19+
"ts-loader": "^9.3.1",
20+
"typescript": "^4.7.4",
21+
"webpack": "^5.73.0",
22+
"webpack-cli": "^4.10.0"
23+
}
24+
}

src/index.ts

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

tsconfig.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"outDir": "./dist/",
4+
"sourceMap": true,
5+
"noImplicitAny": true,
6+
"module": "es6",
7+
"target": "es5",
8+
"jsx": "react",
9+
"allowJs": true,
10+
"moduleResolution": "node"
11+
}
12+
}

webpack.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
entry: './src/index.ts',
5+
devtool: 'inline-source-map',
6+
mode: 'development',
7+
module: {
8+
rules: [
9+
{
10+
test: /\.tsx?$/,
11+
use: 'ts-loader',
12+
exclude: /node_modules/,
13+
},
14+
],
15+
},
16+
resolve: {
17+
extensions: ['.tsx', '.ts', '.js'],
18+
},
19+
output: {
20+
filename: 'bundle.js',
21+
path: path.resolve(__dirname, 'dist'),
22+
},
23+
};

0 commit comments

Comments
 (0)