我这里有一个人类对象。
my @path
中有一种人在漂浮的感觉,但没有框架变化。
如果将参数callback_args => [0,[@path]]
更改为callback_args => [0,0,0,1]
,则人偶有帧偏移但没有悬浮。
使框架保持最新的是最后一位≠0;这对应于交换速度。my $up
和 $down
中,最后一位是 ≠ 0。位置 0,-.3,0; X、Y、Z;我只是改变 y 上下。use strict;
use warnings;
use Curses;
use Term::Animation 2.0;
my $s = Term::Animation->new();
$s->color(1); # <-- uses the color2 type mask
my @human= (q{
o
/#\
/ \
},
q{
\o>
#
/ \
});
my $up = [0,-.3,0,.5];
my $down = [0,.3,0,.5];
my @path;
for(1..14){ push(@path, $up); }
for(1..14){ push(@path, $down)}
$s->new_entity(
shape => \@human,
position => [ 5, 5, 1],
callback_args => [0, [@path] ],
color => 'w',
wrap => 1,
);
halfdelay( 2 );
for(1..500) {
$s->animate();
my $in = lc( getch() );
if($in eq 'q') { last; }
}
如何保持人偶的悬浮和两帧?
您对所有动画帧使用相同的形状(形状框架)。你能尝试像这样明确地设置形状框架吗:
my @up = (0,-.3,0);
my @down = (0,.3,0);
my @path;
my $frame = 0;
for(1..14){ push @path, [@up, $frame]; $frame = ($frame + 1) %2;}
for(1..14){ push @path, [@down, $frame]; $frame = ($frame +1) %2;}