diff -r f905a56cc7e6 -r f7bfdc49982b web/static/res/js/incchoice.js --- a/web/static/res/js/incchoice.js Tue Dec 11 19:49:17 2012 +0100 +++ b/web/static/res/js/incchoice.js Tue Dec 11 21:13:42 2012 +0100 @@ -4,20 +4,25 @@ { this.currentWorldIndex = 0; this.canSelectWord = true; + this.image1; + this.image2; + this.image3; - this.setMosaicEffect = function(images1, images2) + this.setMosaicImages = function(images1, images2, images3) { // Choose 2 image for the effect - var image1 = images1[incMosaic.randomInt(0, images1.length)]; - var image2 = images2[incMosaic.randomInt(0, images2.length)]; - incMosaic.addImageUrl("static/res/img/" + image1); - incMosaic.addImageUrl("static/res/img/" + image2); + this.image1 = images1[incMosaic.randomInt(0, images1.length)]; + this.image2 = images2[incMosaic.randomInt(0, images2.length)]; + this.image3 = images3[incMosaic.randomInt(0, images3.length)]; - // Start mosaic effect - incMosaic.start("mosaic", effectSpeed, 9, 5, false, true, function() {incChoice.effectIsDone();}); + incMosaic.addImageUrl("static/res/img/" + this.image1); + incMosaic.addImageUrl("static/res/img/" + this.image2); + incMosaic.addImageUrl("static/res/img/" + this.image3); + + incMosaic.start("mosaic", effectSpeed, 9, 5, true, true, function() {incChoice.effectIsDone();}); }; - this.setWords = function(choiceIndex) + this.setWordsAndEffect = function(choiceIndex) { if (choiceIndex == 0) { $("#mot1").html("famille"); @@ -27,14 +32,24 @@ $("#mot5").html("dieu"); $("#mot6").html("president"); + // Set images for effect + //incMosaic.clear(); + //incMosaic.addImageUrl("static/res/img/" + this.image1); + //incMosaic.addImageUrl("static/res/img/" + this.image2); + } else if (choiceIndex == 1) { $("#mot1").html("actif"); $("#mot2").html("passif"); $("#mot3").html("corps"); - $("#mot4").html("charité"); + $("#mot4").html("charite"); $("#mot5").html("patrie"); $("#mot6").html("politique"); + // Set images for effect + //incMosaic.clear(); + //incMosaic.addImageUrl("static/res/img/" + this.image2); + //incMosaic.addImageUrl("static/res/img/" + this.image3); + } else { $("#mot1").html("spleen"); $("#mot2").html("ideal"); @@ -42,7 +57,14 @@ $("#mot4").html("peur"); $("#mot5").html("desir"); $("#mot6").html("bonheur"); + + // Set images for effect + //incMosaic.clear(); + //incMosaic.addImageUrl("static/res/img/" + this.image3); + //incMosaic.addImageUrl("static/res/img/" + this.image1); } + + //incMosaic.start("mosaic", effectSpeed, 9, 5, false, true, function() {incChoice.effectIsDone();}); }; this.selectWord = function(wordIndex) @@ -55,7 +77,7 @@ this.canSelectWord = false; // Start the mosaic effect - incMosaic.goEffect(); + incMosaic.UnpauseEffect(true); // Fade the text $('.big_txt').animate({opacity: 0}, 20000 * 1 / effectSpeed); @@ -69,8 +91,11 @@ this.canSelectWord = true; ++this.currentWorldIndex; - // Change list of words - this.setWords(this.currentWorldIndex); + // Set the list of words and the mosaic effect + this.setWordsAndEffect(this.currentWorldIndex); + + // Stop the mosaic effect + incMosaic.UnpauseEffect(false); // Fade the text $('.big_txt').animate({opacity: 1}, 20000 * 1 / effectSpeed);