/********************************************************************* === Animation - EdgingMover === * EdgingMover [ EdgingMover.js ] * updated 2001/05/28 mail : peace@skipup.com home : http://www.skipup.com/~peace/ *********************************************************************/ // public class EdgingMover function EdgingMover(){ // private Element this.element ; // 対象レイヤー // private Dimension this.sPosition ; // 始点 this.ePosition ; // 終点 // private number this.tmpCount ; // ステップ数 // private number this.divCount ; // 分割数 // private number this.edging ; // イージング値 /****************************** CONSTRUCTOR - BEGIN ******************************/ var a = arguments ; if( a.length != 0 ) this.element = a[0] ; this.tmpCount = 0 ; this.edging = 0 ; switch( a.length ){ case 0 : default : break ; case 3 : { // el , eP , dC this.sPosition = this.element.getPosition(); this.ePosition = a[1]; this.divCount = a[2]; break ; } case 4 : { // el , sP , eP , dC || el , eP , dC , ed if( typeof a[2] == "object" ){ this.sPosition = a[1]; this.ePosition = a[2]; this.divCount = a[3]; }else{ this.sPosition = this.element.getPosition(); this.ePosition = a[1]; this.divCount = a[2]; this.edging = EdgingMover.$_e_( a[3] , a[2] ); } break ; } case 5 : { // el , sP , eP , dC , ed this.sPosition = a[1]; this.ePosition = a[2]; this.divCount = a[3]; this.edging = EdgingMover.$_e_( a[4] , a[3] ); break ; } } /****************************** CONSTRUCTOR - E N D ******************************/ } function setBasicMember__EdgingMover__(){ var E = EdgingMover ; var EP = E.prototype ; /***************************** SET_STATIC_MEMBER - BEGIN *****************************/ // public static void E.auto = function( m , t ){ E.$m = m ; E.$t = ( t ) ? t : 50 ; E.$_m_(); }; // private static void E.$_m_ = function(){ if( E.$m.step() ) setTimeout( "EdgingMover.$_m_();" , E.$t ); }; E.$_e_ = function( v , d ){ return ( ( Math.abs(v) > 100 ) ? v/Math.abs(v) : v/100 )/Math.PI ; }; /***************************** SET_STATIC_MEMBER - E N D *****************************/ /****************************** SET_MEMBER - BEGIN ******************************/ // public void EP.setElement = function( e ){ this.element = e ; }; // public void EP.setPosition = function(){ var a = arguments ; switch( a.length ){ case 1 : { this.sPosition = ( this.element ) ? this.element.getPosition() : new Dimension() ; this.ePosition = a[0]; break ; } case 2 : { this.sPosition = a[0]; this.ePosition = a[1]; break ; } default : return ; } }; // public void EP.setDivCount = function( c ){ this.divCount = c ; }; // public void EP.setEdging = function( v ){ this.edging = ( v ) ? E.$_e_( v , this.divCount ) : 0 ; }; // public boolean EP.step = function(){ if( this.tmpCount++ < this.divCount ){ var c = this.tmpCount/this.divCount ; var p = new Dimension( this.ePosition ); p.sub( this.sPosition ); p.scale( c+this.edging*Math.sin(Math.PI*c) ); p.add( this.sPosition ); this.element.setPosition( p ); return true ; }else{ this.tmpCount = 0 ; return false ; } }; // public string EP.toString = function(){ return "EdgingMover : "+this.element.getID(); }; /****************************** SET_MEMBER - E N D ******************************/ } setBasicMember__EdgingMover__();