add the Quad easing methods for Tween

git-svn-id: http://svn.openlayers.org/trunk/openlayers@6415 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
pgiraud
2008-02-29 07:31:56 +00:00
parent 323de7085b
commit fde0715f4e
2 changed files with 49 additions and 0 deletions

View File

@@ -268,3 +268,51 @@ OpenLayers.Easing.Expo = {
CLASS_NAME: "OpenLayers.Easing.Expo"
};
/**
* Namespace: OpenLayers.Easing.Quad
*/
OpenLayers.Easing.Quad = {
/**
* Function: easeIn
*
* Parameters:
* t - {Float} time
* b - {Float} beginning position
* c - {Float} total change
* d - {Float} duration of the transition
*/
easeIn: function(t, b, c, d) {
return c*(t/=d)*t + b;
},
/**
* Function: easeOut
*
* Parameters:
* t - {Float} time
* b - {Float} beginning position
* c - {Float} total change
* d - {Float} duration of the transition
*/
easeOut: function(t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
/**
* Function: easeInOut
*
* Parameters:
* t - {Float} time
* b - {Float} beginning position
* c - {Float} total change
* d - {Float} duration of the transition
*/
easeInOut: function(t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
CLASS_NAME: "OpenLayers.Easing.Quad"
};

View File

@@ -65,6 +65,7 @@
<select name="transition" id="transition" onchange="changeTween()">
<option value="Linear">Linear</option>
<option value="Expo">Expo</option>
<option value="Quad">Quad</option>
</select>
<select name="easing" id="easing" onchange="changeTween()">
<option value="easeIn">EaseIn</option>