This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathindex6.html
65 lines (53 loc) · 1.93 KB
/
index6.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
<!DOCTYPE html>
<html>
<head>
<script src="pixi.js"></script>
<script src="../bin/pixi-ui.js"></script>
<title></title>
<meta charset="utf-8" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />
</head>
<body>
<style>
body { margin: 0; padding: 0; background-color: #000000; }
.rendererView { position: absolute; display: block; width: 100%; }
</style>
<script type="text/javascript">
var app = new PIXI.Application(800, 600, { backgroundColor: 0x020222, autoStart: true });
document.body.appendChild(app.view);
var uistage = new PIXI.UI.Stage(800, 600);
//input
var input = new PIXI.UI.TextInput({
background: new PIXI.UI.Sprite(PIXI.Texture.WHITE),
value: "ZZZZZZZZZZ",
style: { fontSize: 15, fill: "#ffffff" },
lineHeight: 23,
paddingLeft: 10,
width: 200,
height: 30
});
input.background.alpha = 0.2;
input.x = 100;
input.y = 100;//
//button
var button = new PIXI.UI.Button({
background: new PIXI.UI.Sprite(PIXI.Texture.WHITE),
text: new PIXI.UI.DynamicText("hello"),
width: 200,
height: 50
});
button.background.alpha = 0.5;
button.x = 100;
button.y = 140;
button.on("hover", function (over) {
this.text.value = over ? "World!" : "Hello";
var ease = over ? PIXI.UI.Ease.Bounce.BounceOut : PIXI.UI.Ease.Circ.CircOut;
PIXI.UI.Tween.to(button.background, 0.5, { scale: over ? 1.15 : 1, tint: over ? "#d8ff6e" : "#ffffff" }, ease);
console.log(over);
});
app.stage.interactive = true;
app.stage.addChild(uistage);
uistage.addChild(input, button);
</script>
</body>
</html>