Skip to content

Commit 29ea62b

Browse files
committed
Merge pull request #10 from daimajia/ease
Robert Penner's Easing Functions
2 parents 6d4df20 + 2c9a65a commit 29ea62b

34 files changed

+1391
-29
lines changed

.travis.yml

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,66 @@
11
language: java
2+
3+
branches:
4+
only:
5+
- dev
6+
- master
7+
28
jdk: oraclejdk7
9+
310
env:
4-
matrix:
5-
- ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
11+
global:
12+
- ANDROID_SDK_VERSION="r22.6.2"
13+
14+
notifications:
15+
email: false
16+
617

718
before_install:
8-
# Install base Android SDK
19+
20+
# environment info
21+
- gradle -v
22+
- uname -a
23+
24+
# required libs for android build tools
25+
# Update a system for ia32 libraries
926
- sudo apt-get update -qq
10-
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi
11-
- wget http://dl.google.com/android/android-sdk_r22.3-linux.tgz
12-
- tar xzf android-sdk_r22.3-linux.tgz
13-
- export ANDROID_HOME=$PWD/android-sdk-linux
27+
- if [ `uname -m` = x86_64 ]; then sudo apt-get update; fi
28+
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch; fi
29+
30+
# for gradle output style
31+
- export TERM=dumb
32+
33+
# newer version of gradle
34+
# - wget http://services.gradle.org/distributions/gradle-1.12-bin.zip
35+
# - unzip -qq gradle-1.12-bin.zip
36+
# - export GRADLE_HOME=$PWD/gradle-1.11
37+
# - export PATH=$GRADLE_HOME/bin:$PATH
38+
39+
# just to test gradle version, against our provided one
40+
- gradle -v
41+
42+
# newest android SDK
43+
- wget http://dl.google.com/android/android-sdk_${ANDROID_SDK_VERSION}-linux.tgz
44+
- tar -zxf android-sdk_${ANDROID_SDK_VERSION}-linux.tgz
45+
- export ANDROID_HOME=`pwd`/android-sdk-linux
1446
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
1547

16-
# Gradle
17-
- wget http://services.gradle.org/distributions/gradle-1.9-bin.zip
18-
- unzip gradle-1.9-bin.zip
19-
- export GRADLE_HOME=$PWD/gradle-1.9
20-
- export PATH=$GRADLE_HOME/bin:$PATH
48+
# manually set sdk.dir variable, according to local paths
49+
- echo "sdk.dir=$ANDROID_HOME" > local.properties
2150

22-
# Install required components
51+
# Install required components.
2352
# For a full list, run `android list sdk -a --extended`
24-
# Note that sysimg-19 downloads only ARM, because only the first license query is accepted.
2553
- echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
26-
- echo yes | android update sdk --all --filter build-tools-19.0.3 --no-ui --force > /dev/null
54+
- echo yes | android update sdk --all --filter build-tools-19.1.0 --no-ui --force > /dev/null
2755
- echo yes | android update sdk --filter android-19 --no-ui --force > /dev/null
28-
- echo yes | android update sdk --filter sysimg-19 --no-ui --force > /dev/null
2956
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
3057
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
3158

32-
install:
33-
- ./gradlew assemble
59+
# Otherwise
60+
#- echo yes | android update sdk -t tools,platform-tools,extra-android-support,extra-android-m2repository,android-19 --force --no-ui
61+
62+
63+
# Let's try to build...
64+
install: ./gradlew clean build
65+
66+
script: gradle check

demo/src/main/res/menu/my.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
<item android:id="@+id/action_settings"
66
android:title="@string/action_example"
77
android:orderInCategory="100"
8-
app:showAsAction="never" />
8+
android:showAsAction="always" />
99
</menu>

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
# org.gradle.parallel=true
1919

2020

21-
VERSION_NAME=1.0.4
22-
VERSION_CODE=5
21+
VERSION_NAME=1.0.5
22+
VERSION_CODE=6
2323
GROUP=com.daimajia.androidanimations
2424

2525
POM_DESCRIPTION=Collect android animations

