reanimate/examples/polyshape_test2.hs
Jan Hrček 3d20cf49ef Fix some hlint warnings
Former-commit-id: e9b81a8bc0b0c99abe57644e8806c437759ca687
2019-12-11 07:50:27 +08:00

34 lines
988 B
Haskell
Executable file

#!/usr/bin/env stack
-- stack runghc --package reanimate
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Reanimate
import Reanimate.PolyShape
polygonTest :: Animation
polygonTest = mkAnimation 10 $ \t ->
let s = fromToS 0.5 (-0.5) t
bigBox = head $ svgToPolyShapes $ pathify $
mkRect 2 2
smallBox = head $ svgToPolyShapes $ pathify $
translate 0 (screenHeight*s) $
rotate (-45) $
mkRect 1 1
overlap = mkGroup $ map renderPolyShape [bigBox, smallBox]
merged = translate (screenWidth/2*0.1) 0 $
mkGroup $ map renderPolyShape $
unionPolyShapes [bigBox, smallBox]
in std $ gridLayout [[ overlap, merged ]]
where
std =
withFillOpacity 1 .
withFillColor "blue" .
withStrokeWidth 0.01 .
withStrokeColor "white"
main :: IO ()
main = reanimate $ bg `parA` polygonTest
where
bg = animate $ const $ mkBackground "black"