├── demo
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── drawable-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── values
│ │ │ ├── dimens.xml
│ │ │ ├── styles.xml
│ │ │ └── strings.xml
│ │ ├── drawable
│ │ │ └── circle.xml
│ │ ├── layout
│ │ │ ├── item.xml
│ │ │ └── activity_my.xml
│ │ ├── menu
│ │ │ └── my.xml
│ │ └── values-w820dp
│ │ │ └── dimens.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── daimajia
│ │ └── com
│ │ └── easing
│ │ ├── EasingAdapter.java
│ │ ├── MyActivity.java
│ │ └── DrawView.java
├── proguard-rules.pro
└── build.gradle
├── library
├── .gitignore
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── daimajia
│ │ └── easing
│ │ ├── quad
│ │ ├── QuadEaseIn.java
│ │ ├── QuadEaseOut.java
│ │ └── QuadEaseInOut.java
│ │ ├── quint
│ │ ├── QuintEaseIn.java
│ │ ├── QuintEaseOut.java
│ │ └── QuintEaseInOut.java
│ │ ├── cubic
│ │ ├── CubicEaseIn.java
│ │ ├── CubicEaseOut.java
│ │ └── CubicEaseInOut.java
│ │ ├── sine
│ │ ├── SineEaseOut.java
│ │ ├── SineEaseIn.java
│ │ └── SineEaseInOut.java
│ │ ├── circ
│ │ ├── CircEaseIn.java
│ │ ├── CircEaseOut.java
│ │ └── CircEaseInOut.java
│ │ ├── expo
│ │ ├── ExpoEaseIn.java
│ │ ├── ExpoEaseOut.java
│ │ └── ExpoEaseInOut.java
│ │ ├── linear
│ │ └── Linear.java
│ │ ├── bounce
│ │ ├── BounceEaseIn.java
│ │ ├── BounceEaseOut.java
│ │ └── BounceEaseInOut.java
│ │ ├── back
│ │ ├── BackEaseIn.java
│ │ ├── BackEaseOut.java
│ │ └── BackEaseInOut.java
│ │ ├── elastic
│ │ ├── ElasticEaseIn.java
│ │ ├── ElasticEaseOut.java
│ │ └── ElasticEaseInOut.java
│ │ ├── Glider.java
│ │ ├── BaseEasingMethod.java
│ │ └── Skill.java
├── build.gradle
├── proguard-rules.pro
├── gradle.properties
└── gradle-mvn-push.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .travis.yml
├── .gitignore
├── LICENSE
├── gradle.properties
├── README.md
├── gradlew.bat
└── gradlew
/demo/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':demo', ':library'
2 |
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimajia/AnimationEasingFunctions/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/demo/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimajia/AnimationEasingFunctions/HEAD/demo/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimajia/AnimationEasingFunctions/HEAD/demo/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimajia/AnimationEasingFunctions/HEAD/demo/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/daimajia/AnimationEasingFunctions/HEAD/demo/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/demo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 | android:
3 | components:
4 | - tools
5 | - platform-tools
6 | - build-tools-25.0.2
7 | - android-25
8 | - extra-android-support
9 | - extra
10 | - extra-android-m2repository
11 | script:
12 | - ./gradlew assembleDebug
--------------------------------------------------------------------------------
/demo/src/main/res/drawable/circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Aug 22 19:01:10 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/demo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | AndroidAnimationEasing
5 | Hello world!
6 | Settings
7 |
8 |
9 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/item.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/demo/src/main/res/menu/my.xml:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/demo/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | .DS_Store
5 | /build
6 | # built application files
7 | *.apk
8 | *.ap_
9 |
10 | # files for the dex VM
11 | *.dex
12 |
13 | # Java class files
14 | *.class
15 | .DS_Store
16 |
17 | # generated files
18 | bin/
19 | gen/
20 | Wiki/
21 |
22 | # Local configuration file (sdk path, etc)
23 | local.properties
24 |
25 | # Eclipse project files
26 | .classpath
27 | .project
28 | .settings/
29 |
30 | # Proguard folder generated by Eclipse
31 | proguard/
32 |
33 | #Android Studio
34 | build/
35 |
36 | # Intellij project files
37 | *.iml
38 | *.ipr
39 | *.iws
40 | .idea/
41 |
42 | #gradle
43 | .gradle/
44 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion COMPILE_SDK_VERSION.toInteger()
5 |
6 | defaultConfig {
7 | minSdkVersion MIN_SDK_VERSION.toInteger()
8 | targetSdkVersion TARGET_SDK_VERSION.toInteger()
9 | versionCode VERSION_CODE.toInteger()
10 | versionName VERSION_NAME
11 | }
12 |
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | consumerProguardFiles 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | implementation fileTree(dir: 'libs', include: ['*.jar'])
23 | }
24 |
25 | apply from: './gradle-mvn-push.gradle'
26 |
--------------------------------------------------------------------------------
/demo/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Applications/Android Studio.app/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/demo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/demo/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion COMPILE_SDK_VERSION.toInteger()
5 |
6 | defaultConfig {
7 | applicationId GROUP
8 | minSdkVersion MIN_SDK_VERSION.toInteger()
9 | targetSdkVersion TARGET_SDK_VERSION.toInteger()
10 | versionCode VERSION_CODE.toInteger()
11 | versionName VERSION_NAME
12 | }
13 |
14 | lintOptions {
15 | abortOnError false
16 | }
17 |
18 | buildTypes {
19 | release {
20 | minifyEnabled true
21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | implementation fileTree(dir: 'libs', include: ['*.jar'])
28 | implementation project(':library')
29 | }
30 |
--------------------------------------------------------------------------------
/library/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Applications/Android Studio.app/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 | -keep class com.daimajia.easing.** { *; }
19 | -keep interface com.daimajia.easing.** { *; }
20 |
--------------------------------------------------------------------------------
/library/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Settings specified in this file will override any Gradle settings
5 | # configured through the IDE.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | POM_NAME=AndroidEasingFunctions Library
21 | POM_ARTIFACT_ID=library
22 | POM_PACKAGING=aar
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017 daimajia
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/demo/src/main/res/layout/activity_my.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
23 |
28 |
29 |
--------------------------------------------------------------------------------
/demo/src/main/java/daimajia/com/easing/EasingAdapter.java:
--------------------------------------------------------------------------------
1 | package daimajia.com.easing;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.TextView;
9 |
10 | import com.daimajia.easing.BaseEasingMethod;
11 | import com.daimajia.easing.Skill;
12 |
13 | import daimajia.com.eaing.R;
14 |
15 | public class EasingAdapter extends BaseAdapter {
16 |
17 | private Context mContext;
18 | public EasingAdapter(Context context) {
19 | mContext = context;
20 | }
21 |
22 | @Override
23 | public int getCount() {
24 | return Skill.values().length;
25 | }
26 |
27 | @Override
28 | public Object getItem(int i) {
29 | return Skill.values()[i];
30 | }
31 |
32 | @Override
33 | public long getItemId(int i) {
34 | return i;
35 | }
36 |
37 | @Override
38 | public View getView(int i, View view, ViewGroup viewGroup) {
39 | Object o = getItem(i);
40 | BaseEasingMethod b = ((Skill)o).getMethod(1000);
41 | int start = b.getClass().getName().lastIndexOf(".") + 1;
42 | String name = b.getClass().getName().substring(start);
43 | View v = LayoutInflater.from(mContext).inflate(R.layout.item,null);
44 | TextView tv = (TextView)v.findViewById(R.id.list_item_text);
45 | tv.setText(name);
46 | v.setTag(o);
47 | return v;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Settings specified in this file will override any Gradle settings
5 | # configured through the IDE.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | COMPILE_SDK_VERSION=29
21 | TARGET_SDK_VERSION=29
22 | MIN_SDK_VERSION=11
23 |
24 | VERSION_NAME=2.4
25 | VERSION_CODE=8
26 | GROUP=com.daimajia.easing
27 |
28 | POM_DESCRIPTION=Android Animation Easing Functions
29 | POM_URL=https://github.com/daimajia/AnimationEasingFunctions
30 | POM_SCM_URL=https://github.com/daimajia/AnimationEasingFunctions
31 | POM_SCM_CONNECTION=scm:https://github.com/daimajia/AnimationEasingFunctions.git
32 | POM_SCM_DEV_CONNECTION=scm:https://github.com/daimajia/AnimationEasingFunctions.git
33 | POM_LICENCE_NAME=MIT
34 | POM_LICENCE_URL=http://opensource.org/licenses/MIT
35 | POM_LICENCE_DIST=repo
36 | POM_DEVELOPER_ID=daimajia
37 | POM_DEVELOPER_NAME=daimajia
38 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/quad/QuadEaseIn.java:
--------------------------------------------------------------------------------
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.easing.quad;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class QuadEaseIn extends BaseEasingMethod{
30 | public QuadEaseIn(float duration) {
31 | super(duration);
32 | }
33 |
34 | @Override
35 | public Float calculate(float t, float b, float c, float d) {
36 | return c*(t/=d)*t + b;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/quad/QuadEaseOut.java:
--------------------------------------------------------------------------------
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.easing.quad;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class QuadEaseOut extends BaseEasingMethod{
30 | public QuadEaseOut(float duration) {
31 | super(duration);
32 | }
33 |
34 | @Override
35 | public Float calculate(float t, float b, float c, float d) {
36 | return -c *(t/=d)*(t-2) + b;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/quint/QuintEaseIn.java:
--------------------------------------------------------------------------------
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.easing.quint;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class QuintEaseIn extends BaseEasingMethod{
30 | public QuintEaseIn(float duration) {
31 | super(duration);
32 | }
33 |
34 | @Override
35 | public Float calculate(float t, float b, float c, float d) {
36 | return c*(t/=d)*t*t*t*t + b;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/cubic/CubicEaseIn.java:
--------------------------------------------------------------------------------
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.easing.cubic;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class CubicEaseIn extends BaseEasingMethod{
30 |
31 | public CubicEaseIn(float duration) {
32 | super(duration);
33 | }
34 |
35 | @Override
36 | public Float calculate(float t, float b, float c, float d) {
37 | return c*(t/=d)*t*t + b;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/cubic/CubicEaseOut.java:
--------------------------------------------------------------------------------
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.easing.cubic;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class CubicEaseOut extends BaseEasingMethod {
30 |
31 | public CubicEaseOut(float duration) {
32 | super(duration);
33 | }
34 |
35 | @Override
36 | public Float calculate(float t, float b, float c, float d) {
37 | return c*((t=t/d-1)*t*t + 1) + b;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/quint/QuintEaseOut.java:
--------------------------------------------------------------------------------
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.easing.quint;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class QuintEaseOut extends BaseEasingMethod{
30 | public QuintEaseOut(float duration) {
31 | super(duration);
32 | }
33 |
34 | @Override
35 | public Float calculate(float t, float b, float c, float d) {
36 | return c*((t=t/d-1)*t*t*t*t + 1) + b;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/sine/SineEaseOut.java:
--------------------------------------------------------------------------------
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.easing.sine;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class SineEaseOut extends BaseEasingMethod{
30 | public SineEaseOut(float duration) {
31 | super(duration);
32 | }
33 |
34 | @Override
35 | public Float calculate(float t, float b, float c, float d) {
36 | return c * (float)Math.sin(t/d * (Math.PI/2)) + b;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/circ/CircEaseIn.java:
--------------------------------------------------------------------------------
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.easing.circ;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class CircEaseIn extends BaseEasingMethod{
30 |
31 | public CircEaseIn(float duration) {
32 | super(duration);
33 | }
34 |
35 | @Override
36 | public Float calculate(float t, float b, float c, float d) {
37 | return -c * ((float)Math.sqrt(1 - (t/=d)*t) - 1) + b;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/circ/CircEaseOut.java:
--------------------------------------------------------------------------------
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.easing.circ;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class CircEaseOut extends BaseEasingMethod{
30 |
31 | public CircEaseOut(float duration) {
32 | super(duration);
33 | }
34 |
35 | @Override
36 | public Float calculate(float t, float b, float c, float d) {
37 | return c * (float)Math.sqrt(1 - (t=t/d-1)*t) + b;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/expo/ExpoEaseIn.java:
--------------------------------------------------------------------------------
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.easing.expo;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class ExpoEaseIn extends BaseEasingMethod{
30 | public ExpoEaseIn(float duration) {
31 | super(duration);
32 | }
33 |
34 | @Override
35 | public Float calculate(float t, float b, float c, float d) {
36 | return (t==0) ? b : c * (float)Math.pow(2, 10 * (t/d - 1)) + b;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/sine/SineEaseIn.java:
--------------------------------------------------------------------------------
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.easing.sine;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class SineEaseIn extends BaseEasingMethod{
30 |
31 | public SineEaseIn(float duration) {
32 | super(duration);
33 | }
34 |
35 | @Override
36 | public Float calculate(float t, float b, float c, float d) {
37 | return -c * (float)Math.cos(t/d * (Math.PI/2)) + c + b;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/sine/SineEaseInOut.java:
--------------------------------------------------------------------------------
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.easing.sine;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class SineEaseInOut extends BaseEasingMethod{
30 | public SineEaseInOut(float duration) {
31 | super(duration);
32 | }
33 |
34 | @Override
35 | public Float calculate(float t, float b, float c, float d) {
36 | return -c/2 * ((float)Math.cos(Math.PI*t/d) - 1) + b;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/expo/ExpoEaseOut.java:
--------------------------------------------------------------------------------
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.easing.expo;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class ExpoEaseOut extends BaseEasingMethod{
30 | public ExpoEaseOut(float duration) {
31 | super(duration);
32 | }
33 |
34 | @Override
35 | public Float calculate(float t, float b, float c, float d) {
36 | return (t==d) ? b+c : c * (-(float)Math.pow(2, -10 * t/d) + 1) + b;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/linear/Linear.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * The MIT License (MIT)
4 | * *
5 | * * Copyright (c) 2014 daimajia
6 | * *
7 | * * Permission is hereby granted, free of charge, to any person obtaining a copy
8 | * * of this software and associated documentation files (the "Software"), to deal
9 | * * in the Software without restriction, including without limitation the rights
10 | * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | * * copies of the Software, and to permit persons to whom the Software is
12 | * * furnished to do so, subject to the following conditions:
13 | * *
14 | * * The above copyright notice and this permission notice shall be included in all
15 | * * copies or substantial portions of the Software.
16 | * *
17 | * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | * * SOFTWARE.
24 | *
25 | */
26 |
27 | package com.daimajia.easing.linear;
28 |
29 | import com.daimajia.easing.BaseEasingMethod;
30 |
31 | public class Linear extends BaseEasingMethod{
32 | public Linear(float duration) {
33 | super(duration);
34 | }
35 |
36 | @Override
37 | public Float calculate(float t, float b, float c, float d) {
38 | return c*t/d + b;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/quad/QuadEaseInOut.java:
--------------------------------------------------------------------------------
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.easing.quad;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class QuadEaseInOut extends BaseEasingMethod{
30 | public QuadEaseInOut(float duration) {
31 | super(duration);
32 | }
33 |
34 | @Override
35 | public Float calculate(float t, float b, float c, float d) {
36 | if ((t/=d/2) < 1) return c/2*t*t + b;
37 | return -c/2 * ((--t)*(t-2) - 1) + b;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/quint/QuintEaseInOut.java:
--------------------------------------------------------------------------------
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.easing.quint;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class QuintEaseInOut extends BaseEasingMethod{
30 | public QuintEaseInOut(float duration) {
31 | super(duration);
32 | }
33 |
34 | @Override
35 | public Float calculate(float t, float b, float c, float d) {
36 | if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
37 | return c/2*((t-=2)*t*t*t*t + 2) + b;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/cubic/CubicEaseInOut.java:
--------------------------------------------------------------------------------
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.easing.cubic;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class CubicEaseInOut extends BaseEasingMethod {
30 |
31 | public CubicEaseInOut(float duration) {
32 | super(duration);
33 | }
34 |
35 | @Override
36 | public Float calculate(float t, float b, float c, float d) {
37 | if ((t/=d/2) < 1)
38 | return c/2*t*t*t + b;
39 |
40 | return c/2*((t-=2)*t*t + 2) + b;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/circ/CircEaseInOut.java:
--------------------------------------------------------------------------------
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.easing.circ;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class CircEaseInOut extends BaseEasingMethod{
30 |
31 | public CircEaseInOut(float duration) {
32 | super(duration);
33 | }
34 |
35 | @Override
36 | public Float calculate(float t, float b, float c, float d) {
37 | if ((t/=d/2) < 1)
38 | return -c/2 * ((float)Math.sqrt(1 - t*t) - 1) + b;
39 |
40 | return c/2 * ((float)Math.sqrt(1 - (t-=2)*t) + 1) + b;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/bounce/BounceEaseIn.java:
--------------------------------------------------------------------------------
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.easing.bounce;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class BounceEaseIn extends BaseEasingMethod {
30 |
31 | private BounceEaseOut mBounceEaseOut;
32 |
33 | public BounceEaseIn(float duration){
34 | super(duration);
35 | mBounceEaseOut = new BounceEaseOut(duration);
36 | }
37 |
38 | @Override
39 | public Float calculate(float t, float b, float c, float d) {
40 | return c - mBounceEaseOut.calculate(d-t, 0, c, d) + b;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/expo/ExpoEaseInOut.java:
--------------------------------------------------------------------------------
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.easing.expo;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class ExpoEaseInOut extends BaseEasingMethod{
30 | public ExpoEaseInOut(float duration) {
31 | super(duration);
32 | }
33 |
34 | @Override
35 | public Float calculate(float t, float b, float c, float d) {
36 | if (t==0) return b;
37 | if (t==d) return b+c;
38 | if ((t/=d/2) < 1) return c/2 * (float)Math.pow(2, 10 * (t - 1)) + b;
39 | return c/2 * (-(float)Math.pow(2, -10 * --t) + 2) + b;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/back/BackEaseIn.java:
--------------------------------------------------------------------------------
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.easing.back;
26 |
27 | import com.daimajia.easing.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 calculate(float t, float b, float c, float d) {
44 | return c*(t/=d)*t*((s+1)*t - s) + b;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/back/BackEaseOut.java:
--------------------------------------------------------------------------------
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.easing.back;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class BackEaseOut extends BaseEasingMethod{
30 |
31 | private float s = 1.70158f;
32 |
33 | public BackEaseOut(float duration) {
34 | super(duration);
35 | }
36 |
37 | public BackEaseOut(float duration, float back){
38 | this(duration);
39 | s = back;
40 | }
41 |
42 | @Override
43 | public Float calculate(float t, float b, float c, float d) {
44 | return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/elastic/ElasticEaseIn.java:
--------------------------------------------------------------------------------
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.easing.elastic;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class ElasticEaseIn extends BaseEasingMethod{
30 |
31 | public ElasticEaseIn(float duration) {
32 | super(duration);
33 | }
34 |
35 | @Override
36 | public Float calculate(float t, float b, float c, float d) {
37 | if (t==0) return b; if ((t/=d)==1) return b+c;
38 | float p=d*.3f;
39 | float a=c;
40 | float s=p/4;
41 | return -(a*(float)Math.pow(2,10*(t-=1)) * (float)Math.sin( (t*d-s)*(2*(float)Math.PI)/p )) + b;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/elastic/ElasticEaseOut.java:
--------------------------------------------------------------------------------
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.easing.elastic;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class ElasticEaseOut extends BaseEasingMethod{
30 |
31 | public ElasticEaseOut(float duration) {
32 | super(duration);
33 | }
34 |
35 | @Override
36 | public Float calculate(float t, float b, float c, float d) {
37 | if (t==0) return b; if ((t/=d)==1) return b+c;
38 | float p=d*.3f;
39 | float a=c;
40 | float s=p/4;
41 | return (a*(float)Math.pow(2,-10*t) * (float)Math.sin( (t*d-s)*(2*(float)Math.PI)/p ) + c + b);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/back/BackEaseInOut.java:
--------------------------------------------------------------------------------
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.easing.back;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class BackEaseInOut extends BaseEasingMethod{
30 |
31 | private float s = 1.70158f;
32 |
33 | public BackEaseInOut(float duration) {
34 | super(duration);
35 | }
36 |
37 | public BackEaseInOut(float duration, float back){
38 | this(duration);
39 | s = back;
40 | }
41 |
42 | @Override
43 | public Float calculate(float t, float b, float c, float d) {
44 | if ((t /= d / 2) < 1) return c / 2 * (t * t * ((s + 1) * t - s)) + b;
45 | return c / 2 * ((t -= 2) * t * ((s + 1) * t + s) + 2) + b;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/bounce/BounceEaseOut.java:
--------------------------------------------------------------------------------
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.easing.bounce;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class BounceEaseOut extends BaseEasingMethod {
30 |
31 | public BounceEaseOut(float duration) {
32 | super(duration);
33 | }
34 |
35 | @Override
36 | public Float calculate(float t, float b, float c, float d) {
37 | if ((t/=d) < (1/2.75f)) {
38 | return c*(7.5625f*t*t) + b;
39 | } else if (t < (2/2.75f)) {
40 | return c*(7.5625f*(t-=(1.5f/2.75f))*t + .75f) + b;
41 | } else if (t < (2.5/2.75)) {
42 | return c*(7.5625f*(t-=(2.25f/2.75f))*t + .9375f) + b;
43 | } else {
44 | return c*(7.5625f*(t-=(2.625f/2.75f))*t + .984375f) + b;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/bounce/BounceEaseInOut.java:
--------------------------------------------------------------------------------
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.easing.bounce;
26 |
27 | import com.daimajia.easing.BaseEasingMethod;
28 |
29 | public class BounceEaseInOut extends BaseEasingMethod{
30 |
31 | private BounceEaseOut mBounceEaseOut;
32 | private BounceEaseIn mBounceEaseIn;
33 |
34 | public BounceEaseInOut(float duration){
35 | super(duration);
36 | mBounceEaseIn = new BounceEaseIn(duration);
37 | mBounceEaseOut = new BounceEaseOut(duration);
38 | }
39 |
40 | @Override
41 | public Float calculate(float t, float b, float c, float d) {
42 | if (t < d/2)
43 | return mBounceEaseIn.calculate (t*2, 0, c, d) * .5f + b;
44 | else
45 | return mBounceEaseOut.calculate (t*2-d, 0, c, d) * .5f + c*.5f + b;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/elastic/ElasticEaseInOut.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * The MIT License (MIT)
4 | * *
5 | * * Copyright (c) 2014 daimajia
6 | * *
7 | * * Permission is hereby granted, free of charge, to any person obtaining a copy
8 | * * of this software and associated documentation files (the "Software"), to deal
9 | * * in the Software without restriction, including without limitation the rights
10 | * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | * * copies of the Software, and to permit persons to whom the Software is
12 | * * furnished to do so, subject to the following conditions:
13 | * *
14 | * * The above copyright notice and this permission notice shall be included in all
15 | * * copies or substantial portions of the Software.
16 | * *
17 | * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | * * SOFTWARE.
24 | *
25 | */
26 |
27 | package com.daimajia.easing.elastic;
28 |
29 | import com.daimajia.easing.BaseEasingMethod;
30 |
31 | public class ElasticEaseInOut extends BaseEasingMethod{
32 | public ElasticEaseInOut(float duration) {
33 | super(duration);
34 | }
35 |
36 | @Override
37 | public Float calculate(float t, float b, float c, float d) {
38 | if (t==0) return b; if ((t/=d/2)==2) return b+c;
39 | float p=d*(.3f*1.5f);
40 | float a=c;
41 | float s=p/4;
42 | if (t < 1) return -.5f*(a*(float)Math.pow(2,10*(t-=1)) * (float)Math.sin( (t*d-s)*(2*(float)Math.PI)/p )) + b;
43 | return a*(float)Math.pow(2,-10*(t-=1)) * (float)Math.sin( (t*d-s)*(2*(float)Math.PI)/p )*.5f + c + b;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android Easing Functions [](https://travis-ci.org/daimajia/AnimationEasingFunctions)
2 |
3 | This project is originally from my another project, [AndroidViewAnimation](https://github.com/daimajia/AndroidViewAnimations), which is an animation collection, to help you make animation easier.
4 |
5 | While, I was still unsatisfied with the animation effect.
6 |
7 | So, I started to explore how to make it more and more real.
8 |
9 | I found the [Easing Functions](http://easings.net/) made by [Robert Penne](http://robertpenner.com/), then, I implemented Easing Functions and make a lovely demo.
10 |
11 | ## Demo
12 |
13 | 
14 |
15 | ## Usage
16 |
17 | > `NineOldAndroids` has been removed since version 2.0. Thanks Jake Wharton.
18 |
19 | **minSdkVersion: 11**
20 |
21 | ### Step 1
22 |
23 | Gradle
24 |
25 | ```groovy
26 | implementation 'com.daimajia.easing:library:2.4@aar'
27 | ```
28 | or maven
29 |
30 | ```xml
31 |
32 | com.daimajia.easing
33 | library
34 | 2.4
35 | apklib
36 |
37 | ```
38 |
39 | ### Step 2
40 |
41 | Just like a glider.
42 |
43 | ```java
44 | AnimatorSet set = new AnimatorSet();
45 | set.playTogether(
46 | Glider.glide(Skill.BounceEaseInOut, 1200, ObjectAnimator.ofFloat(mTarget, "translationY", 0, 100))
47 | );
48 |
49 | set.setDuration(1200);
50 | set.start();
51 | ```
52 |
53 | #### Tips
54 |
55 | If you encounter exceptions such as `ClassNotFoundExceptions` ([#4](https://github.com/daimajia/AnimationEasingFunctions/issues/4)), please add the following to your `proguard-project.txt`:
56 |
57 | ```
58 | -keep class com.daimajia.easing.** { *; }
59 | -keep interface com.daimajia.easing.** { *; }
60 | ```
61 |
62 | More details [visit official guide](http://developer.android.com/tools/help/proguard.html#configuring).
63 |
64 | # About me
65 |
66 | A student in mainland China.
67 |
68 | Welcome to [offer me an internship](mailto:daimajia@gmail.com).
69 | If you have any new idea about this project, feel free to [contact me](mailto:daimajia@gmail.com).
70 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/Glider.java:
--------------------------------------------------------------------------------
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.easing;
26 |
27 |
28 | import android.animation.PropertyValuesHolder;
29 | import android.animation.ValueAnimator;
30 |
31 | public class Glider {
32 |
33 | public static ValueAnimator glide(Skill skill, float duration, ValueAnimator animator) {
34 | return Glider.glide(skill, duration, animator, (BaseEasingMethod.EasingListener[]) null);
35 | }
36 |
37 | public static ValueAnimator glide(Skill skill, float duration, ValueAnimator animator, BaseEasingMethod.EasingListener... listeners) {
38 | BaseEasingMethod t = skill.getMethod(duration);
39 |
40 | if (listeners != null)
41 | t.addEasingListeners(listeners);
42 |
43 | animator.setEvaluator(t);
44 | return animator;
45 | }
46 |
47 | public static PropertyValuesHolder glide(Skill skill, float duration, PropertyValuesHolder propertyValuesHolder) {
48 | propertyValuesHolder.setEvaluator(skill.getMethod(duration));
49 | return propertyValuesHolder;
50 | }
51 |
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/BaseEasingMethod.java:
--------------------------------------------------------------------------------
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.easing;
26 |
27 |
28 | import android.animation.TypeEvaluator;
29 |
30 | import java.util.ArrayList;
31 |
32 | public abstract class BaseEasingMethod implements TypeEvaluator {
33 | protected float mDuration;
34 |
35 | private ArrayList mListeners = new ArrayList();
36 |
37 | public interface EasingListener {
38 | public void on(float time, float value, float start, float end, float duration);
39 | }
40 |
41 | public void addEasingListener(EasingListener l){
42 | mListeners.add(l);
43 | }
44 |
45 | public void addEasingListeners(EasingListener ...ls){
46 | for(EasingListener l : ls){
47 | mListeners.add(l);
48 | }
49 | }
50 |
51 | public void removeEasingListener(EasingListener l){
52 | mListeners.remove(l);
53 | }
54 |
55 | public void clearEasingListeners(){
56 | mListeners.clear();
57 | }
58 |
59 | public BaseEasingMethod(float duration){
60 | mDuration = duration;
61 | }
62 |
63 | public void setDuration(float duration) {
64 | mDuration = duration;
65 | }
66 |
67 |
68 | @Override
69 | public final Float evaluate(float fraction, Number startValue, Number endValue){
70 | float t = mDuration * fraction;
71 | float b = startValue.floatValue();
72 | float c = endValue.floatValue() - startValue.floatValue();
73 | float d = mDuration;
74 | float result = calculate(t,b,c,d);
75 | for(EasingListener l : mListeners){
76 | l.on(t,result,b,c,d);
77 | }
78 | return result;
79 | }
80 |
81 | public abstract Float calculate(float t, float b, float c, float d);
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/demo/src/main/java/daimajia/com/easing/MyActivity.java:
--------------------------------------------------------------------------------
1 | package daimajia.com.easing;
2 |
3 | import android.animation.AnimatorSet;
4 | import android.animation.ObjectAnimator;
5 | import android.app.Activity;
6 | import android.content.Context;
7 | import android.os.Bundle;
8 | import android.util.DisplayMetrics;
9 | import android.util.TypedValue;
10 | import android.view.Menu;
11 | import android.view.MenuItem;
12 | import android.view.View;
13 | import android.widget.AdapterView;
14 | import android.widget.ListView;
15 |
16 | import com.daimajia.easing.BaseEasingMethod;
17 | import com.daimajia.easing.Glider;
18 | import com.daimajia.easing.Skill;
19 |
20 | import daimajia.com.eaing.R;
21 |
22 |
23 | public class MyActivity extends Activity {
24 |
25 | private ListView mEasingList;
26 | private EasingAdapter mAdapter;
27 | private View mTarget;
28 |
29 | private DrawView mHistory;
30 |
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.activity_my);
35 | mEasingList = (ListView) findViewById(R.id.easing_list);
36 | mAdapter = new EasingAdapter(this);
37 | mEasingList.setAdapter(mAdapter);
38 | mTarget = findViewById(R.id.target);
39 | mHistory = (DrawView) findViewById(R.id.history);
40 | mEasingList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
41 | @Override
42 | public void onItemClick(AdapterView> adapterView, View view, int i, long l) {
43 | mHistory.clear();
44 | Skill s = (Skill) view.getTag();
45 | AnimatorSet set = new AnimatorSet();
46 | mTarget.setTranslationX(0);
47 | mTarget.setTranslationY(0);
48 | set.playTogether(
49 | Glider.glide(s, 1200, ObjectAnimator.ofFloat(mTarget, "translationY", 0, dipToPixels(MyActivity.this, -(160 - 3))), new BaseEasingMethod.EasingListener() {
50 | @Override
51 | public void on(float time, float value, float start, float end, float duration) {
52 | mHistory.drawPoint(time, duration, value - dipToPixels(MyActivity.this, 60));
53 | }
54 | })
55 | );
56 | set.setDuration(1200);
57 | set.start();
58 | }
59 | });
60 |
61 | }
62 |
63 | public static float dipToPixels(Context context, float dipValue) {
64 | DisplayMetrics metrics = context.getResources().getDisplayMetrics();
65 | return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, metrics);
66 | }
67 |
68 | @Override
69 | public boolean onCreateOptionsMenu(Menu menu) {
70 | // Inflate the menu; this adds items to the action bar if it is present.
71 | getMenuInflater().inflate(R.menu.my, menu);
72 | return true;
73 | }
74 |
75 | @Override
76 | public boolean onOptionsItemSelected(MenuItem item) {
77 | // Handle action bar item clicks here. The action bar will
78 | // automatically handle clicks on the Home/Up button, so long
79 | // as you specify a parent activity in AndroidManifest.xml.
80 | int id = item.getItemId();
81 | if (id == R.id.action_settings) {
82 | return true;
83 | }
84 | return super.onOptionsItemSelected(item);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/demo/src/main/java/daimajia/com/easing/DrawView.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * The MIT License (MIT)
4 | * *
5 | * * Copyright (c) 2014 daimajia
6 | * *
7 | * * Permission is hereby granted, free of charge, to any person obtaining a copy
8 | * * of this software and associated documentation files (the "Software"), to deal
9 | * * in the Software without restriction, including without limitation the rights
10 | * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | * * copies of the Software, and to permit persons to whom the Software is
12 | * * furnished to do so, subject to the following conditions:
13 | * *
14 | * * The above copyright notice and this permission notice shall be included in all
15 | * * copies or substantial portions of the Software.
16 | * *
17 | * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | * * SOFTWARE.
24 | *
25 | */
26 |
27 | package daimajia.com.easing;
28 |
29 | import android.content.Context;
30 | import android.graphics.Canvas;
31 | import android.graphics.Color;
32 | import android.graphics.Paint;
33 | import android.graphics.Path;
34 | import android.util.AttributeSet;
35 | import android.util.DisplayMetrics;
36 | import android.util.TypedValue;
37 | import android.view.View;
38 |
39 | import java.util.ArrayList;
40 |
41 | public class DrawView extends View{
42 |
43 | private Paint mBackgroundPaint = new Paint();
44 | private Paint mLinePaint = new Paint();
45 | private Path path = new Path();
46 | private boolean start = false;
47 |
48 | private ArrayList mHistory = new ArrayList();
49 |
50 | {
51 | mBackgroundPaint.setColor(Color.WHITE);
52 | mLinePaint.setColor(Color.rgb(77,83,96));
53 | mLinePaint.setAntiAlias(true);
54 | mLinePaint.setStrokeWidth((float) 3.0);
55 | mLinePaint.setStyle(Paint.Style.STROKE);
56 | }
57 | public DrawView(Context context) {
58 | super(context);
59 | }
60 |
61 | public DrawView(Context context, AttributeSet attrs) {
62 | super(context, attrs);
63 | }
64 |
65 | public DrawView(Context context, AttributeSet attrs, int defStyleAttr) {
66 | super(context, attrs, defStyleAttr);
67 | }
68 |
69 | @Override
70 | protected void onDraw(Canvas canvas) {
71 | super.onDraw(canvas);
72 | float l = 0;
73 | float t = getHeight() - getPaddingBottom() - dipToPixels(getContext(),217);
74 | float r = getWidth() - getPaddingRight();
75 | float b = getHeight() - dipToPixels(getContext(),60);
76 | canvas.drawRect(l,t,r,b,mLinePaint);
77 | canvas.drawPath(path,mLinePaint);
78 | }
79 |
80 | public static float dipToPixels(Context context, float dipValue) {
81 | DisplayMetrics metrics = context.getResources().getDisplayMetrics();
82 | return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, metrics);
83 | }
84 |
85 | public void drawPoint(float time, float duration, float y){
86 | float p = time/duration;
87 | float x = p*getWidth();
88 | float z = getHeight() + y;
89 | if(!start){
90 | path.moveTo(x,z);
91 | start = true;
92 | }
93 | path.lineTo(x,z);
94 | invalidate();
95 | }
96 |
97 | public void clear(){
98 | path.reset();
99 | start = false;
100 | invalidate();
101 | }
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/library/src/main/java/com/daimajia/easing/Skill.java:
--------------------------------------------------------------------------------
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.easing;
26 |
27 | import com.daimajia.easing.back.BackEaseIn;
28 | import com.daimajia.easing.back.BackEaseInOut;
29 | import com.daimajia.easing.back.BackEaseOut;
30 | import com.daimajia.easing.bounce.BounceEaseIn;
31 | import com.daimajia.easing.bounce.BounceEaseInOut;
32 | import com.daimajia.easing.bounce.BounceEaseOut;
33 | import com.daimajia.easing.circ.CircEaseIn;
34 | import com.daimajia.easing.circ.CircEaseInOut;
35 | import com.daimajia.easing.circ.CircEaseOut;
36 | import com.daimajia.easing.cubic.CubicEaseIn;
37 | import com.daimajia.easing.cubic.CubicEaseInOut;
38 | import com.daimajia.easing.cubic.CubicEaseOut;
39 | import com.daimajia.easing.elastic.ElasticEaseIn;
40 | import com.daimajia.easing.elastic.ElasticEaseOut;
41 | import com.daimajia.easing.expo.ExpoEaseIn;
42 | import com.daimajia.easing.expo.ExpoEaseInOut;
43 | import com.daimajia.easing.expo.ExpoEaseOut;
44 | import com.daimajia.easing.quad.QuadEaseIn;
45 | import com.daimajia.easing.quad.QuadEaseInOut;
46 | import com.daimajia.easing.quad.QuadEaseOut;
47 | import com.daimajia.easing.quint.QuintEaseIn;
48 | import com.daimajia.easing.quint.QuintEaseInOut;
49 | import com.daimajia.easing.quint.QuintEaseOut;
50 | import com.daimajia.easing.sine.SineEaseIn;
51 | import com.daimajia.easing.sine.SineEaseInOut;
52 | import com.daimajia.easing.sine.SineEaseOut;
53 | import com.daimajia.easing.linear.Linear;
54 |
55 |
56 | public enum Skill {
57 |
58 | BackEaseIn(BackEaseIn.class),
59 | BackEaseOut(BackEaseOut.class),
60 | BackEaseInOut(BackEaseInOut.class),
61 |
62 | BounceEaseIn(BounceEaseIn.class),
63 | BounceEaseOut(BounceEaseOut.class),
64 | BounceEaseInOut(BounceEaseInOut.class),
65 |
66 | CircEaseIn(CircEaseIn.class),
67 | CircEaseOut(CircEaseOut.class),
68 | CircEaseInOut(CircEaseInOut.class),
69 |
70 | CubicEaseIn(CubicEaseIn.class),
71 | CubicEaseOut(CubicEaseOut.class),
72 | CubicEaseInOut(CubicEaseInOut.class),
73 |
74 | ElasticEaseIn(ElasticEaseIn.class),
75 | ElasticEaseOut(ElasticEaseOut.class),
76 |
77 | ExpoEaseIn(ExpoEaseIn.class),
78 | ExpoEaseOut(ExpoEaseOut.class),
79 | ExpoEaseInOut(ExpoEaseInOut.class),
80 |
81 | QuadEaseIn(QuadEaseIn.class),
82 | QuadEaseOut(QuadEaseOut.class),
83 | QuadEaseInOut(QuadEaseInOut.class),
84 |
85 | QuintEaseIn(QuintEaseIn.class),
86 | QuintEaseOut(QuintEaseOut.class),
87 | QuintEaseInOut(QuintEaseInOut.class),
88 |
89 | SineEaseIn(SineEaseIn.class),
90 | SineEaseOut(SineEaseOut.class),
91 | SineEaseInOut(SineEaseInOut.class),
92 |
93 | Linear(Linear.class);
94 |
95 |
96 | private Class easingMethod;
97 |
98 | private Skill(Class clazz) {
99 | easingMethod = clazz;
100 | }
101 |
102 | public BaseEasingMethod getMethod(float duration) {
103 | try {
104 | return (BaseEasingMethod)easingMethod.getConstructor(float.class).newInstance(duration);
105 | } catch (Exception e) {
106 | e.printStackTrace();
107 | throw new Error("Can not init easingMethod instance");
108 | }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/library/gradle-mvn-push.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Chris Banes
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'maven'
18 | apply plugin: 'signing'
19 |
20 | def isReleaseBuild() {
21 | return VERSION_NAME.contains("SNAPSHOT") == false
22 | }
23 |
24 | def getReleaseRepositoryUrl() {
25 | return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
26 | : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
27 | }
28 |
29 | def getSnapshotRepositoryUrl() {
30 | return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
31 | : "https://oss.sonatype.org/content/repositories/snapshots/"
32 | }
33 |
34 | def getRepositoryUsername() {
35 | return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
36 | }
37 |
38 | def getRepositoryPassword() {
39 | return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
40 | }
41 |
42 | afterEvaluate { project ->
43 | uploadArchives {
44 | repositories {
45 | mavenDeployer {
46 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
47 |
48 | pom.groupId = GROUP
49 | pom.artifactId = POM_ARTIFACT_ID
50 | pom.version = VERSION_NAME
51 |
52 | repository(url: getReleaseRepositoryUrl()) {
53 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
54 | }
55 | snapshotRepository(url: getSnapshotRepositoryUrl()) {
56 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
57 | }
58 |
59 | pom.project {
60 | name POM_NAME
61 | packaging POM_PACKAGING
62 | description POM_DESCRIPTION
63 | url POM_URL
64 |
65 | scm {
66 | url POM_SCM_URL
67 | connection POM_SCM_CONNECTION
68 | developerConnection POM_SCM_DEV_CONNECTION
69 | }
70 |
71 | licenses {
72 | license {
73 | name POM_LICENCE_NAME
74 | url POM_LICENCE_URL
75 | distribution POM_LICENCE_DIST
76 | }
77 | }
78 |
79 | developers {
80 | developer {
81 | id POM_DEVELOPER_ID
82 | name POM_DEVELOPER_NAME
83 | }
84 | }
85 | }
86 | }
87 | }
88 | }
89 |
90 | signing {
91 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
92 | sign configurations.archives
93 | }
94 |
95 | task apklib(type: Zip){
96 | appendix = extension = 'apklib'
97 |
98 | from 'AndroidManifest.xml'
99 | into('res') {
100 | from 'res'
101 | }
102 | into('src') {
103 | from 'src'
104 | }
105 | }
106 |
107 | task androidJavadocs(type: Javadoc) {
108 | source = android.sourceSets.main.java.srcDirs
109 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
110 | }
111 |
112 | task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
113 | classifier = 'javadoc'
114 | from androidJavadocs.destinationDir
115 | }
116 |
117 | task androidSourcesJar(type: Jar) {
118 | classifier = 'sources'
119 | from android.sourceSets.main.java.sourceFiles
120 | }
121 |
122 | artifacts {
123 | archives androidSourcesJar
124 | archives androidJavadocsJar
125 | archives apklib
126 | }
127 | }
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------