Mercurial > repos > public > sbplib
changeset 79:4cd77c7bdcaf
Fixed bug in anim.animate for starting times != 0.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 25 Nov 2015 18:32:29 +0100 |
parents | 80948a4084f3 |
children | 14bf01b7a068 |
files | +anim/animate.m |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
diff -r 80948a4084f3 -r 4cd77c7bdcaf +anim/animate.m --- a/+anim/animate.m Wed Nov 25 15:41:10 2015 +0100 +++ b/+anim/animate.m Wed Nov 25 18:32:29 2015 +0100 @@ -5,7 +5,7 @@ % it will be called for increasnig t. %Todo: make it catch up and produce warnings if it lags behind? Instead of just requesting the next target time -function animate(F, t, tend, time_modifier , frame_rate) +function animate(F, tstart, tend, time_modifier , frame_rate) if ~exist('time_modifier') time_modifier = 1; end @@ -18,12 +18,10 @@ dt = frame_time*time_modifier; animation_start = tic(); - t = F(t); + t = F(tstart); while t < tend t = F(t + dt); - - t_left = t/time_modifier-toc(animation_start); - + t_left = (t-tstart)/time_modifier-toc(animation_start); pause(t_left) end time_to_animate = toc(animation_start);