-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathease.html
96 lines (69 loc) · 2.49 KB
/
ease.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<title>Studio3</title>
<meta name="viewport" content="width=device-width, user-scalable=0, maximum-scale=1"/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon" href="icon.png" />
</head>
<body style="margin:0;background: #333">
<canvas id="canvas" height="600" width="800" style="cursor:pointer;margin: 0 auto;display: block;outline:1px solid #111;"></canvas>
</body>
<script src="studio-compiled.js"></script>
<script>
var stage = new Studio.Stage("canvas",{webgl:0});
stage.color.setFromHex('#222')
// var easeBox = function(type,y){
// this.x = 100;
// this.y = y;
// this.width = 20;
// this.height = 20;
// this.color.setFromHex('#00FF00');
// stage.addChild(this);
// stage.addTween(this, type , {x: 700}, 5000).to(type,{y:100}, 5000);
// }
// Studio.inherit(easeBox, Studio.Rect);
// stage.addChild(new easeBox('linear', 20))
// stage.addChild(new easeBox('quadIn', 60))
// stage.addChild(new easeBox('quadOut', 100))
// stage.addChild(new easeBox('quadInOut', 140))
// stage.addChild(new easeBox('snap', 180))
// stage.addChild(new easeBox('backOut', 220))
// stage.addChild(new easeBox('bounceOut', 260))
// stage.addChild(new easeBox('elasticOut', 300))
// stage.addChild(new easeBox('chillInOut', 340))
var rect = new Studio.Rect({x:20,y:20, width:15, height: 15})
rect.color = new Studio.Color(155,0,250,1)
stage.addChild(rect);
// First we need to create a tween object that can be reused.
// By making it a variable we can refrence it in multiple ways.
var TweenChain = stage.createTween(rect,'linear',{x:500}, 4000);
// Now we can start building a chain.
TweenChain.then("bounceOut",{y:100}, 1000).then("quadOut",{x: 20},1000);
TweenChain.next.next.then("chillInOut",{y: 20},1000);
TweenChain.last().completeLoop(TweenChain);
stage.playTween(TweenChain);
var Rockster_image = new Studio.Image("assets/rockster.png")
Rockster_image.addSlice({
Shoulder: {
x: 306,
y:12,
width: 62,
height: 49
}
});
var Rockster = new Studio.Sprite({
image: Rockster_image,
x: 100,
y: 100,
width: 62,
height: 49,
slice: 'Shoulder'
}
)
Rockster.bob = stage.createTween(Rockster,'chillInOut',{y:105},1000).loop(true)
stage.addChild(Rockster);
stage.playTween(Rockster.bob)
Studio.start();
</script>
</html>