// Animator OBJECT - soucast DHTML Lib 1.2.1 - dhtmllib.js musi byt nactena/*  Pixy DOM DHTML Lib 1.2.1    ------------------------    Knihovna JS funkci pro snazsi dynamickou manipulaci s HTML dokumenty        Copyright (C) 2001 Petr Stanicek (aka -pixy-), mailto:stanicek@mac.com    Info, licence, download, kontakt: http://web.iol.cz/pixy/dhtmllib.html    * GNU/GPL 2.CZE *    Tato knihovna a jeji soucasti jsou volne programove vybaveni;    muzete jej sirit a modifikovat podle ustanoveni Obecne verejne licence GNU    pro Ceskou republiku, vydavane Free Software Foundation a obcanskym sdruzenim    zastudena.cz, ve verzi 2.CZE teto licence.    Tento program je rozsirovan v nadeji, ze bude uzitecny, avsak BEZ JAKEKOLI ZARUKY;    neposkytuji se ani odvozene zaruky PRODEJNOSTI anebo VHODNOSTI PRO URCITY UCEL.    Dalsi podrobnosti hledejte v Obecne verejne licenci GNU pro Ceskou republiku,    ktera je soucasti teto knihovny - http://web.iol.cz/pixy/dhtmllib.html*/function AnimatorObj(selfname, obj) {    this.self = selfname;    this.obj = getObj(obj);    this.pathX = new Array(); this.pathY = new Array();    this.pathW = new Array(); this.pathH = new Array();    this.todo = false;    this.play = false;    this.steps = 0;    this.counter = 0;    this.loop = 0;    this.loopcounter = 0;    this.GetCurrentPos();    this.origX = this.curX; this.origY = this.curY;    this.origW = this.curW; this.origH = this.curH;    }function AnimatorObjGetCurrentPos() {    this.curX = getObjX(this.obj); this.curY = getObjY(this.obj);    this.curW = getObjW(this.obj); this.curH = getObjH(this.obj);    }function AnimatorObjInit(x,y,w,h,steps,speed,loop) {    this.steps = steps; this.speed = speed;    this.loop = loop;    this.counter = 0; this.loopcounter = 0;    var last = steps-1;    this.todo = (steps>0);    this.pathX[0] = this.curX; this.pathX[last] = (x!=null) ? x : this.CurX;    this.pathY[0] = this.curY; this.pathY[last] = (y!=null) ? y : this.CurY;    this.pathW[0] = this.curW; this.pathW[last] = (w!=null) ? w : this.CurW;    this.pathH[0] = this.curH; this.pathH[last] = (h!=null) ? h : this.CurH;    var dx=(x-this.curX)/steps; var dy=(y-this.curY)/steps;    var dw=(w-this.curW)/steps; var dh=(h-this.curH)/steps;    for (var i=1; i<last; i++) {        this.pathX[i] = Math.round(this.curX + i*dx);        this.pathY[i] = Math.round(this.curY + i*dy);        this.pathW[i] = Math.round(this.curW + i*dw);        this.pathH[i] = Math.round(this.curH + i*dh);        }    }function AnimatorObjMove() {    if(this.play) {        var c = this.counter;        moveObjTo(this.obj,this.pathX[c],this.pathY[c]);        resizeObjTo(this.obj,this.pathW[c],this.pathH[c]);        this.counter++;        if (this.counter>=this.steps) {            if (this.loop>0) this.loopcounter++;            if (this.loop<0 || (this.loopcounter<this.loop)) this.counter=0;            }        this.todo = (this.counter<this.steps);        if (this.todo) setTimeout(this.self + ".Move()",this.speed);        else this.Go(0);        }    }function AnimatorObjRestore(steps,speed) {    this.Init(this.origX,this.origY,this.origW,this.origH,steps,speed,1);    this.Go(1);    }function AnimatorObjGo(on) {    this.play = (on && this.todo);    if (this.play) this.Move();    else this.GetCurrentPos();    }AnimatorObj.prototype.GetCurrentPos = AnimatorObjGetCurrentPos;AnimatorObj.prototype.Move = AnimatorObjMove;AnimatorObj.prototype.Init = AnimatorObjInit;AnimatorObj.prototype.Restore = AnimatorObjRestore;AnimatorObj.prototype.Go = AnimatorObjGo;
