mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-14 09:32:22 +00:00
Add colormaps to documentation.
Former-commit-id: d9db76c4f0715800ef6f94e6618d6682a2c8112b
This commit is contained in:
parent
a4d6ae0156
commit
eb89cac14c
20 changed files with 261 additions and 10 deletions
18
examples/doc_sinebow.hs
Normal file
18
examples/doc_sinebow.hs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env stack
|
||||
-- stack runghc --package reanimate
|
||||
module Main(main) where
|
||||
|
||||
import Codec.Picture
|
||||
import Reanimate
|
||||
import Reanimate.Builtin.Documentation
|
||||
|
||||
main :: IO ()
|
||||
main = reanimate $ docEnv $ animate $ const $ mkColorMap sinebow
|
||||
|
||||
mkColorMap :: (Double -> PixelRGB8) -> SVG
|
||||
mkColorMap f = center $ scaleToSize screenWidth screenHeight $ embedImage img
|
||||
where
|
||||
width = 256
|
||||
height = 1
|
||||
img = generateImage pixelRenderer width height
|
||||
pixelRenderer x _y = f (fromIntegral x / fromIntegral (width-1))
|
||||
Loading…
Reference in a new issue