Added
Link Here
|
1 |
/******************************************************************************* |
2 |
* Port of Robert Penner's easing equations for Nebula animation package. |
3 |
* Copyright (c) 2008-2009 Nicolas Richeton. |
4 |
* All rights reserved. This program and the accompanying materials |
5 |
* are made available under the terms of the Eclipse Public License v1.0 |
6 |
* which accompanies this distribution, and is available at |
7 |
* http://www.eclipse.org/legal/epl-v10.html |
8 |
* |
9 |
*******************************************************************************/ |
10 |
|
11 |
/********************************************************************************* |
12 |
* TERMS OF USE - EASING EQUATIONS |
13 |
* |
14 |
* Open source under the BSD License. |
15 |
* |
16 |
* Copyright (c) 2001 Robert Penner |
17 |
* All rights reserved. |
18 |
* |
19 |
* Redistribution and use in source and binary forms, with or without |
20 |
* modification, are permitted provided that the following conditions are met: |
21 |
* |
22 |
* * Redistributions of source code must retain the above copyright |
23 |
* notice, this list of conditions and the following disclaimer. |
24 |
* * Redistributions in binary form must reproduce the above copyright |
25 |
* notice, this list of conditions and the following disclaimer in the |
26 |
* documentation and/or other materials provided with the distribution. |
27 |
* * Neither the name of the author nor the names of contributors may be |
28 |
* used to endorse or promote products derived from this software without |
29 |
* specific prior written permission. |
30 |
* |
31 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
32 |
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
33 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
34 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
35 |
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
36 |
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
37 |
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
38 |
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
39 |
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
40 |
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
41 |
* POSSIBILITY OF SUCH DAMAGE. |
42 |
********************************************************************************/ |
43 |
|
44 |
package org.eclipse.nebula.animation.movement; |
45 |
|
46 |
public class QuartInOut extends AbstractMovement { |
47 |
|
48 |
public double getValue(double step) { |
49 |
// Conversion from Robert Penner's action scripts |
50 |
// |
51 |
// t : time -> step |
52 |
// b: min -> min |
53 |
// c : total increment -> max - min |
54 |
// d: duration -> duration |
55 |
|
56 |
double c = max - min; |
57 |
step = step / (duration / 2d); |
58 |
|
59 |
if ((step) < 1d) |
60 |
return c / 2d * step * step * step * step + min; |
61 |
|
62 |
return -c / 2d * ((step -= 2d) * step * step * step - 2d) + min; |
63 |
} |
64 |
} |