-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhtml.html
260 lines (201 loc) · 7.49 KB
/
html.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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- disable zooming -->
<meta name="viewport" content="initial-scale=1.0, user-scalable=0" />
<title>Carousel 2 - dynamic · Intro to CSS 3D transforms › Examples</title>
<link rel="stylesheet" href="../css/style.css" media="screen" />
<style media="screen">
.container {
width: 210px;
height: 140px;
position: relative;
margin: 0 auto 40px;
border: 1px solid #CCC;
-webkit-perspective: 1100px;
-moz-perspective: 1100px;
-o-perspective: 1100px;
perspective: 1100px;
}
#carousel {
width: 100%;
height: 100%;
position: absolute;
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
-o-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.ready #carousel {
-webkit-transition: -webkit-transform 1s;
-moz-transition: -moz-transform 1s;
-o-transition: -o-transform 1s;
transition: transform 1s;
}
#carousel.panels-backface-invisible figure {
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
}
#carousel figure {
display: block;
position: absolute;
width: 380px;
height: 116px;
left: 10px;
top: 10px;
border: 2px solid black;
line-height: 116px;
font-size: 80px;
font-weight: bold;
color: white;
text-align: center;
}
.ready #carousel figure {
-webkit-transition: opacity 1s, -webkit-transform 1s;
-moz-transition: opacity 1s, -moz-transform 1s;
-o-transition: opacity 1s, -o-transform 1s;
transition: opacity 1s, transform 1s;
}
</style>
</head>
<body>
<h1>TODI</h1>
<section class="container">
<div id="carousel">
<figure>Todos</figure>
<figure>Obliga</figure>
<figure>Derecha</figure>
<figure>Izquierda</figure>
<figure>Toman</figure>
<figure>Tomamos</figure>
<figure>7</figure>
<figure>8</figure>
<figure>9</figure>
<figure>10</figure>
<figure>11</figure>
<figure>12</figure>
<figure>13</figure>
<figure>14</figure>
<figure>15</figure>
<figure>16</figure>
<figure>17</figure>
<figure>18</figure>
<figure>19</figure>
<figure>20</figure>
</div>
</section>
<section id="options">
<p>
<label hidden for="panel-count">panels</label>
<input type="hidden" id="panel-count" value="6" min="3" max="20" />
</p>
<p id="navigation">
<button hidden id="previous" data-increment="-1">Previous</button>
<button id="next" data-increment="1">A jugar!!</button>
</p>
</section>
<script src="../js/utils.js"></script>
<script>
var transformProp = Modernizr.prefixed('transform');
function Carousel3D ( el ) {
this.element = el;
//alert(this.element.children[2]);
this.rotation = 0;
this.panelCount = 0;
this.totalPanelCount = this.element.children.length;
this.theta = 0;
this.isHorizontal = false;
}
Carousel3D.prototype.modify = function() {
//alert('que onda ');
var panel, angle, i;
this.panelSize = this.element[ this.isHorizontal ? 'offsetWidth' : 'offsetHeight' ];
this.rotateFn = this.isHorizontal ? 'rotateY' : 'rotateX';
this.theta = 360 / this.panelCount;
// do some trig to figure out how big the carousel
// is in 3D space
this.radius = Math.round( ( this.panelSize / 2) / Math.tan( Math.PI / this.panelCount ) );
for ( i = 0; i < this.panelCount; i++ ) {
panel = this.element.children[i];
angle = this.theta * i;
panel.style.opacity = 1;
panel.style.backgroundColor = 'hsla(' + angle + ', 100%, 50%, 0.8)';
// rotate panel, then push it out in 3D space
panel.style[ transformProp ] = this.rotateFn + '(' + angle + 'deg) translateZ(' + this.radius + 'px)';
}
// hide other panels
for ( ; i < this.totalPanelCount; i++ ) {
panel = this.element.children[i];
panel.style.opacity = 0;
panel.style[ transformProp ] = 'none';
}
// adjust rotation so panels are always flat
this.rotation = Math.round( this.rotation / this.theta ) * this.theta;
this.transform();
};
Carousel3D.prototype.transform = function() {
// push the carousel back in 3D space,
// and rotate it
this.element.style[ transformProp ] = 'translateZ(-' + this.radius + 'px) ' + this.rotateFn + '(' + this.rotation + 'deg)';
};
var init = function() {
var carousel = new Carousel3D( document.getElementById('carousel') ),
panelCountInput = document.getElementById('panel-count'),
axisButton = document.getElementById('toggle-axis'),
navButtons = document.querySelectorAll('#navigation button'),
onNavButtonClick = function( event ){
//var increment = parseInt( event.target.getAttribute('data-increment') );//alert(Math.random()*1000);
//mod dengue
var rango_superior = 5000;
var rango_inferior = 3000;
var incremento = 0;
var noOk = true;
while(noOk){
incremento = Math.floor(Math.random()*(rango_superior-(rango_inferior-1))) + rango_inferior;
if(isEntero(incremento/60)){
noOk = false;
}
}
//fin mod
carousel.rotation = incremento * -1;// += carousel.theta * increment * -1;
carousel.transform();
};
// populate on startup
carousel.panelCount = parseInt( panelCountInput.value, 10);
carousel.modify();
//axisButton.addEventListener( 'click', function(){
//carousel.isHorizontal = !carousel.isHorizontal;
//carousel.modify();
//}, false);
//panelCountInput.addEventListener( 'change', function( event ) {
//carousel.panelCount = event.target.value;
//carousel.modify();
//}, false);
for (var i=0; i < 2; i++) {
navButtons[i].addEventListener( 'click', onNavButtonClick, false);
}
//document.getElementById('toggle-backface-visibility').addEventListener( 'click', function(){
// carousel.element.toggleClassName('panels-backface-invisible');
//}, false);
setTimeout( function(){
document.body.addClassName('ready');
}, 0);
};
function isEntero(valor){
valor = valor.toString();
if(valor.indexOf('.') != -1){
return false;
}
return true;
}
window.addEventListener( 'DOMContentLoaded', init, false);
</script>
<footer>
<p id="disclaimer">Sorry, your browser does not support CSS 3D transforms. Try viewing this page in <a href="http://www.apple.com/safari/">Safari</a>, <a href="http://www.google.com/chrome">Chrome</a>, <a href="http://www.mozilla.org/en-US/firefox/channel/">Firefox Aurora</a>, or on an iOS device.</p>
<p>Example for <a href="#">TODI for Android</a> by SoftBeer, co-producer David DeSandro</p>
</footer>
</body>
</html>