-
Notifications
You must be signed in to change notification settings - Fork 0
/
robot.html
171 lines (160 loc) · 3.76 KB
/
robot.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
<!DOCTYPE html>
<head>
<link href='https://fonts.googleapis.com/css?family=Poller+One' rel='stylesheet' type='text/css'>
<script src="assets/jquery-3.3.1.js"></script>
<style>
.robot {
position: relative;
left: 200px;
}
.beep {
width: 5px;
height: 0;
border: 5px solid transparent;
border-top: 10px solid #777;
border-bottom: 80px solid #888;
position: relative;
left: 140px;
}
@keyframes blink {
50% {
background: radial-gradient(circle, red 15%, transparent 40%), #cc5;
background-size: 75px 150px;
}
}
@-webkit-keyframes blink {
50% {
background: -webkit-radial-gradient(circle, red 15%, transparent 40%), #cc5;
background-size: 75px 150px;
}
}
@-moz-keyframes blink {
50% {
background: -moz-radial-gradient(circle, red 15%, transparent 40%), #cc5;
background-size: 75px 150px;
}
}
.laser {
animation: blink .5s infinite;
-webkit-animation: blink .5s infinite;
-moz-animation: blink .5s infinite;
}
.brain {
background: radial-gradient(circle, white 15%, transparent 40%), #cc5;
background: -moz-radial-gradient(circle, white 15%, transparent 40%), #cc5;
background: -webkit-radial-gradient(circle, white 15%, transparent 40%), #cc5;
background-size: 75px 150px;
height: 150px;
width: 150px;
border-radius: 60px 60px 10px 10px;
border-bottom: 40px solid #666;
position: relative;
left: 70px;
}
.torso {
height: 0;
width: 140px;
border-top: 300px solid #bc6;
border-left: 75px solid transparent;
border-right: 75px solid transparent;
border-radius: 20px 20px 100px 100px;
}
.left {
font-family: 'Poller One', verdana, arial, sans-serif;
font-weight: bold;
font-size: 250px;
color: #666;
transform: rotate(200deg);
-webkit-transform: rotate(200deg);
-moz-transform: rotate(200deg);
position: relative;
top: -320px;
left: -190px;
z-index: -1;
}
.right {
font-family: 'Poller One', verdana, arial, sans-serif;
font-weight: bold;
font-size: 250px;
color: #666;
transform: scaleY(-1) rotate(20deg);
-webkit-transform: scaleY(-1) rotate(20deg);
-moz-transform: scaleY(-1) rotate(20deg);
position: relative;
top: -620px;
left: 190px;
z-index: -1;
}
.foot {
height: 40px;
width: 40px;
background: #ccc;
border-radius: 40px;
border: 15px solid #999;
position: relative;
left: 110px;
top: -10px;
z-index: -1;
}
@keyframes dance {
from {
left: 800px;
}
}
@-webkit-keyframes dance {
from {
left: 800px;
}
}
@-moz-keyframes dance {
from {
left: 800px;
}
}
img {
animation: dance 4s infinite;
-webkit-animation: dance 4s infinite;
-moz-animation: dance 4s infinite;
position: absolute;
top: 200px;
left: 400px;
}
</style>
</head>
<body>
<div class="robot">
<div class="beep"></div>
<div class="brain"></div>
<div class="torso">
<div class="left">j</div>
<div class="right">j</div>
</div>
<div class="foot"></div>
</div>
<button class="flash">laser eyes on/off</button>
<button class="color">change color!</button>
<button class="moves">move!</button>
<img src="assets/dance_cotter.gif">
<script>
// When eyes button is clicked, toggle laser class on brain
$(".flash").click(function() {
$(".brain").toggleClass('laser');
});
// When color button is clicked...
$(".color").click(function() {
// assign each named color a random number 0-255
var red = Math.floor(Math.random() * 255);
var green = Math.floor(Math.random() * 255);
var blue = Math.floor(Math.random() * 255);
//Generate an RGBA value from red, green and blue
var randomRGBA = 'rgba('+red+','+green+','+blue+',1)';
//and change the body's background to our random color
$("body").css("background", randomRGBA);
//Display the three values in an alert window
//alert(randomRGBA);
});
$(".moves").click(function() {
$("img").toggle();
});
</script>
</body>