Download the X Distribution File.
xAniWH(e, w, h, t);
Default.
// xAniWH r1, Copyright 2009 Thomas Nabet (babna.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xAniWH(e, w, h, t)
{
if (!(e=xGetElementById(e))) return;
var w0 = xWidth(e), h0 = xHeight(e); // start positions
var dw = w - w0, dh = h - h0; // displacements
var fq = 1 / t; // frequench
var t0 = new Date().getTime(); // start time
var tmr = setInterval(
function() {
var wi = w, hi = h;
var et = new Date().getTime() - t0; // elapsed time
if (et < t) {
var f = et * fq; // constant velocity
wi = f * dw + w0; // instantaneous positions
hi = f * dh + h0;
}
else { clearInterval(tmr); }
e.style.width = Math.round(wi) + 'px';
e.style.height = Math.round(hi) + 'px';
}, 20 // timer resolution
);
}
xanimation.html - Start page of all xAnimation demos.
By your use of X and/or CBE and/or any Javascript from this site you consent to the GNU LGPL - please read it. If you have any questions about the license, read the FAQ and/or come to the forums.
Forum support is available at the X Library Support Forums.
Cross-Browser.com is the home of X - a cross-browser Javascript library, and many demos, applications, articles and documentation.
If you are using X, XC or anything from this site, show off your work by posting a link in the X Showcase forum.