-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGamble.html
208 lines (202 loc) · 5.06 KB
/
Gamble.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gamble</title>
<script src="js/jQuery.js"></script>
<script src="js/jquery_ui.js"></script>
<script>
$(window).load(function(){
$('#square').addClass('righty');
$('#ball').addClass('drop');
$('#square').delay(2000).animate({
left: 100,
top: 50,
height: 100,
width: 120
}, 300, 'linear', function(){
$('#square').animate({
left: 250,
top: 100,
height: 100,
width: 120
}, 300, 'linear', function(){
$('#square').animate({
left: 400,
top: 200,
height: 90,
width: 110
}, 300, 'linear', function(){
$('#square').animate({
left: 550,
top: 250,
height: 90,
width: 110
}, 300, 'linear');
});
});
});
$('#square2').delay(2000).animate({
left: 450,
top: 175,
height: 100,
width: 120
}, 300, 'linear', function(){
$('#square2').animate({
left: 250,
top: 100,
height: 100,
width: 120
}, 300, 'linear', function(){
$('#square2').animate({
left: 100,
top:200,
height: 90,
width: 110
}, 300, 'linear', function(){
$('#square2').animate({
left: 50,
top: 250,
height: 90,
width: 110
}, 300, 'linear');
});
});
$('#square').removeClass('righty');
$('#ball').removeClass('');
});
$('#square').mouseup(function(){
if($('#square').position().left==550 && $('#square').position().top==250){
$('#square').addClass('lefty');
$('#square2').addClass('righty');
$('#ball').addClass('ballL');
setTimeout(function(){
alert('You Lose. Try Again.');
window.location='Gamble.html';
}, 2000);
}else{
$('#ball').removeClass('drop');
$('#ball').css('left', $('#square').position().left+20);
$('#ball').css('top', $('#square').position().top+80);
alert('You win!');
window.location='legolas.html';
}
});
$('#square2').mouseup(function(){
if($('#square2').position().left==50 && $('#square2').position().top==250){
$('#square').addClass('lefty');
$('#square2').addClass('righty');
$('#ball').addClass('ballR');
setTimeout(function(){
alert('You Lose. Try Again.');
window.location='Gamble.html';
}, 2000);
}else{
$('#ball').removeClass('drop');
$('#ball').css('left', $('#square2').position().left+20);
$('#ball').css('top', $('#square2').position().top+80);
alert('You win!');
window.location='legolas.html';
}
});
$('#square').draggable();
$('#square2').draggable();
});
</script>
<style type="text/css">
@-webkit-keyframes toRight{
0% {-webkit-transform:rotate(0deg);}
50% {-webkit-transform:rotate(-50deg);}
100% {-webkit-transform:rotate(0deg);}
}
@-webkit-keyframes toLeft{
0% {-webkit-transform:rotate(0deg);}
50% {-webkit-transform:rotate(50deg);}
100% {-webkit-transform:rotate(0deg);}
}
@-webkit-keyframes ballDrop{
0% {top:-50px;left:200px;}
25% {top:25px;left:150px;}
50% {top:50px;left:100px;}
75% {top:40px;left:55px;}
100% {top:2px;left:25px;}
}
@-webkit-keyframes ballRight{
0% {top:300px;left:550px;}
25% {top:320px;left:540px;}
50% {top:340px;left:450px;}
75% {top:265px;left:400px;}
100% {top:220px;left:350px;}
}
@-webkit-keyframes ballLeft{
0% {top:300px;left:70px;}
25% {top:340px;left:150px;}
50% {top:320px;left:200px;}
100% {top:220px;left:250px;}
}
body{
width:100%;
margin:0 auto;
}
#wrapper {
position:relative;
margin:0 auto;
cursor:default;
}
#ball{
top:-50px;
left:200px;
width:50px;
height:50px;
border-radius:500px;
background-color:red;
position:absolute;
}
#square{
position:absolute;
background-color:black;
left:0px;top:0px;height:50px;width:100px;border-top-left-radius:500px;border-top-right-radius:500px;
}
.righty{
animation: toRight 2s;
-moz-animation: toRight 2s;
-webkit-animation: toRight 2s;
}
#square2{
position:absolute;
background-color:black;
left:550px;top:250px;height:50px;width:100px;border-top-left-radius:500px;border-top-right-radius:500px;
}
.lefty{
animation: toLeft 2s;
-moz-animation: toLeft 2s;
-webkit-animation: toLeft 2s;
}
.drop{
animation: ballDrop 2s;
-moz-animation: ballDrop 2s linear;
-webkit-animation: ballDrop 2s linear;
}
.ballR{
animation: ballRight 2s;
-moz-animation: ballRight 2s linear;
-webkit-animation: ballRight 2s linear;
}
.ballL{
animation: ballLeft 2s;
-moz-animation: ballLeft 2s linear;
-webkit-animation: ballLeft 2s linear;
}
</style>
</head>
<body>
<div id="wrapper"> <!--Begin header content's wrapper-->
<div id="ball">
</div>
<div id="square">
</div>
<div id="square2">
</div>
</div>
</body>
</html>