web/static/res/js/Ease.js
author Edwin Razafimahatratra <edwin@robotalismsoft.com>
Wed, 12 Dec 2012 15:54:57 +0100
changeset 48 d92196482ad9
parent 23 45b05706b516
permissions -rw-r--r--
tweaks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     1
/*
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     2
* Ease
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     3
* Visit http://createjs.com/ for documentation, updates and examples.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     4
*
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     5
* Copyright (c) 2010 gskinner.com, inc.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     6
* 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     7
* Permission is hereby granted, free of charge, to any person
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     8
* obtaining a copy of this software and associated documentation
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
     9
* files (the "Software"), to deal in the Software without
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    10
* restriction, including without limitation the rights to use,
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    11
* copy, modify, merge, publish, distribute, sublicense, and/or sell
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    12
* copies of the Software, and to permit persons to whom the
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    13
* Software is furnished to do so, subject to the following
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    14
* conditions:
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    15
* 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    16
* The above copyright notice and this permission notice shall be
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    17
* included in all copies or substantial portions of the Software.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    18
* 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    19
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    20
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    21
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    22
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    23
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    24
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    25
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    26
* OTHER DEALINGS IN THE SOFTWARE.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    27
*/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    28
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    29
// namespace:
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    30
this.createjs = this.createjs||{};
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    31
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    32
(function() {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    33
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    34
// constructor:
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    35
/**
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    36
 * The Ease class provides a collection of easing functions for use with TweenJS.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    37
 * It does not use the standard 4 param easing signature. Instead it uses a single param
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    38
 * which indicates the current linear ratio (0 to 1) of the tween.<br/>
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    39
 * <br/>
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    40
 * Most methods on Ease can be passed directly as easing functions:<br/>
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    41
 * Tween.get(target).to({x:100}, 500, Ease.linear);<br/>
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    42
 * <br/>
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    43
 * However, methods beginning with "get" will return an easing function based on parameter values:<br/>
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    44
 * Tween.get(target).to({y:200}, 500, Ease.getPowIn(2.2));<br/>
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    45
 * <br/>
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    46
 * Equations derived from work by Robert Penner.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    47
 * @class Ease
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    48
 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    49
 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    50
var Ease = function() {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    51
	throw "Ease cannot be instantiated.";
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    52
}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    53
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    54
// public static methods:
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    55
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    56
	 * @method linear
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    57
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    58
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    59
	Ease.linear = function(t) { return t; }
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    60
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    61
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    62
	 * Identical to linear.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    63
	 * @method none
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    64
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    65
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    66
	Ease.none = Ease.linear;
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    67
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    68
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    69
	 * Mimics the simple -100 to 100 easing in Flash Pro.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    70
	 * @method get
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    71
	 * @param amount A value from -1 (ease in) to 1 (ease out) indicating the strength and direction of the ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    72
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    73
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    74
	Ease.get = function(amount) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    75
		if (amount < -1) { amount = -1; }
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    76
		if (amount > 1) { amount = 1; }
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    77
		return function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    78
			if (amount==0) { return t; }
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    79
			if (amount<0) { return t*(t*-amount+1+amount); }
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    80
			return t*((2-t)*amount+(1-amount));
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    81
		}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    82
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    83
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    84
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    85
	 * Configurable exponential ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    86
	 * @method getPowIn
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    87
	 * @param pow The exponent to use (ex. 3 would return a cubic ease).
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    88
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    89
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    90
	Ease.getPowIn = function(pow) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    91
		return function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    92
			return Math.pow(t,pow);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    93
		}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    94
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    95
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    96
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    97
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    98
	 * Configurable exponential ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
    99
	 * @method getPowOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   100
	 * @param pow The exponent to use (ex. 3 would return a cubic ease).
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   101
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   102
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   103
	Ease.getPowOut = function(pow) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   104
		return function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   105
			return 1-Math.pow(1-t,pow);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   106
		}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   107
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   108
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   109
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   110
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   111
	 * Configurable exponential ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   112
	 * @method getPowInOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   113
	 * @param pow The exponent to use (ex. 3 would return a cubic ease).
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   114
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   115
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   116
	Ease.getPowInOut = function(pow) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   117
		return function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   118
			if ((t*=2)<1) return 0.5*Math.pow(t,pow);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   119
			return 1-0.5*Math.abs(Math.pow(2-t,pow));
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   120
		}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   121
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   122
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   123
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   124
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   125
	 * @method quadIn
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   126
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   127
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   128
	Ease.quadIn = Ease.getPowIn(2);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   129
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   130
	 * @method quadOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   131
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   132
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   133
	Ease.quadOut = Ease.getPowOut(2);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   134
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   135
	 * @method quadInOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   136
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   137
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   138
	Ease.quadInOut = Ease.getPowInOut(2);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   139
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   140
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   141
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   142
	 * @method cubicIn
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   143
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   144
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   145
	Ease.cubicIn = Ease.getPowIn(3);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   146
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   147
	 * @method cubicOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   148
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   149
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   150
	Ease.cubicOut = Ease.getPowOut(3);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   151
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   152
	 * @method cubicInOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   153
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   154
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   155
	Ease.cubicInOut = Ease.getPowInOut(3);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   156
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   157
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   158
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   159
	 * @method quartIn
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   160
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   161
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   162
	Ease.quartIn = Ease.getPowIn(4);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   163
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   164
	 * @method quartOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   165
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   166
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   167
	Ease.quartOut = Ease.getPowOut(4);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   168
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   169
	 * @method quartInOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   170
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   171
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   172
	Ease.quartInOut = Ease.getPowInOut(4);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   173
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   174
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   175
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   176
	 * @method quintIn
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   177
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   178
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   179
	Ease.quintIn = Ease.getPowIn(5);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   180
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   181
	 * @method quintOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   182
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   183
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   184
	Ease.quintOut = Ease.getPowOut(5);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   185
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   186
	 * @method quintInOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   187
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   188
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   189
	Ease.quintInOut = Ease.getPowInOut(5);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   190
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   191
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   192
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   193
	 * @method sineIn
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   194
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   195
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   196
	Ease.sineIn = function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   197
		return 1-Math.cos(t*Math.PI/2);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   198
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   199
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   200
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   201
	 * @method sineOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   202
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   203
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   204
	Ease.sineOut = function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   205
		return Math.sin(t*Math.PI/2);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   206
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   207
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   208
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   209
	 * @method sineInOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   210
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   211
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   212
	Ease.sineInOut = function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   213
		return -0.5*(Math.cos(Math.PI*t) - 1)
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   214
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   215
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   216
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   217
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   218
	 * Configurable "back in" ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   219
	 * @method getBackIn
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   220
	 * @param amount The strength of the ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   221
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   222
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   223
	Ease.getBackIn = function(amount) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   224
		return function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   225
			return t*t*((amount+1)*t-amount);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   226
		}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   227
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   228
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   229
	 * @method backIn
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   230
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   231
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   232
	Ease.backIn = Ease.getBackIn(1.7);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   233
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   234
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   235
	 * Configurable "back out" ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   236
	 * @method getBackOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   237
	 * @param amount The strength of the ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   238
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   239
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   240
	Ease.getBackOut = function(amount) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   241
		return function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   242
			return (--t*t*((amount+1)*t + amount) + 1);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   243
		}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   244
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   245
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   246
	 * @method backOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   247
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   248
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   249
	Ease.backOut = Ease.getBackOut(1.7);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   250
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   251
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   252
	 * Configurable "back in out" ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   253
	 * @method getBackInOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   254
	 * @param amount The strength of the ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   255
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   256
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   257
	Ease.getBackInOut = function(amount) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   258
		amount*=1.525;
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   259
		return function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   260
			if ((t*=2)<1) return 0.5*(t*t*((amount+1)*t-amount));
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   261
			return 0.5*((t-=2)*t*((amount+1)*t+amount)+2);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   262
		}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   263
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   264
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   265
	 * @method backInOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   266
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   267
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   268
	Ease.backInOut = Ease.getBackInOut(1.7);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   269
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   270
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   271
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   272
	 * @method circIn
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   273
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   274
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   275
	Ease.circIn = function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   276
		return -(Math.sqrt(1-t*t)- 1);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   277
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   278
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   279
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   280
	 * @method circOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   281
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   282
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   283
	Ease.circOut = function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   284
		return Math.sqrt(1-(--t)*t);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   285
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   286
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   287
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   288
	 * @method circInOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   289
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   290
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   291
	Ease.circInOut = function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   292
		if ((t*=2) < 1) return -0.5*(Math.sqrt(1-t*t)-1);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   293
		return 0.5*(Math.sqrt(1-(t-=2)*t)+1);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   294
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   295
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   296
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   297
	 * @method bounceIn
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   298
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   299
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   300
	Ease.bounceIn = function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   301
		return 1-Ease.bounceOut(1-t);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   302
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   303
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   304
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   305
	 * @method bounceOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   306
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   307
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   308
	Ease.bounceOut = function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   309
		if (t < 1/2.75) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   310
			return (7.5625*t*t);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   311
		} else if (t < 2/2.75) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   312
			return (7.5625*(t-=1.5/2.75)*t+0.75);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   313
		} else if (t < 2.5/2.75) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   314
			return (7.5625*(t-=2.25/2.75)*t+0.9375);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   315
		} else {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   316
			return (7.5625*(t-=2.625/2.75)*t +0.984375);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   317
		}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   318
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   319
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   320
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   321
	 * @method bounceInOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   322
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   323
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   324
	Ease.bounceInOut = function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   325
		if (t<0.5) return Ease.bounceIn (t*2) * .5;
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   326
		return Ease.bounceOut(t*2-1)*0.5+0.5;
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   327
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   328
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   329
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   330
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   331
	 * Configurable elastic ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   332
	 * @method getElasticIn
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   333
	 * @param amplitude
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   334
	 * @param period
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   335
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   336
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   337
	Ease.getElasticIn = function(amplitude,period) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   338
		var pi2 = Math.PI*2;
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   339
		return function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   340
			if (t==0 || t==1) return t;
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   341
			var s = period/pi2*Math.asin(1/amplitude);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   342
			return -(amplitude*Math.pow(2,10*(t-=1))*Math.sin((t-s)*pi2/period));
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   343
		}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   344
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   345
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   346
	 * @method elasticIn
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   347
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   348
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   349
	Ease.elasticIn = Ease.getElasticIn(1,0.3);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   350
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   351
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   352
	 * Configurable elastic ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   353
	 * @method getElasticOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   354
	 * @param amplitude
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   355
	 * @param period
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   356
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   357
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   358
	Ease.getElasticOut = function(amplitude,period) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   359
		var pi2 = Math.PI*2;
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   360
		return function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   361
			if (t==0 || t==1) return t;
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   362
			var s = period/pi2 * Math.asin(1/amplitude);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   363
			return (amplitude*Math.pow(2,-10*t)*Math.sin((t-s)*pi2/period )+1);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   364
		}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   365
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   366
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   367
	 * @method elasticOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   368
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   369
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   370
	Ease.elasticOut = Ease.getElasticOut(1,0.3);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   371
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   372
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   373
	 * Configurable elastic ease.
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   374
	 * @method getElasticInOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   375
	 * @param amplitude
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   376
	 * @param period
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   377
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   378
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   379
	Ease.getElasticInOut = function(amplitude,period) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   380
		var pi2 = Math.PI*2;
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   381
		return function(t) {
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   382
			var s = period/pi2 * Math.asin(1/amplitude);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   383
			if ((t*=2)<1) return -0.5*(amplitude*Math.pow(2,10*(t-=1))*Math.sin( (t-s)*pi2/period ));
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   384
			return amplitude*Math.pow(2,-10*(t-=1))*Math.sin((t-s)*pi2/period)*0.5+1;
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   385
		}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   386
	}
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   387
	/** 
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   388
	 * @method elasticInOut
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   389
	 * @static
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   390
	 **/
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   391
	Ease.elasticInOut = Ease.getElasticInOut(1,0.3*1.5);
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   392
	
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   393
createjs.Ease = Ease;
45b05706b516 mosaic effect js first test
Edwin Razafimahatratra <edwin@robotalismsoft.com>
parents:
diff changeset
   394
}());