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