[Haskell-cafe] Animated line art

Tim Docker twd2 at dockerz.net
Mon Dec 8 05:59:09 EST 2008


On 06/12/2008, at 6:32 AM, Andrew Coppin wrote:

> Tim Docker wrote:
>> If you implement your drawing logic as a
>> function from time to the appropriate render actions, ie
>>
>> | import qualified Graphics.Rendering.Cairo as C
>> | | type Animation = Time -> C.Render ()
>>
>> then you just need to call this function multiple times to generate
>> sucessive frames.
>>
>
> That was my initial idea... but I'm not sure how well it would  
> work. I want to do stuff like fade elements in and out, move  
> complex structures around on the screen, etc. I think it might end  
> up being a little tangled if I go with this approach. I might be  
> wrong though...

This model of animation as "a function of time to a picture" is  
probably described in many places. I first saw it described in Paul  
Hudaks book "The haskell School of Expression: Learning functional  
programming through multimedia". It shows how primitive animations  
can be combined in various ways, including overlays and time  
transformations. You can download the code from the books web-site,  
which might be of interest even if you can't get hold of a copy of  
the book. It's intended for pedagogical purposes, rather than a  
comprehensive animation system, of course.

Tim


More information about the Haskell-Cafe mailing list