From 6060b12ccb2d8e6a9ab4aafbe7d24e5e77cc75bf Mon Sep 17 00:00:00 2001 From: Rex Ford Date: Sun, 10 Aug 2008 18:22:32 -0500 Subject: [PATCH] minor additions --- extra/animations/animations.factor | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/extra/animations/animations.factor b/extra/animations/animations.factor index 7efd618bbf..db5b3448c1 100644 --- a/extra/animations/animations.factor +++ b/extra/animations/animations.factor @@ -2,11 +2,14 @@ USING: kernel shuffle system locals prettyprint math io namespaces threads calendar ; -IN: extra.animations +IN: animations SYMBOL: last-loop +SYMBOL: sleep-period + : reset-progress ( -- ) millis last-loop set ; : progress ( -- progress ) millis last-loop get - reset-progress ; : set-end ( duration -- end-time ) dt>milliseconds millis + ; -: loop ( quot end -- ) dup millis > [ [ dup call ] dip loop ] [ 2drop ] if ; -: animate ( quot duration -- ) reset-progress set-end loop ; \ No newline at end of file +: loop ( quot end -- ) dup millis > [ [ dup call ] dip loop ] [ 2drop ] if ; inline +: animate ( quot duration -- ) reset-progress set-end loop ; inline +: sample ( revs quot -- avg ) reset-progress dupd times progress swap / ; inline \ No newline at end of file