1 /*=====================================================================*\
2 || ################################################################### ||
3 || # RGB Converter Widget [#]version[#]
4 || # --------------------------------------------------------------- # ||
5 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
6 || # This file may not be reproduced in any way without permission. # ||
7 || # --------------------------------------------------------------- # ||
8 || # User License Agreement at http://www.iris-studios.com/license/ # ||
9 || ################################################################### ||
10 \*=====================================================================*/
19 // ###################################################################
20 // watches the three RGB fields to make sure they don't go over the limites
21 function rgbwatcher(colour
)
23 keycode
= event
.keyCode
;
24 field
= document
.getElementById(colour
+ "inputf");
26 if ((keycode
>= 48 && keycode
<= 57) || (keycode
>= 96 && keycode
<= 105))
28 fields
[colour] = intval(fields
[colour].toString() + intval(fetch_keycode_val(keycode
)));
31 else if (keycode
== 8)
33 fields
[colour] = fields
[colour].toString().substr(0, fields
[colour].toString().length
- 1);
34 field
.value
= fields
[colour];
38 //alert("bad key: " + keycode);
39 field
.value
= fields
[colour];
42 //alert(window.event.keycode);
48 // ###################################################################
49 // fetches the integer value
55 // ###################################################################
57 function fetch_keycode_val(keycode
)
106 // ###################################################################
107 // ###################################################################
108 // ###################################################################
114 var front
= document
.getElementById("front");
115 var back
= document
.getElementById("back");
119 widget
.prepareForTransition("ToBack");
122 front
.style
.display
= "none";
123 back
.style
.display
= "block";
127 setTimeout("widget.performTransition();", 0);
130 document
.getElementById("fliprollie").style
.display
= "none";
135 var front
= document
.getElementById("front");
136 var back
= document
.getElementById("back");
140 widget
.prepareForTransition("ToFront");
143 back
.style
.display
= "none";
144 front
.style
.display
= "block";
148 setTimeout("widget.performTransition();", 0);
152 var flipShown
= false;
164 function mousemove(event
)
168 if (animation
.timer
!= null)
170 clearInterval(animation
.timer
);
171 animation
.timer
= null;
174 var starttime
= (new Date
).getTime() - 13;
176 animation
.duration
= 500;
177 animation
.starttime
= starttime
;
178 animation
.firstElement
= document
.getElementById("flip");
179 animation
.timer
= setInterval("animate();", 13);
180 animation
.from
= animation
.now
;
187 function mouseexit(event
)
191 // fade in the flip widget
192 if (animation
.timer
!= null)
194 clearInterval (animation
.timer
);
195 animation
.timer
= null;
198 var starttime
= (new Date
).getTime() - 13;
200 animation
.duration
= 500;
201 animation
.starttime
= starttime
;
202 animation
.firstElement
= document
.getElementById("flip");
203 animation
.timer
= setInterval("animate();", 13);
204 animation
.from
= animation
.now
;
216 var time
= (new Date
).getTime();
218 T
= limit_3(time
- animation
.starttime
, 0, animation
.duration
);
220 if (T
>= animation
.duration
)
222 clearInterval(animation
.timer
);
223 animation
.timer
= null;
224 animation
.now
= animation
.to
;
228 ease
= 0.5 - (0.5 * Math
.cos(Math
.PI
* T
/ animation
.duration
));
229 animation
.now
= compute_next_float(animation
.from
, animation
.to
, ease
);
232 animation
.firstElement
.style
.opacity
= animation
.now
;
235 function limit_3 (a
, b
, c
)
237 return a
< b
? b
: (a
> c
? c
: a
);
240 function compute_next_float(from
, to
, ease
)
242 return from
+ (to
- from
) * ease
;
245 function enterflip(event
)
247 document
.getElementById("fliprollie").style
.display
= "block";
250 function exitflip(event
)
252 document
.getElementById("fliprollie").style
.display
= "none";
255 /*=====================================================================*\
256 || ###################################################################
259 || ###################################################################
260 \*=====================================================================*/