From 23d580095e89e7fc7c6d9788a712ed555d62adfe Mon Sep 17 00:00:00 2001 From: Kein Date: Wed, 2 Apr 2014 15:30:27 +0900 Subject: [PATCH] add removed easing folder add removed easing folder --- .../library/imagezoom/easing/Back.java | 35 +++++++++++ .../library/imagezoom/easing/Bounce.java | 30 ++++++++++ .../library/imagezoom/easing/Circ.java | 21 +++++++ .../library/imagezoom/easing/Cubic.java | 20 +++++++ .../library/imagezoom/easing/Easing.java | 10 ++++ .../library/imagezoom/easing/Elastic.java | 60 +++++++++++++++++++ .../library/imagezoom/easing/Expo.java | 23 +++++++ .../library/imagezoom/easing/Linear.java | 24 ++++++++ .../library/imagezoom/easing/Quad.java | 21 +++++++ .../library/imagezoom/easing/Quart.java | 21 +++++++ .../library/imagezoom/easing/Quint.java | 21 +++++++ .../library/imagezoom/easing/Sine.java | 20 +++++++ 12 files changed, 306 insertions(+) create mode 100755 library/src/it/sephiroth/android/library/imagezoom/easing/Back.java create mode 100755 library/src/it/sephiroth/android/library/imagezoom/easing/Bounce.java create mode 100755 library/src/it/sephiroth/android/library/imagezoom/easing/Circ.java create mode 100755 library/src/it/sephiroth/android/library/imagezoom/easing/Cubic.java create mode 100755 library/src/it/sephiroth/android/library/imagezoom/easing/Easing.java create mode 100755 library/src/it/sephiroth/android/library/imagezoom/easing/Elastic.java create mode 100755 library/src/it/sephiroth/android/library/imagezoom/easing/Expo.java create mode 100755 library/src/it/sephiroth/android/library/imagezoom/easing/Linear.java create mode 100755 library/src/it/sephiroth/android/library/imagezoom/easing/Quad.java create mode 100755 library/src/it/sephiroth/android/library/imagezoom/easing/Quart.java create mode 100755 library/src/it/sephiroth/android/library/imagezoom/easing/Quint.java create mode 100755 library/src/it/sephiroth/android/library/imagezoom/easing/Sine.java diff --git a/library/src/it/sephiroth/android/library/imagezoom/easing/Back.java b/library/src/it/sephiroth/android/library/imagezoom/easing/Back.java new file mode 100755 index 0000000..f523885 --- /dev/null +++ b/library/src/it/sephiroth/android/library/imagezoom/easing/Back.java @@ -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; + } +} diff --git a/library/src/it/sephiroth/android/library/imagezoom/easing/Bounce.java b/library/src/it/sephiroth/android/library/imagezoom/easing/Bounce.java new file mode 100755 index 0000000..a79835c --- /dev/null +++ b/library/src/it/sephiroth/android/library/imagezoom/easing/Bounce.java @@ -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; + } +} diff --git a/library/src/it/sephiroth/android/library/imagezoom/easing/Circ.java b/library/src/it/sephiroth/android/library/imagezoom/easing/Circ.java new file mode 100755 index 0000000..baf1640 --- /dev/null +++ b/library/src/it/sephiroth/android/library/imagezoom/easing/Circ.java @@ -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; + } + +} diff --git a/library/src/it/sephiroth/android/library/imagezoom/easing/Cubic.java b/library/src/it/sephiroth/android/library/imagezoom/easing/Cubic.java new file mode 100755 index 0000000..6f7e87d --- /dev/null +++ b/library/src/it/sephiroth/android/library/imagezoom/easing/Cubic.java @@ -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; + } +} diff --git a/library/src/it/sephiroth/android/library/imagezoom/easing/Easing.java b/library/src/it/sephiroth/android/library/imagezoom/easing/Easing.java new file mode 100755 index 0000000..202e9d9 --- /dev/null +++ b/library/src/it/sephiroth/android/library/imagezoom/easing/Easing.java @@ -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 ); +} diff --git a/library/src/it/sephiroth/android/library/imagezoom/easing/Elastic.java b/library/src/it/sephiroth/android/library/imagezoom/easing/Elastic.java new file mode 100755 index 0000000..1fdf44c --- /dev/null +++ b/library/src/it/sephiroth/android/library/imagezoom/easing/Elastic.java @@ -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; + } +} diff --git a/library/src/it/sephiroth/android/library/imagezoom/easing/Expo.java b/library/src/it/sephiroth/android/library/imagezoom/easing/Expo.java new file mode 100755 index 0000000..ece0eaf --- /dev/null +++ b/library/src/it/sephiroth/android/library/imagezoom/easing/Expo.java @@ -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; + } + +} diff --git a/library/src/it/sephiroth/android/library/imagezoom/easing/Linear.java b/library/src/it/sephiroth/android/library/imagezoom/easing/Linear.java new file mode 100755 index 0000000..6442012 --- /dev/null +++ b/library/src/it/sephiroth/android/library/imagezoom/easing/Linear.java @@ -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; + } + +} diff --git a/library/src/it/sephiroth/android/library/imagezoom/easing/Quad.java b/library/src/it/sephiroth/android/library/imagezoom/easing/Quad.java new file mode 100755 index 0000000..da8d805 --- /dev/null +++ b/library/src/it/sephiroth/android/library/imagezoom/easing/Quad.java @@ -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; + } + +} diff --git a/library/src/it/sephiroth/android/library/imagezoom/easing/Quart.java b/library/src/it/sephiroth/android/library/imagezoom/easing/Quart.java new file mode 100755 index 0000000..96a0feb --- /dev/null +++ b/library/src/it/sephiroth/android/library/imagezoom/easing/Quart.java @@ -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; + } + +} diff --git a/library/src/it/sephiroth/android/library/imagezoom/easing/Quint.java b/library/src/it/sephiroth/android/library/imagezoom/easing/Quint.java new file mode 100755 index 0000000..3c12358 --- /dev/null +++ b/library/src/it/sephiroth/android/library/imagezoom/easing/Quint.java @@ -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; + } + +} diff --git a/library/src/it/sephiroth/android/library/imagezoom/easing/Sine.java b/library/src/it/sephiroth/android/library/imagezoom/easing/Sine.java new file mode 100755 index 0000000..f7884d3 --- /dev/null +++ b/library/src/it/sephiroth/android/library/imagezoom/easing/Sine.java @@ -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; + } + +}