OpenLayers OpenLayers

Changeset 6415

Show
Ignore:
Timestamp:
02/29/08 02:31:56 (11 months ago)
Author:
pgiraud
Message:

add the Quad easing methods for Tween

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Tween.js

    r6398 r6415  
    269269    CLASS_NAME: "OpenLayers.Easing.Expo" 
    270270}; 
     271 
     272/** 
     273 * Namespace: OpenLayers.Easing.Quad 
     274 */ 
     275OpenLayers.Easing.Quad = { 
     276     
     277    /** 
     278     * Function: easeIn 
     279     *  
     280     * Parameters: 
     281     * t - {Float} time 
     282     * b - {Float} beginning position 
     283     * c - {Float} total change 
     284     * d - {Float} duration of the transition 
     285     */ 
     286    easeIn: function(t, b, c, d) { 
     287        return c*(t/=d)*t + b; 
     288    }, 
     289     
     290    /** 
     291     * Function: easeOut 
     292     *  
     293     * Parameters: 
     294     * t - {Float} time 
     295     * b - {Float} beginning position 
     296     * c - {Float} total change 
     297     * d - {Float} duration of the transition 
     298     */ 
     299    easeOut: function(t, b, c, d) { 
     300        return -c *(t/=d)*(t-2) + b; 
     301    }, 
     302     
     303    /** 
     304     * Function: easeInOut 
     305     *  
     306     * Parameters: 
     307     * t - {Float} time 
     308     * b - {Float} beginning position 
     309     * c - {Float} total change 
     310     * d - {Float} duration of the transition 
     311     */ 
     312    easeInOut: function(t, b, c, d) { 
     313        if ((t/=d/2) < 1) return c/2*t*t + b; 
     314        return -c/2 * ((--t)*(t-2) - 1) + b; 
     315    }, 
     316 
     317    CLASS_NAME: "OpenLayers.Easing.Quad" 
     318}; 
  • trunk/openlayers/tests/manual/tween.html

    r6131 r6415  
    6666        <option value="Linear">Linear</option> 
    6767        <option value="Expo">Expo</option> 
     68        <option value="Quad">Quad</option> 
    6869    </select> 
    6970    <select name="easing" id="easing" onchange="changeTween()">