Hi all, I have taken a script about sliding text from net. It has usage method. but inside it there is function that has four parameters and one of them was used. I dont understand it. Can you help me to understand it? below is script.
in this script i dont understand this line
function(u,d,t,q) i see all these parameters (u,d,t,q) ara not used except d and what is d i dont understand. i will wait your responses. thanks in advance.
PHP Code:
/*
* Usage: * (new Animate(document.getElementById('item'))) .numeric(2, { 'margin-left', -100, ease: Ease.easeInQuad } ) .onComplete(function(el){ alert('Element has moved ' + el.style.marginLeft + ' to the left in 2 seconds' ); }); */ var Animate = function(element) { var self = this,time, timer, animationType, msDuration, parameters, onCompleteHandler = function(){}, onUpdateHandler = function(){},freq=1;
function startTimer() { time = (new Date()).getTime(); timer = setInterval(loop,freq); };
function stopTimer(){ clearInterval(timer); };
function getCurrentTime() { return (new Date()).getTime() - time; };
/** * Function to make the effect visible * will start being called as soon as the startTimer function is called * will stop when the duration time is expired or the stopTimer function is called */ function loop() { if (getCurrentTime() <= msDuration) { for(var rule in parameters) { animationType.setValue(rule, parameters[rule], getCurrentTime()); } onUpdateHandler(element); } else { stopTimer(); onCompleteHandler(element); }
};
/** * @param {HTMLElement} object - to be affected * @param {Number} duration - time in seconds * @param {Object} params - parameters */ self.numeric = function(duration, params) { animate(NumericAnimationType, duration, params); return self; };
Bookmarks