-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from daimajia/ease
Robert Penner's Easing Functions
- Loading branch information
Showing
34 changed files
with
1,391 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,66 @@ | ||
language: java | ||
|
||
branches: | ||
only: | ||
- dev | ||
- master | ||
|
||
jdk: oraclejdk7 | ||
|
||
env: | ||
matrix: | ||
- ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a | ||
global: | ||
- ANDROID_SDK_VERSION="r22.6.2" | ||
|
||
notifications: | ||
email: false | ||
|
||
|
||
before_install: | ||
# Install base Android SDK | ||
|
||
# environment info | ||
- gradle -v | ||
- uname -a | ||
|
||
# required libs for android build tools | ||
# Update a system for ia32 libraries | ||
- sudo apt-get update -qq | ||
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi | ||
- wget http://dl.google.com/android/android-sdk_r22.3-linux.tgz | ||
- tar xzf android-sdk_r22.3-linux.tgz | ||
- export ANDROID_HOME=$PWD/android-sdk-linux | ||
- if [ `uname -m` = x86_64 ]; then sudo apt-get update; fi | ||
- if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch; fi | ||
|
||
# for gradle output style | ||
- export TERM=dumb | ||
|
||
# newer version of gradle | ||
# - wget http://services.gradle.org/distributions/gradle-1.12-bin.zip | ||
# - unzip -qq gradle-1.12-bin.zip | ||
# - export GRADLE_HOME=$PWD/gradle-1.11 | ||
# - export PATH=$GRADLE_HOME/bin:$PATH | ||
|
||
# just to test gradle version, against our provided one | ||
- gradle -v | ||
|
||
# newest android SDK | ||
- wget http://dl.google.com/android/android-sdk_${ANDROID_SDK_VERSION}-linux.tgz | ||
- tar -zxf android-sdk_${ANDROID_SDK_VERSION}-linux.tgz | ||
- export ANDROID_HOME=`pwd`/android-sdk-linux | ||
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools | ||
|
||
# Gradle | ||
- wget http://services.gradle.org/distributions/gradle-1.9-bin.zip | ||
- unzip gradle-1.9-bin.zip | ||
- export GRADLE_HOME=$PWD/gradle-1.9 | ||
- export PATH=$GRADLE_HOME/bin:$PATH | ||
# manually set sdk.dir variable, according to local paths | ||
- echo "sdk.dir=$ANDROID_HOME" > local.properties | ||
|
||
# Install required components | ||
# Install required components. | ||
# For a full list, run `android list sdk -a --extended` | ||
# Note that sysimg-19 downloads only ARM, because only the first license query is accepted. | ||
- echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null | ||
- echo yes | android update sdk --all --filter build-tools-19.0.3 --no-ui --force > /dev/null | ||
- echo yes | android update sdk --all --filter build-tools-19.1.0 --no-ui --force > /dev/null | ||
- echo yes | android update sdk --filter android-19 --no-ui --force > /dev/null | ||
- echo yes | android update sdk --filter sysimg-19 --no-ui --force > /dev/null | ||
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null | ||
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null | ||
|
||
install: | ||
- ./gradlew assemble | ||
# Otherwise | ||
#- echo yes | android update sdk -t tools,platform-tools,extra-android-support,extra-android-m2repository,android-19 --force --no-ui | ||
|
||
|
||
# Let's try to build... | ||
install: ./gradlew clean build | ||
|
||
script: gradle check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...c/main/java/com/daimajia/androidanimations/library/easing_functions/BaseEasingMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2014 daimajia | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package com.daimajia.androidanimations.library.easing_functions; | ||
|
||
import android.view.animation.Interpolator; | ||
|
||
import com.nineoldandroids.animation.FloatEvaluator; | ||
|
||
public abstract class BaseEasingMethod extends FloatEvaluator implements Interpolator{ | ||
protected float mDuration; | ||
|
||
|
||
public BaseEasingMethod(float duration){ | ||
mDuration = duration; | ||
} | ||
|
||
public abstract float getInterpolation(float input); | ||
|
||
public void setDuration(float duration){ | ||
mDuration = duration; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
library/src/main/java/com/daimajia/androidanimations/library/easing_functions/Glider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2014 daimajia | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package com.daimajia.androidanimations.library.easing_functions; | ||
|
||
import com.nineoldandroids.animation.ObjectAnimator; | ||
import com.nineoldandroids.animation.PropertyValuesHolder; | ||
|
||
public class Glider { | ||
|
||
public static PropertyValuesHolder glide(Skill skill, float duration, PropertyValuesHolder propertyValuesHolder){ | ||
propertyValuesHolder.setEvaluator(skill.getMethod(duration)); | ||
return propertyValuesHolder; | ||
} | ||
|
||
public static ObjectAnimator glide(Skill skill, float duration, ObjectAnimator animator){ | ||
BaseEasingMethod t = skill.getMethod(duration); | ||
animator.setInterpolator(t); | ||
animator.setEvaluator(t); | ||
return animator; | ||
} | ||
|
||
|
||
} |
106 changes: 106 additions & 0 deletions
106
library/src/main/java/com/daimajia/androidanimations/library/easing_functions/Skill.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2014 daimajia | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package com.daimajia.androidanimations.library.easing_functions; | ||
|
||
import com.daimajia.androidanimations.library.easing_functions.back.BackEaseIn; | ||
import com.daimajia.androidanimations.library.easing_functions.back.BackEaseInOut; | ||
import com.daimajia.androidanimations.library.easing_functions.back.BackEaseOut; | ||
import com.daimajia.androidanimations.library.easing_functions.bounce.BounceEaseIn; | ||
import com.daimajia.androidanimations.library.easing_functions.bounce.BounceEaseInOut; | ||
import com.daimajia.androidanimations.library.easing_functions.bounce.BounceEaseOut; | ||
import com.daimajia.androidanimations.library.easing_functions.circ.CircEaseIn; | ||
import com.daimajia.androidanimations.library.easing_functions.circ.CircEaseInOut; | ||
import com.daimajia.androidanimations.library.easing_functions.circ.CircEaseOut; | ||
import com.daimajia.androidanimations.library.easing_functions.cubic.CubicEaseIn; | ||
import com.daimajia.androidanimations.library.easing_functions.cubic.CubicEaseInOut; | ||
import com.daimajia.androidanimations.library.easing_functions.cubic.CubicEaseOut; | ||
import com.daimajia.androidanimations.library.easing_functions.elastic.ElasticEaseIn; | ||
import com.daimajia.androidanimations.library.easing_functions.elastic.ElasticEaseOut; | ||
import com.daimajia.androidanimations.library.easing_functions.expo.ExpoEaseIn; | ||
import com.daimajia.androidanimations.library.easing_functions.expo.ExpoEaseInOut; | ||
import com.daimajia.androidanimations.library.easing_functions.expo.ExpoEaseOut; | ||
import com.daimajia.androidanimations.library.easing_functions.quad.QuadEaseIn; | ||
import com.daimajia.androidanimations.library.easing_functions.quad.QuadEaseInOut; | ||
import com.daimajia.androidanimations.library.easing_functions.quad.QuadEaseOut; | ||
import com.daimajia.androidanimations.library.easing_functions.quint.QuintEaseIn; | ||
import com.daimajia.androidanimations.library.easing_functions.quint.QuintEaseInOut; | ||
import com.daimajia.androidanimations.library.easing_functions.quint.QuintEaseOut; | ||
import com.daimajia.androidanimations.library.easing_functions.sine.SineEaseIn; | ||
import com.daimajia.androidanimations.library.easing_functions.sine.SineEaseInOut; | ||
import com.daimajia.androidanimations.library.easing_functions.sine.SineEaseOut; | ||
|
||
public enum Skill { | ||
|
||
BackEaseIn(BackEaseIn.class), | ||
BackEaseOut(BackEaseOut.class), | ||
BackEaseInOut(BackEaseInOut.class), | ||
|
||
BounceEaseIn(BounceEaseIn.class), | ||
BounceEaseOut(BounceEaseOut.class), | ||
BounceEaseInOut(BounceEaseInOut.class), | ||
|
||
CircEaseIn(CircEaseIn.class), | ||
CircEaseOut(CircEaseOut.class), | ||
CircEaseInOut(CircEaseInOut.class), | ||
|
||
CubicEaseIn(CubicEaseIn.class), | ||
CubicEaseOut(CubicEaseOut.class), | ||
CubicEaseInOut(CubicEaseInOut.class), | ||
|
||
ElasticEaseIn(ElasticEaseIn.class), | ||
ElasticEaseOut(ElasticEaseOut.class), | ||
|
||
ExpoEaseIn(ExpoEaseIn.class), | ||
ExpoEaseOut(ExpoEaseOut.class), | ||
ExpoEaseInOut(ExpoEaseInOut.class), | ||
|
||
QuadEaseIn(QuadEaseIn.class), | ||
QuadEaseOut(QuadEaseOut.class), | ||
QuadEaseInOut(QuadEaseInOut.class), | ||
|
||
QuintEaseIn(QuintEaseIn.class), | ||
QuintEaseOut(QuintEaseOut.class), | ||
QuintEaseInOut(QuintEaseInOut.class), | ||
|
||
SineEaseIn(SineEaseIn.class), | ||
SineEaseOut(SineEaseOut.class), | ||
SineEaseInOut(SineEaseInOut.class); | ||
|
||
|
||
private Class easingMethod; | ||
|
||
private Skill(Class clazz) { | ||
easingMethod = clazz; | ||
} | ||
|
||
public BaseEasingMethod getMethod(float duration) { | ||
try { | ||
return (BaseEasingMethod)easingMethod.getConstructor(float.class).newInstance(duration); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
throw new Error("Can not init easingMethod instance"); | ||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...rc/main/java/com/daimajia/androidanimations/library/easing_functions/back/BackEaseIn.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2014 daimajia | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package com.daimajia.androidanimations.library.easing_functions.back; | ||
|
||
import com.daimajia.androidanimations.library.easing_functions.BaseEasingMethod; | ||
|
||
public class BackEaseIn extends BaseEasingMethod{ | ||
|
||
private float s = 1.70158f; | ||
|
||
public BackEaseIn(float duration) { | ||
super(duration); | ||
} | ||
|
||
public BackEaseIn(float duration, float back){ | ||
this(duration); | ||
s = back; | ||
} | ||
|
||
@Override | ||
public float getInterpolation(float input) { | ||
return input*input*((s+1)*input - s); | ||
} | ||
} |
Oops, something went wrong.