Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/animation|the CHICKEN 5 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-5.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. == animation Utility for creating animations from a series of images [[toc:]] === {{make-animator}} <procedure>(make-animator #!key (magnitude 10000) (frames-per-second 4) (type png) (width 1600) (height 900)) → Two values: next-frame and finalize</procedure> Create an animator, which consists of two values: a frame-creator and a finalizer. {{Next-frame}} is a niladic function which returns the filename of the next frame; {{finalize}} is a monadic function taking the name of the resultant animation (e.g. {{"graph.avi"}}). ; {{magnitude}} : Roughly the number of animations one anticipates ; {{frames-per-second}} : Frames per second ; {{type}} : The frame type; one of e.g. "png", "jpg" ; {{width}} : The width of the frame in pixels (#f for no scaling) ; {{height}} : The height of the frame (#f for no scaling) <enscript highlight="scheme">(define (make-animator #!key (magnitude 10000) (frames-per-second 4) (type "png") (width 1600) (height 900)) (let ((directory (create-temporary-directory)) (current-frame 0) (digits (inexact->exact (ceiling (/ (log magnitude) (log 10)))))) (define (next-frame) (let ((frame (make-pathname directory (format (format "~~~a,48d" digits) current-frame) type))) (inc! current-frame) frame)) (define (finalize animation) (let ((options (option-string (append `((type unquote type) (fps unquote frames-per-second)) (if width `((w unquote width)) '()) (if height `((h unquote height)) '()))))) (run (mencoder ,(format "mf://~a" (make-pathname directory (format "*.~a" type))) -mf ,options -ovc lavc -o ,animation)))) (values next-frame finalize))) </enscript> ==== Examples In this hypothetical example, we're running a depth-first-search on a graph; outputting an animation frame every step. (receive (next-frame finalize) (make-animator) (let ((graph (make-random-graph))) (call-for-each-frame (depth-first-search graph) (lambda (graph) (write-graph-as-png graph (next-frame)))) (finalize "graph"))) === About this egg ==== Author [[/users/klutometis|Peter Danenberg]] ==== Repository [[https://github.com/klutometis/animation]] ==== License BSD ==== Dependencies * [[format]] * [[hahn]] * [[matchable]] * [[miscmacros]] * [[shell]] * [[setup-helper]] ==== Versions ; [[https://github.com/klutometis/animation/releases/tag/0.1|0.1]] : Initial release ; [[https://github.com/klutometis/animation/releases/tag/0.2|0.2]] : Fix cock-invocation. ; [[https://github.com/klutometis/animation/releases/tag/0.3|0.3]] : Add width and height. ; [[https://github.com/klutometis/animation/releases/tag/0.3.1|0.3.1]] : Remove the dependency on setup-helper-cock. ; [[https://github.com/klutometis/animation/releases/tag/0.3.2|0.3.2]] : Remove the dependency on debug. ; [[https://github.com/klutometis/animation/releases/tag/0.3.3|0.3.3]] : Use hahn. ==== Colophon Documented by [[/egg/hahn|hahn]].
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 14 to 16?