-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
67 lines (54 loc) · 1.68 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>PIXI Trial</title>
<style>
* { padding: 0; margin: 0}
</style>
</head>
<script src="scripts/pixi.min.js"></script>
<body>
<script type="text/javascript">
let Application = PIXI.Application,
loader = PIXI.loader,
resources = PIXI.loader.resources,
Sprite = PIXI.Sprite;
let type = "WebGL";
if(!PIXI.utils.isWebGLSupported()) {
type = "canvas";
}
PIXI.utils.sayHello(type);
let app = new Application({
width: 256,
height: 256,
antialias: true,
transparent: false,
resolution: 1
});
app.renderer.backgroundColor = 0x061639;
app.renderer.autoResize = true;
app.renderer.view.style.position = "absolute";
app.renderer.view.style.display = "block";
app.renderer.resize(window.innerWidth, window.innerHeight);
document.body.appendChild(app.view);
loader
.add("images/cat.png")
.load(setup);
function setup () {
let cat = new Sprite(loader.resources["images/cat.png"].texture);
cat.x = 96;
cat.y = 96;
cat.width = 80;
cat.height = 120;
cat.scale.x = 2;
cat.scale.y = 2;
cat.rotation = 0.5;
app.stage.addChild(cat);
}
</script>
</body>
</html>