NAME

Iterator::Breathe - Iterate a counter up and back

VERSION

version 0.0201

SYNOPSIS

use Iterator::Breathe;

my $it = Iterator::Breathe->new(
  top    => 255,
  bottom => -1,
);

$it = Iterator::Breathe->new(
  top    => 6.28,
  bottom => -3.14,
  step   => 0.1,
);

while ( 1 ) {
  $it->iterate;
  say $it->i;
}

DESCRIPTION

Iterator::Breathe increments and decrements an iterator value in a wave-like fashion.

ATTRIBUTES

direction

$direction = $it->direction;
$it->direction($dir);

Return or set the current value of direction.

Default: 1 (1=up, 0=down)

i

$i = $it->i;
$it->i($n);

Return or set the current value of i.

Default: 0

bottom

$bottom = $it->bottom;
$it->bottom($x);

Return or set the current value of bottom.

Default: 0

top

$top = $it->top;
$it->top($y);

Return or set the current value of top.

Default: 100

step

$step = $it->step;
$it->step($z);

Return or set the current value of step.

Default: 1

verbose

$verbose = $it->verbose;

Show progress.

Default: 0

METHODS

new

$it = Iterator::Breathe->new( %arguments );

Create a new Iterator::Breathe object.

iterate

$i = $it->iterate;

SEE ALSO

Moo

Scalar::Util

AUTHOR

Gene Boggs <gene@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2021 by Gene Boggs.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)