library/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "com.daimajia.androidanimations.library"
99
minSdkVersion 8
1010
targetSdkVersion 19
11-
versionCode 5
12-
versionName "1.0.4"
11+
versionCode 6
12+
versionName "1.0.5"
1313
}
1414
buildTypes {
1515
release {
@@ -21,7 +21,6 @@ android {
2121

2222
dependencies {
2323
compile fileTree(dir: 'libs', include: ['*.jar'])
24-
compile 'com.android.support:appcompat-v7:19.+'
2524
compile 'com.nineoldandroids:library:2.4.0'
2625
}
2726
apply from: './gradle-mvn-push.gradle'
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2014 daimajia
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
package com.daimajia.androidanimations.library.easing_functions;
26+
27+
import android.view.animation.Interpolator;
28+
29+
import com.nineoldandroids.animation.FloatEvaluator;
30+
31+
public abstract class BaseEasingMethod extends FloatEvaluator implements Interpolator{
32+
protected float mDuration;
33+
34+
35+
public BaseEasingMethod(float duration){
36+
mDuration = duration;
37+
}
38+
39+
public abstract float getInterpolation(float input);
40+
41+
public void setDuration(float duration){
42+
mDuration = duration;
43+
}
44+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2014 daimajia
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
package com.daimajia.androidanimations.library.easing_functions;
26+
27+
import com.nineoldandroids.animation.ObjectAnimator;
28+
import com.nineoldandroids.animation.PropertyValuesHolder;
29+
30+
public class Glider {
31+
32+
public static PropertyValuesHolder glide(Skill skill, float duration, PropertyValuesHolder propertyValuesHolder){
33+
propertyValuesHolder.setEvaluator(skill.getMethod(duration));
34+
return propertyValuesHolder;
35+
}
36+
37+
public static ObjectAnimator glide(Skill skill, float duration, ObjectAnimator animator){
38+
BaseEasingMethod t = skill.getMethod(duration);
39+
animator.setInterpolator(t);
40+
animator.setEvaluator(t);
41+
return animator;
42+
}
43+
44+
45+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2014 daimajia
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
package com.daimajia.androidanimations.library.easing_functions;
26+
27+
import com.daimajia.androidanimations.library.easing_functions.back.BackEaseIn;
28+
import com.daimajia.androidanimations.library.easing_functions.back.BackEaseInOut;
29+
import com.daimajia.androidanimations.library.easing_functions.back.BackEaseOut;
30+
import com.daimajia.androidanimations.library.easing_functions.bounce.BounceEaseIn;
31+
import com.daimajia.androidanimations.library.easing_functions.bounce.BounceEaseInOut;
32+
import com.daimajia.androidanimations.library.easing_functions.bounce.BounceEaseOut;
33+
import com.daimajia.androidanimations.library.easing_functions.circ.CircEaseIn;
34+
import com.daimajia.androidanimations.library.easing_functions.circ.CircEaseInOut;
35+
import com.daimajia.androidanimations.library.easing_functions.circ.CircEaseOut;
36+
import com.daimajia.androidanimations.library.easing_functions.cubic.CubicEaseIn;
37+
import com.daimajia.androidanimations.library.easing_functions.cubic.CubicEaseInOut;
38+
import com.daimajia.androidanimations.library.easing_functions.cubic.CubicEaseOut;
39+
import com.daimajia.androidanimations.library.easing_functions.elastic.ElasticEaseIn;
40+
import com.daimajia.androidanimations.library.easing_functions.elastic.ElasticEaseOut;
41+
import com.daimajia.androidanimations.library.easing_functions.expo.ExpoEaseIn;
42+
import com.daimajia.androidanimations.library.easing_functions.expo.ExpoEaseInOut;
43+
import com.daimajia.androidanimations.library.easing_functions.expo.ExpoEaseOut;
44+
import com.daimajia.androidanimations.library.easing_functions.quad.QuadEaseIn;
45+
import com.daimajia.androidanimations.library.easing_functions.quad.QuadEaseInOut;
46+
import com.daimajia.androidanimations.library.easing_functions.quad.QuadEaseOut;
47+
import com.daimajia.androidanimations.library.easing_functions.quint.QuintEaseIn;
48+
import com.daimajia.androidanimations.library.easing_functions.quint.QuintEaseInOut;
49+
import com.daimajia.androidanimations.library.easing_functions.quint.QuintEaseOut;
50+
import com.daimajia.androidanimations.library.easing_functions.sine.SineEaseIn;
51+
import com.daimajia.androidanimations.library.easing_functions.sine.SineEaseInOut;
52+
import com.daimajia.androidanimations.library.easing_functions.sine.SineEaseOut;
53+
54+
public enum Skill {
55+
56+
BackEaseIn(BackEaseIn.class),
57+
BackEaseOut(BackEaseOut.class),
58+
BackEaseInOut(BackEaseInOut.class),
59+
60+
BounceEaseIn(BounceEaseIn.class),
61+
BounceEaseOut(BounceEaseOut.class),
62+
BounceEaseInOut(BounceEaseInOut.class),
63+
64+
CircEaseIn(CircEaseIn.class),
65+
CircEaseOut(CircEaseOut.class),
66+
CircEaseInOut(CircEaseInOut.class),
67+
68+
CubicEaseIn(CubicEaseIn.class),
69+
CubicEaseOut(CubicEaseOut.class),
70+
CubicEaseInOut(CubicEaseInOut.class),
71+
72+
ElasticEaseIn(ElasticEaseIn.class),
73+
ElasticEaseOut(ElasticEaseOut.class),
74+
75+
ExpoEaseIn(ExpoEaseIn.class),
76+
ExpoEaseOut(ExpoEaseOut.class),
77+
ExpoEaseInOut(ExpoEaseInOut.class),
78+
79+
QuadEaseIn(QuadEaseIn.class),
80+
QuadEaseOut(QuadEaseOut.class),
81+
QuadEaseInOut(QuadEaseInOut.class),
82+
83+
QuintEaseIn(QuintEaseIn.class),
84+
QuintEaseOut(QuintEaseOut.class),
85+
QuintEaseInOut(QuintEaseInOut.class),
86+
87+
SineEaseIn(SineEaseIn.class),
88+
SineEaseOut(SineEaseOut.class),
89+
SineEaseInOut(SineEaseInOut.class);
90+
91+
92+
private Class easingMethod;
93+
94+
private Skill(Class clazz) {
95+
easingMethod = clazz;
96+
}
97+
98+
public BaseEasingMethod getMethod(float duration) {
99+
try {
100+
return (BaseEasingMethod)easingMethod.getConstructor(float.class).newInstance(duration);
101+
} catch (Exception e) {
102+
e.printStackTrace();
103+
throw new Error("Can not init easingMethod instance");
104+
}
105+
}
106+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2014 daimajia
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
package com.daimajia.androidanimations.library.easing_functions.back;
26+
27+
import com.daimajia.androidanimations.library.easing_functions.BaseEasingMethod;
28+
29+
public class BackEaseIn extends BaseEasingMethod{
30+
31+
private float s = 1.70158f;
32+
33+
public BackEaseIn(float duration) {
34+
super(duration);
35+
}
36+
37+
public BackEaseIn(float duration, float back){
38+
this(duration);
39+
s = back;
40+
}
41+
42+
@Override
43+
public float getInterpolation(float input) {
44+
return input*input*((s+1)*input - s);
45+
}
46+
}

0 commit comments

Comments
 (0)