Shine wraps JavaScript’s drawing functions in a declarative API, hiding the boilerplate canvas code.
The API mimics the one provided by gloss (Picture, animate, play…), but some types are different to better adapt to js code (ex. images, fonts, inputs). Example: main = runWebGUI $ \ webView -> do ctx <- fixedSizeCanvas webView 800 600 let concentricCircles = foldMap Circle [1,10..100] draw ctx concentricCircles -- one-shot drawing The only direct dependency is ghcjs-dom, so the resulting jsexe should be relatively lightweight. I also wrote shine-varying, a FRP interface to shine in terms of Vars plus some utility Vars. Example (translation of the resize-yogi Elm example): resizeImage img (x',y') = Translate (x/2) (y/2) -- Pictures are centered on (0,0), so we need to move it $ Image (Stretched x y) img -- Scale the picture to the given position where x = fromIntegral x' -- mousePosition is Integral y = fromIntegral y' main = runWebGUI $ \ webView -> do ctx <- fixedSizeCanvas webView 1024 768 Just doc <- webViewGetDomDocument webView narwhal <- makeImage "https://wiki.haskell.org/wikiupload/8/85/NarleyYeeaaahh.jpg" let resizedNarwhal = resizeImage narwhal <$> mousePosition playVarying ctx doc 30 resizedNarwhal I plan to write/port a few simple games with it soon. Francesco
_______________________________________________ Haskell mailing list Haskell@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell