79 var h = getHeight(); |
86 var h = getHeight(); |
80 var y = parseInt ( getScrollOffset() ); |
87 var y = parseInt ( getScrollOffset() ); |
81 // temp vars |
88 // temp vars |
82 var dim, off, diff, dist, ratio, opac_factor; |
89 var dim, off, diff, dist, ratio, opac_factor; |
83 // setup element |
90 // setup element |
84 element.style.position = 'absolute'; |
91 for ( var i = 0; i < element.length; i++ ) |
|
92 element[i].style.position = 'absolute'; |
85 |
93 |
86 dim = [ $dynano(element).Height(), $dynano(element).Width() ]; |
94 dim = [ $dynano(element[0]).Height(), $dynano(element[0]).Width() ]; |
87 off = [ $dynano(element).Top(), $dynano(element).Left() ]; |
95 off = [ $dynano(element[0]).Top(), $dynano(element[0]).Left() ]; |
88 |
96 |
89 if ( height_taken_care_of ) |
97 if ( height_taken_care_of ) |
90 { |
98 { |
91 top = off[0]; |
99 top = off[0]; |
92 left = off[1]; |
100 left = off[1]; |
125 var diff_top = top - topi; |
133 var diff_top = top - topi; |
126 var diff_left = left - lefti; |
134 var diff_left = left - lefti; |
127 |
135 |
128 var frames = 100; |
136 var frames = 100; |
129 var timeout = 0; |
137 var timeout = 0; |
130 var timerstep = 8; |
138 var timerstep = 8 * FI_MULTIPLIER; |
131 |
139 |
132 // cache element so it can be changed from within setTimeout() |
140 // cache element so it can be changed from within setTimeout() |
133 var rand_seed = Math.floor(Math.random() * 1000000); |
141 var rand_seed = Math.floor(Math.random() * 1000000); |
134 fly_in_cache[rand_seed] = element; |
142 fly_in_cache[rand_seed] = element; |
135 |
143 |
136 for ( var i = 0; i < frames; i++ ) |
144 for ( var i = 0; i < frames; i++ ) |
137 { |
145 { |
138 topc = GlideEffect.easeInOut(i, topi, diff_top, frames); |
146 topc = GlideEffect.easeInOut(i, topi, diff_top, frames); |
139 leftc = GlideEffect.easeInOut(i, lefti, diff_left, frames); |
147 leftc = GlideEffect.easeInOut(i, lefti, diff_left, frames); |
140 var code = 'var o = fly_in_cache['+rand_seed+']; o.style.top=\''+topc+'px\';'; |
148 |
|
149 var code = 'var element = fly_in_cache[' + rand_seed + '];' + "\n"; |
|
150 code += 'for ( var i = 0; i < element.length; i++ )' + "\n"; |
|
151 code += '{' + "\n"; |
|
152 code += ' element[i].style.top = "' + topc + 'px";' + "\n"; |
141 if ( !height_taken_care_of ) |
153 if ( !height_taken_care_of ) |
142 code += ' o.style.left=\''+leftc+'px\''; |
154 code += ' element[i].style.left = "' + leftc + 'px";' + "\n"; |
143 code += ';'; |
155 code += '}'; |
|
156 |
144 setTimeout(code, timeout); |
157 setTimeout(code, timeout); |
|
158 |
145 timeout += timerstep; |
159 timeout += timerstep; |
146 |
160 |
147 var ratio = i / frames; |
161 var ratio = i / frames; |
148 |
162 |
149 if ( !nofade ) |
163 if ( !nofade ) |
150 { |
164 { |
151 // handle fade |
165 // handle fade |
152 var opac_factor = ratio * 100; |
166 var opac_factor = ratio * 100; |
153 if ( direction == FI_OUT ) |
167 if ( direction == FI_OUT ) |
154 opac_factor = 100 - opac_factor; |
168 opac_factor = 100 - opac_factor; |
155 setTimeout('var o = fly_in_cache['+rand_seed+']; domObjChangeOpac('+opac_factor+', o);', timeout); |
169 |
|
170 var code = 'var element = fly_in_cache[' + rand_seed + '];' + "\n"; |
|
171 code += 'for ( var i = 0; i < element.length; i++ )' + "\n"; |
|
172 code += '{' + "\n"; |
|
173 code += ' domObjChangeOpac(' + opac_factor + ', element[i]);' + "\n"; |
|
174 code += '}'; |
|
175 |
|
176 setTimeout(code, timeout); |
156 } |
177 } |
157 |
178 |
158 } |
179 } |
159 |
180 |
160 // old framestepper code removed from here in Loch Ness |
181 // old framestepper code removed from here in Loch Ness |