forked from sephiroth74/ImageViewZoom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add removed easing folder
- Loading branch information
Showing
12 changed files
with
306 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
library/src/it/sephiroth/android/library/imagezoom/easing/Back.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package it.sephiroth.android.library.imagezoom.easing; | ||
|
||
public class Back implements Easing { | ||
|
||
@Override | ||
public double easeOut( double time, double start, double end, double duration ) { | ||
return easeOut( time, start, end, duration, 0 ); | ||
} | ||
|
||
@Override | ||
public double easeIn( double time, double start, double end, double duration ) { | ||
return easeIn( time, start, end, duration, 0 ); | ||
} | ||
|
||
@Override | ||
public double easeInOut( double time, double start, double end, double duration ) { | ||
return easeInOut( time, start, end, duration, 0.9 ); | ||
} | ||
|
||
public double easeIn( double t, double b, double c, double d, double s ) { | ||
if ( s == 0 ) s = 1.70158; | ||
return c * ( t /= d ) * t * ( ( s + 1 ) * t - s ) + b; | ||
} | ||
|
||
public double easeOut( double t, double b, double c, double d, double s ) { | ||
if ( s == 0 ) s = 1.70158; | ||
return c * ( ( t = t / d - 1 ) * t * ( ( s + 1 ) * t + s ) + 1 ) + b; | ||
} | ||
|
||
public double easeInOut( double t, double b, double c, double d, double s ) { | ||
if ( s == 0 ) s = 1.70158; | ||
if ( ( t /= d / 2 ) < 1 ) return c / 2 * ( t * t * ( ( ( s *= ( 1.525 ) ) + 1 ) * t - s ) ) + b; | ||
return c / 2 * ( ( t -= 2 ) * t * ( ( ( s *= ( 1.525 ) ) + 1 ) * t + s ) + 2 ) + b; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
library/src/it/sephiroth/android/library/imagezoom/easing/Bounce.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package it.sephiroth.android.library.imagezoom.easing; | ||
|
||
public class Bounce implements Easing { | ||
|
||
@Override | ||
public double easeOut( double t, double b, double c, double d ) { | ||
if ( ( t /= d ) < ( 1.0 / 2.75 ) ) { | ||
return c * ( 7.5625 * t * t ) + b; | ||
} else if ( t < ( 2.0 / 2.75 ) ) { | ||
return c * ( 7.5625 * ( t -= ( 1.5 / 2.75 ) ) * t + .75 ) + b; | ||
} else if ( t < ( 2.5 / 2.75 ) ) { | ||
return c * ( 7.5625 * ( t -= ( 2.25 / 2.75 ) ) * t + .9375 ) + b; | ||
} else { | ||
return c * ( 7.5625 * ( t -= ( 2.625 / 2.75 ) ) * t + .984375 ) + b; | ||
} | ||
} | ||
|
||
@Override | ||
public double easeIn( double t, double b, double c, double d ) { | ||
return c - easeOut( d - t, 0, c, d ) + b; | ||
} | ||
|
||
@Override | ||
public double easeInOut( double t, double b, double c, double d ) { | ||
if ( t < d / 2.0 ) | ||
return easeIn( t * 2.0, 0, c, d ) * .5 + b; | ||
else | ||
return easeOut( t * 2.0 - d, 0, c, d ) * .5 + c * .5 + b; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
library/src/it/sephiroth/android/library/imagezoom/easing/Circ.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package it.sephiroth.android.library.imagezoom.easing; | ||
|
||
public class Circ implements Easing { | ||
|
||
@Override | ||
public double easeOut( double time, double start, double end, double duration ) { | ||
return end * Math.sqrt( 1.0 - ( time = time / duration - 1.0 ) * time ) + start; | ||
} | ||
|
||
@Override | ||
public double easeIn( double time, double start, double end, double duration ) { | ||
return -end * ( Math.sqrt( 1.0 - ( time /= duration ) * time ) - 1.0 ) + start; | ||
} | ||
|
||
@Override | ||
public double easeInOut( double time, double start, double end, double duration ) { | ||
if ( ( time /= duration / 2 ) < 1 ) return -end / 2.0 * ( Math.sqrt( 1.0 - time * time ) - 1.0 ) + start; | ||
return end / 2.0 * ( Math.sqrt( 1.0 - ( time -= 2.0 ) * time ) + 1.0 ) + start; | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
library/src/it/sephiroth/android/library/imagezoom/easing/Cubic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package it.sephiroth.android.library.imagezoom.easing; | ||
|
||
public class Cubic implements Easing { | ||
|
||
@Override | ||
public double easeOut( double time, double start, double end, double duration ) { | ||
return end * ( ( time = time / duration - 1.0 ) * time * time + 1.0 ) + start; | ||
} | ||
|
||
@Override | ||
public double easeIn( double time, double start, double end, double duration ) { | ||
return end * ( time /= duration ) * time * time + start; | ||
} | ||
|
||
@Override | ||
public double easeInOut( double time, double start, double end, double duration ) { | ||
if ( ( time /= duration / 2.0 ) < 1.0 ) return end / 2.0 * time * time * time + start; | ||
return end / 2.0 * ( ( time -= 2.0 ) * time * time + 2.0 ) + start; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
library/src/it/sephiroth/android/library/imagezoom/easing/Easing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package it.sephiroth.android.library.imagezoom.easing; | ||
|
||
public interface Easing { | ||
|
||
double easeOut( double time, double start, double end, double duration ); | ||
|
||
double easeIn( double time, double start, double end, double duration ); | ||
|
||
double easeInOut( double time, double start, double end, double duration ); | ||
} |
60 changes: 60 additions & 0 deletions
60
library/src/it/sephiroth/android/library/imagezoom/easing/Elastic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package it.sephiroth.android.library.imagezoom.easing; | ||
|
||
public class Elastic implements Easing { | ||
|
||
@Override | ||
public double easeIn( double time, double start, double end, double duration ) { | ||
return easeIn( time, start, end, duration, start + end, duration ); | ||
} | ||
|
||
public double easeIn( double t, double b, double c, double d, double a, double p ) { | ||
double s; | ||
if ( t == 0 ) return b; | ||
if ( ( t /= d ) == 1 ) return b + c; | ||
if ( !( p > 0 ) ) p = d * .3; | ||
if ( !( a > 0 ) || a < Math.abs( c ) ) { | ||
a = c; | ||
s = p / 4; | ||
} else | ||
s = p / ( 2 * Math.PI ) * Math.asin( c / a ); | ||
return -( a * Math.pow( 2, 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b; | ||
} | ||
|
||
@Override | ||
public double easeOut( double time, double start, double end, double duration ) { | ||
return easeOut( time, start, end, duration, start + end, duration ); | ||
} | ||
|
||
public double easeOut( double t, double b, double c, double d, double a, double p ) { | ||
double s; | ||
if ( t == 0 ) return b; | ||
if ( ( t /= d ) == 1 ) return b + c; | ||
if ( !( p > 0 ) ) p = d * .3; | ||
if ( !( a > 0 ) || a < Math.abs( c ) ) { | ||
a = c; | ||
s = p / 4; | ||
} else | ||
s = p / ( 2 * Math.PI ) * Math.asin( c / a ); | ||
return ( a * Math.pow( 2, -10 * t ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) + c + b ); | ||
} | ||
|
||
@Override | ||
public double easeInOut( double t, double b, double c, double d ) { | ||
return easeInOut( t, b, c, d, b + c, d ); | ||
} | ||
|
||
public double easeInOut( double t, double b, double c, double d, double a, double p ) { | ||
double s; | ||
|
||
if ( t == 0 ) return b; | ||
if ( ( t /= d / 2 ) == 2 ) return b + c; | ||
if ( !( p > 0 ) ) p = d * ( .3 * 1.5 ); | ||
if ( !( a > 0 ) || a < Math.abs( c ) ) { | ||
a = c; | ||
s = p / 4; | ||
} else | ||
s = p / ( 2 * Math.PI ) * Math.asin( c / a ); | ||
if ( t < 1 ) return -.5 * ( a * Math.pow( 2, 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ) + b; | ||
return a * Math.pow( 2, -10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) * .5 + c + b; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
library/src/it/sephiroth/android/library/imagezoom/easing/Expo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package it.sephiroth.android.library.imagezoom.easing; | ||
|
||
public class Expo implements Easing { | ||
|
||
@Override | ||
public double easeOut( double time, double start, double end, double duration ) { | ||
return ( time == duration ) ? start + end : end * ( -Math.pow( 2.0, -10.0 * time / duration ) + 1 ) + start; | ||
} | ||
|
||
@Override | ||
public double easeIn( double time, double start, double end, double duration ) { | ||
return ( time == 0 ) ? start : end * Math.pow( 2.0, 10.0 * ( time / duration - 1.0 ) ) + start; | ||
} | ||
|
||
@Override | ||
public double easeInOut( double time, double start, double end, double duration ) { | ||
if ( time == 0 ) return start; | ||
if ( time == duration ) return start + end; | ||
if ( ( time /= duration / 2.0 ) < 1.0 ) return end / 2.0 * Math.pow( 2.0, 10.0 * ( time - 1.0 ) ) + start; | ||
return end / 2.0 * ( -Math.pow( 2.0, -10.0 * --time ) + 2.0 ) + start; | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
library/src/it/sephiroth/android/library/imagezoom/easing/Linear.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package it.sephiroth.android.library.imagezoom.easing; | ||
|
||
public class Linear implements Easing { | ||
|
||
public double easeNone( double time, double start, double end, double duration ) { | ||
return end * time / duration + start; | ||
} | ||
|
||
@Override | ||
public double easeOut( double time, double start, double end, double duration ) { | ||
return end * time / duration + start; | ||
} | ||
|
||
@Override | ||
public double easeIn( double time, double start, double end, double duration ) { | ||
return end * time / duration + start; | ||
} | ||
|
||
@Override | ||
public double easeInOut( double time, double start, double end, double duration ) { | ||
return end * time / duration + start; | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
library/src/it/sephiroth/android/library/imagezoom/easing/Quad.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package it.sephiroth.android.library.imagezoom.easing; | ||
|
||
public class Quad implements Easing { | ||
|
||
@Override | ||
public double easeOut( double t, double b, double c, double d ) { | ||
return -c * ( t /= d ) * ( t - 2 ) + b; | ||
} | ||
|
||
@Override | ||
public double easeIn( double t, double b, double c, double d ) { | ||
return c * ( t /= d ) * t + b; | ||
} | ||
|
||
@Override | ||
public double easeInOut( double t, double b, double c, double d ) { | ||
if ( ( t /= d / 2 ) < 1 ) return c / 2 * t * t + b; | ||
return -c / 2 * ( ( --t ) * ( t - 2 ) - 1 ) + b; | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
library/src/it/sephiroth/android/library/imagezoom/easing/Quart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package it.sephiroth.android.library.imagezoom.easing; | ||
|
||
public class Quart implements Easing { | ||
|
||
@Override | ||
public double easeOut( double t, double b, double c, double d ) { | ||
return -c * ( ( t = t / d - 1 ) * t * t * t - 1 ) + b; | ||
} | ||
|
||
@Override | ||
public double easeIn( double t, double b, double c, double d ) { | ||
return c * ( t /= d ) * t * t * t + b; | ||
} | ||
|
||
@Override | ||
public double easeInOut( double t, double b, double c, double d ) { | ||
if ( ( t /= d / 2 ) < 1 ) return c / 2 * t * t * t * t + b; | ||
return -c / 2 * ( ( t -= 2 ) * t * t * t - 2 ) + b; | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
library/src/it/sephiroth/android/library/imagezoom/easing/Quint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package it.sephiroth.android.library.imagezoom.easing; | ||
|
||
public class Quint implements Easing { | ||
|
||
@Override | ||
public double easeOut( double t, double b, double c, double d ) { | ||
return c * ( ( t = t / d - 1 ) * t * t * t * t + 1 ) + b; | ||
} | ||
|
||
@Override | ||
public double easeIn( double t, double b, double c, double d ) { | ||
return c * ( t /= d ) * t * t * t * t + b; | ||
} | ||
|
||
@Override | ||
public double easeInOut( double t, double b, double c, double d ) { | ||
if ( ( t /= d / 2 ) < 1 ) return c / 2 * t * t * t * t * t + b; | ||
return c / 2 * ( ( t -= 2 ) * t * t * t * t + 2 ) + b; | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
library/src/it/sephiroth/android/library/imagezoom/easing/Sine.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package it.sephiroth.android.library.imagezoom.easing; | ||
|
||
public class Sine implements Easing { | ||
|
||
@Override | ||
public double easeOut( double t, double b, double c, double d ) { | ||
return c * Math.sin( t / d * ( Math.PI / 2 ) ) + b; | ||
} | ||
|
||
@Override | ||
public double easeIn( double t, double b, double c, double d ) { | ||
return -c * Math.cos( t / d * ( Math.PI / 2 ) ) + c + b; | ||
} | ||
|
||
@Override | ||
public double easeInOut( double t, double b, double c, double d ) { | ||
return -c / 2 * ( Math.cos( Math.PI * t / d ) - 1 ) + b; | ||
} | ||
|
||
} |