NAME

Video::Delay::Func - Video::Delay class for delays defined by math function.

SYNOPSIS

use Video::Delay::Func;

my $obj = Video::Delay::Func->new(%parameters);
my $delay = $obj->delay;

METHODS

new(%parameters)
Constructor
  • func

    Math function in string with 't' time variable.
    Or callback with one input argument as time variable.
    Default value is reference to subroutine:
      sub {
        my $t = shift;
        return 1000 * sin($t);
      };
  • incr

    Counter increment.
    Default value is 0.1.
delay()
Returns delay defined by function in miliseconds.
Time si affected by 'incr' increment parameter.

ERRORS

new():
        Parameter 'func' must be scalar or code.
        From Class::Utils::set_params():
                Unknown parameter '%s'.

delay():
        Error in function.
                Error, %s

EXAMPLE1

use strict;
use warnings;

use Video::Delay::Func;

# Object.
my $obj = Video::Delay::Func->new(
        'func' => sub {
                my $t = shift;
                return 1000 * sin($t);
        },
        'incr' => 0.1,
);

# Print delay.
print $obj->delay."\n";
print $obj->delay."\n";
print $obj->delay."\n";

# Output:
# 99.8334166468282
# 198.669330795061
# 295.52020666134

EXAMPLE2

use strict;
use warnings;

use Video::Delay::Func;

# Object.
my $obj = Video::Delay::Func->new(
        'func' => '1000 * sin(t)',
        'incr' => 0.1,
);

# Print delay.
print $obj->delay."\n";
print $obj->delay."\n";
print $obj->delay."\n";

# Output:
# 99.8334166468282
# 198.669330795061
# 295.52020666134

DEPENDENCIES

Class::Utils, English, Error::Pure.

SEE ALSO

Video::Delay

Perl classes for delays between frames generation.

REPOSITORY

https://github.com/michal-josef-spacek/Video-Delay

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2012-2020 Michal Josef Špaček
BSD 2-Clause License

VERSION

0.07