home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 117
/
FreelogNo117-OctobreNovembre2013.iso
/
Theme
/
8GadgetPack
/
8GadgetPackSetup.msi
/
Gadgets.7z
/
Gadgets
/
StickyNotesOnline.gadget
/
Scripts
/
Lib
/
Animate.js
next >
Wrap
Text File
|
2011-06-16
|
5KB
|
134 lines
function Animate() { }
Animate.Animated = false;
Animate.sliderIntervalId = 0;
Animate.Choose = function(cIndex, nIndex, forward) {
switch (Global.GetSliderAnimatedType()) {
case 1: Animate.Vertical(cIndex, nIndex, forward); break; //Slide Vertical
case 2: Animate.Horizontal(cIndex, nIndex, forward); break; //Slide Horizontal
case 3: Animate.FontChange(cIndex, nIndex, forward); break; //Font Color Change
default: UI.Swap(cIndex, nIndex);
}
}
Animate.Height = function() {
return parseInt(parseInt(UI.Height) - parseInt(Theme.Top) - parseInt(Theme.Bottom));
}
Animate.Width = function() {
return parseInt(parseInt(UI.Width) - (2 * parseInt(Theme.Side)));
}
Animate.Vertical = function(cIndex, nIndex, forward) {
var currTArea = document.getElementById("Layer" + cIndex);
var newTArea = document.getElementById("Layer" + nIndex);
var temp = "";
if (forward) {
temp = parseInt(Theme.Top) + Animate.Height();
newTArea.style.top = temp + "px";
}
else {
newTArea.style.top = Theme.Top;
}
newTArea.style.left = Theme.Side + "px";
newTArea.style.width = Animate.Width() + "px";
newTArea.style.height = "0px";
if (Animate.Animated) {
return;
}
Animate.Animated = true;
Animate.sliderIntervalId = setInterval('Animate.RunVertical(' + cIndex + ',' + nIndex + ',' + forward + ')', 30);
}
Animate.RunVertical = function(cIndex, nIndex, forward) {
var currTArea = document.getElementById("Layer" + cIndex);
var newTArea = document.getElementById("Layer" + nIndex);
var temp = "";
if (parseInt(newTArea.style.height) + Animate.SliderSpeed() >= Animate.Height()) {
Animate.Animated = false;
currTArea.style.height = '0px';
currTArea.style.top = Theme.Top;
currTArea.style.display = "none";
newTArea.style.top = Theme.Top; ;
newTArea.style.height = Animate.Height() + "px";
clearInterval(Animate.sliderIntervalId);
}
else {
//SET HEIGHTS
temp = parseInt(newTArea.style.height) + Animate.SliderSpeed();
newTArea.style.height = temp + "px";
temp = parseInt(currTArea.style.height) - Animate.SliderSpeed();
if (temp > 0) {
currTArea.style.height = temp + "px";
}
//SET TOPS
if (forward) {
newTArea.style.top = parseInt(Theme.Top) + parseInt(currTArea.style.height) + "px";
}
else {
currTArea.style.top = parseInt(Theme.Top) + parseInt(newTArea.style.height) + "px";
}
newTArea.style.display = 'block';
}
}
Animate.Horizontal = function(cIndex, nIndex, forward) {
var currTArea = document.getElementById("Layer" + cIndex);
var newTArea = document.getElementById("Layer" + nIndex);
var temp = "";
if (forward) {
temp = Theme.Side + Animate.Width();
newTArea.style.left = temp + "px";
}
else {
newTArea.style.left = Theme.Side;
}
newTArea.style.top = Theme.Top;
newTArea.style.height = Animate.Height() + "px";
newTArea.style.width = "0px";
if (Animate.Animated) {
return;
}
Animate.Animated = true;
Animate.sliderIntervalId = setInterval('Animate.RunHorizontal(' + cIndex + ',' + nIndex + ',' + forward + ')', 30);
}
Animate.RunHorizontal = function(cIndex, nIndex, forward) {
var currTArea = document.getElementById("Layer" + cIndex);
var newTArea = document.getElementById("Layer" + nIndex);
var temp = "";
if (parseInt(newTArea.style.width) + Animate.SliderSpeed() >= Animate.Width()) {
Animate.Animated = false;
currTArea.style.width = '0px';
currTArea.style.left = Theme.Side + "px";
currTArea.style.display = "none";
newTArea.style.left = Theme.Side + "px";
newTArea.style.width = Animate.Width() + "px";
clearInterval(Animate.sliderIntervalId);
}
else {
//SET WIDTHS
temp = parseInt(newTArea.style.width) + Animate.SliderSpeed();
newTArea.style.width = temp + "px";
temp = parseInt(currTArea.style.width) - Animate.SliderSpeed();
if (temp > 0) {
currTArea.style.width = temp + "px";
}
//SET TOPS
if (forward) {
newTArea.style.left = Theme.Side + parseInt(currTArea.style.width) + "px";
}
else {
currTArea.style.left = Theme.Side + parseInt(newTArea.style.width) + "px";
}
newTArea.style.display = 'block';
}
}
Animate.FontChange = function(cIndex, nIndex, forward) {
}
Animate.SliderSpeed = function() {
return parseInt(Global.GetSliderSpeed());
}