PDA

View Full Version : Fade time in Swiss Army Slideshow



robincham
04-06-2007, 07:46 PM
1) Script Title: Swiss Army Slideshow

2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...army/index.htm


3) Describe problem: How can I increase/decrease fade delay between images? Thanx in advance for any help.

jscheuer1
04-07-2007, 02:48 PM
Use the delay property of the array:

slides.delay=3000

robincham
04-07-2007, 04:37 PM
Sorry, I didn't make myself clear. I'm trying to lengthen/shorten the fade time itself, not the display time of the images.

Robin

jscheuer1
04-07-2007, 06:44 PM
OK, there are two spots in swissarmy.js where this is controlled (red):


inter_slide.prototype.fadepic=function(){
if (this.fade&&this.degree<100){
this.faded=0
this.degree+=10
if (this.tempobj.filters&&this.tempobj.filters[0]){
if (typeof this.tem . . .

which controls how much of an opacity increase you get each time this (blue & red):


. . . umperidx=this.keeptrack()<this.imgs.length? this.keeptrack()+1 : 1;
var fadeobj=this
clearInterval(this.fadeclear)
this.fadeclear=setInterval(function(){fadeobj.fadepic()},50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var v4imgobj=document.images['defaultslide'+this.issid]
v4imgobj.src=this.postimgs[this.nextimgidx].src
this.nextimgidx=(this.nextimgidx<this.imgs.length-1)? this.nextimgidx+1 : 0
}
}

inter_slide.prototype.resetit=function(){
this.degree=10
var crossobj=this.go(this.cu . . .

fires. You can play with the numbers to get what you like.

I believe that the first value (currently 10) must be an even divisor of 100 like 1, 2, 5, 10, 20, 25, 50 and that only 2, 5, and 10, possibly 20, are of any practical use. The larger this number is, the greater the opacity increases with each iteration controlled by the other value.

The second value controls how often this opacity increase is applied during the fade-in. It represents milliseconds. The larger it is, the more time passes between each incremental increase. It shouldn't be less than 20, though newer machines and some browsers can handle very small values.

If you are lengthening the time of fade-in, you may reach a point where the total time needed to fade-in is greater than the interval between images. If so, the image will not fade all the way in and there could be other problems. If this happens, you can increase the delay property of the array as mentioned in my previous post.

Now, if you want to break it out to control these values individually for each slide show, they can be changed to:


this.degree+=this.imgs.dc

and:


this.fadeclear=setInterval(function(){fadeobj.fadepic()},this.imgs.fr)

respectively. And, then be made properties of the array:


slides.dc=10;
slides.fr=50;