|
1 var effectSpeed = 8; |
|
2 |
|
3 function IncChoice() |
|
4 { |
|
5 this.currentWorldIndex = -1; |
|
6 this.lastWorldIndex = -1; |
|
7 |
|
8 this.setMosaicEffect = function(images1, images2, nextUrl) |
|
9 { |
|
10 // Choose 2 image for the effect |
|
11 var image1 = images1[incMosaic.randomInt(0, images1.length)]; |
|
12 var image2 = images2[incMosaic.randomInt(0, images2.length)]; |
|
13 incMosaic.addImageUrl("static/res/img/" + image1); |
|
14 incMosaic.addImageUrl("static/res/img/" + image2); |
|
15 |
|
16 // Start mosaic effect |
|
17 incMosaic.start("mosaic", effectSpeed, 9, 5, false, true, function() { location.href = nextUrl;}); |
|
18 }; |
|
19 |
|
20 this.selectWord = function(word) |
|
21 { |
|
22 if (this.currentWorldIndex == this.lastWorldIndex) { |
|
23 // Don't set the word 2 times |
|
24 return; |
|
25 } |
|
26 |
|
27 // Start the mosaic effect |
|
28 incMosaic.goEffect(); |
|
29 |
|
30 // Fade the text |
|
31 $('.big_txt').animate({opacity: 0}, 20000 * 1 / effectSpeed); |
|
32 |
|
33 // Save the word |
|
34 this.setCookie("niv1_world" + this.currentWorldIndex, word); |
|
35 this.lastWorldIndex = this.currentWorldIndex; |
|
36 //++this.currentWorldIndex; |
|
37 }; |
|
38 |
|
39 this.setCookie = function(name, value) |
|
40 { |
|
41 $.removeCookie(name); |
|
42 $.cookie(name, value, { expires: 7, path: '/' }); |
|
43 }; |
|
44 |
|
45 this.getCookie = function(name) { |
|
46 return $.cookie(name); |
|
47 }; |
|
48 } |
|
49 |
|
50 var incChoice = new IncChoice(); |