Algorithm-Easing

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN


2. You may apply bug fixes, portability fixes and other modifications derived
from the Public Domain or from the Copyright Holder. A Package modified in such
a way shall still be considered the Standard Version.

3. You may otherwise modify your copy of this Package in any way, provided that
you insert a prominent notice in each changed file stating how and when you
changed that file, and provided that you do at least ONE of the following:

  a) place your modifications in the Public Domain or otherwise make them
     Freely Available, such as by posting said modifications to Usenet or an
     equivalent medium, or placing the modifications on a major archive site
     such as ftp.uu.net, or by allowing the Copyright Holder to include your
     modifications in the Standard Version of the Package.

  b) use the modified Package only within your corporation or organization.

  c) rename any non-standard executables so the names do not conflict with
     standard executables, which must also be provided, and provide a separate
     manual page for each non-standard executable that clearly documents how it
     differs from the Standard Version.

lib/Algorithm/Easing/Backdraft.pm  view on Meta::CPAN

use namespace::clean;

sub ease_in  {
    my $self = shift;
    my ($t,$b,$c,$d) = (shift,shift,shift,shift);

    return $b if ($t < EPSILON);
    return $c if ($d < EPSILON);

    my $s = 1.70158;
    my $post_fix = $t /= $d;
    return $c * ($post_fix) * $t * (($s + 1) * $t - $s) + $b;
}

sub ease_out  {
    my $self = shift;
    my ($t,$b,$c,$d) = (shift,shift,shift,shift);

    return $b if ($t < EPSILON);
    return $c if ($d < EPSILON);

    my $s = 1.70158;

lib/Algorithm/Easing/Backdraft.pm  view on Meta::CPAN

    my $self = shift;
    my ($t,$b,$c,$d) = (shift,shift,shift,shift);

    return $b if ($t < EPSILON);
    return $c if ($d < EPSILON);

    my $s = 1.70158;
    if (($t /= $d / 2) < 1) {
        return $c / 2 * ($t * $t * ((($s *= (1.525)) + 1 )* $t - $s)) + $b;
    }
    my $post_fix = $t-= 2;
    return $c / 2 * (($post_fix) * $t * ((($s *= (1.525)) + 1) * $t + $s) + 2) + $b;
}

1;

__END__

# MAN3 POD

=head1 NAME

lib/Algorithm/Easing/Bounce.pm  view on Meta::CPAN

sub ease_out {
    my $self = shift;
    my ($t,$b,$c,$d) = (shift,shift,shift,shift);

    return $b if ($t < EPSILON);
    return $c if ($d < EPSILON);

    if (($t /= $d) < (1 / 2.75)) {
        return $c * (7.5625 * $t * $t) + $b;
    } elsif ($t < (2 / 2.75)) {
        my $post_fix = $t-=(1.5 / 2.75);
        return $c * (7.5625 * ($post_fix) * $t + 0.75) + $b;
    } elsif ($t < (2.5/2.75)) {
        my $post_fix = $t -= (2.25 / 2.75);
        return $c * (7.5625 * ($post_fix) * $t + 0.9375) + $b;
    } else {
        my $post_fix = $t -= (2.625 / 2.75);
        return $c * (7.5625 * ($post_fix) * $t + 0.984375) + $b;
    }
}

sub ease_both {
    my $self = shift;
    my ($t,$b,$c,$d) = (shift,shift,shift,shift);

    return $b if ($t < EPSILON);
    return $c if ($d < EPSILON);



( run in 1.085 second using v1.01-cache-2.11-cpan-ceb78f64989 )