Skip to content

Commit

Permalink
add removed easing folder
Browse files Browse the repository at this point in the history
add removed easing folder
  • Loading branch information
DrKein committed Apr 2, 2014
1 parent 221fc68 commit 23d5800
Show file tree
Hide file tree
Showing 12 changed files with 306 additions and 0 deletions.
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;
}
}
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;
}
}
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;
}

}
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;
}
}
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 );
}
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;
}
}
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;
}

}
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;
}

}
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;
}

}
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;
}

}
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;
}

}
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;
}

}

0 comments on commit 23d5800

Please sign in to comment.