Set viewbox to 16 by 9. (#11)

* Set viewbox to 16 by 9.

* Update examples and fix process termination bug in driver.

* Add module for constants.


Former-commit-id: 1c77569e771455e674485e2fc58ee57e7df5f3c5
This commit is contained in:
David Himmelstrup 2019-09-18 19:20:14 +08:00 committed by GitHub
commit 89905ebe39
24 changed files with 167 additions and 121 deletions

View file

@ -25,6 +25,7 @@ import qualified Data.Vector.Unboxed as V
import Debug.Trace
import System.Random
import System.Random.Shuffle
import Reanimate.Constants
main :: IO ()
main = reanimate $
@ -44,18 +45,22 @@ demonstrateAlgorithm name algo = mkAnimation 10 $ do
where
num = (sortedDat !! y) V.! x
sortedDat = runSort' seed algo width
width = 1024
-- width = 1024
width = 500
height = length sortedDat
emit $ mkGroup
[ mkBackground "black"
, translate 0 (10) $ center $ scaleToSize 150 150 $ embedImage img
, translate 0 (-75) $ withFillColor "white" $ scale 1.5 $ center $
, translate 0 (-screenWidth*0.03) $ center $ scaleXY (-1) 1 $
scaleToSize 7.5 7.5 $ embedImage img
, translate 0 (screenWidth*0.24) $ withFillColor "white" $ scale 1 $ center $
latex name
, withFillColor "white" $ translate (-85) 10 $ rotate 90 $ center $
, withFillColor "white" $
translate (-screenWidth*0.26) (-screenHeight*0.05) $
rotate (-90) $ scale 0.5 $ center $
latex "$Time \\rightarrow$"
, withFillColor "white" $ translate (90) 10 $
mkCircle (Num $ (1-s)*10)
, withFillColor "white" $ translate ((screenWidth*0.30)) 0 $
mkCircle (Num $ (1-s)*0.5)
]
where