-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
46 lines (38 loc) · 1.11 KB
/
index.js
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
var balls = jQuery('.balls img');
var velocidad = jQuery('#velocidad');
var variacion = jQuery('#variacion');
var start = jQuery('#start');
function var1( ){
balls.css("animation-name", "light1" );
}
function var2() {
balls.css("animation-name", "light2");
var velLocal = parseFloat( velocidad[0].value ) / 2
for ( var i = 0; i < balls.length; i++ ){
balls[i].style.animationDelay = velLocal + "s";
velLocal = velLocal + parseFloat( velocidad[0].value / 2 )
}
}
function var3() {
balls.css("animation-name", "light3");
var velLocal = parseFloat(velocidad[0].value) / 4
for (var i = 0; i < balls.length; i++) {
balls[i].style.animationDelay = velLocal + "s";
velLocal = velLocal + parseFloat(velocidad[0].value / 4)
}
}
start.click( function () {
balls.css({"animation-duration": velocidad.val( ) + "s" , "animation-name": "light1" })
})
velocidad.change( function(){
balls.css("animation-duration", velocidad.val() + "s" );
} )
variacion.change( function(){
if ( this.value == "1" ){
var1();
}else if( this.value == "2"){
var2();
}else if( this.value == "3"){
var3();
}
})