mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-12 00:23:08 +00:00
Fix warning.
This commit is contained in:
parent
5f883f3da6
commit
d6ae75c975
1 changed files with 20 additions and 10 deletions
|
|
@ -3,19 +3,20 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Main(main) where
|
||||
|
||||
import Reanimate
|
||||
import Reanimate.Builtin.Documentation
|
||||
import Reanimate.Scene
|
||||
import Reanimate.LaTeX
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
import Data.Text (Text)
|
||||
import Reanimate
|
||||
import Reanimate.Animation (Duration)
|
||||
import Reanimate.Builtin.Documentation
|
||||
import Reanimate.LaTeX
|
||||
import Reanimate.Scene
|
||||
|
||||
main :: IO ()
|
||||
main = reanimate $ docEnv $ mapA (withFillOpacity 1) $ sceneAnimation $ do
|
||||
line1 <- newLaTeX ["$>$ ", "knock!", " ", "knock!"]
|
||||
forM_ line1 $ \o ->
|
||||
oModify o $
|
||||
oTopY .~ (screenHeight/2)
|
||||
oModifyMany line1 $
|
||||
oTopY .~ screenTop
|
||||
|
||||
oFadeIn (line1!!0) 1
|
||||
oShow (line1!!1); wait 0.3
|
||||
|
|
@ -26,7 +27,7 @@ main = reanimate $ docEnv $ mapA (withFillOpacity 1) $ sceneAnimation $ do
|
|||
|
||||
oFadeIn (line2!!0) 1
|
||||
oDraw (line2!!1) 1
|
||||
|
||||
|
||||
line3 <- newLaTeX ["$>$ ", "$(\\lambda x . x)$"]
|
||||
mapM_ (`placeBelow` head line2) line3
|
||||
|
||||
|
|
@ -48,13 +49,22 @@ main = reanimate $ docEnv $ mapA (withFillOpacity 1) $ sceneAnimation $ do
|
|||
|
||||
wait 1
|
||||
|
||||
screenTop :: Double
|
||||
screenTop = screenHeight/2
|
||||
|
||||
oModifyMany :: [Object s a] -> (ObjectData a -> ObjectData a) -> Scene s ()
|
||||
oModifyMany os m = forM_ os $ \o -> oModify o m
|
||||
|
||||
placeBelow :: Object s a -> Object s b -> Scene s ()
|
||||
placeBelow a b = do
|
||||
bBot <- oRead b oBottomY
|
||||
oModify a $
|
||||
oTopY .~ bBot
|
||||
|
||||
newLaTeX :: [Text] -> Scene s [Object s SVG]
|
||||
newLaTeX chunks = mapM newObject $ map (translate (-4) 0) $ latexChunks chunks
|
||||
|
||||
oDraw :: Object s a -> Duration -> Scene s ()
|
||||
oDraw o d = do
|
||||
oShow o
|
||||
oTweenS o d $ \t ->
|
||||
|
|
|
|||
Loading…
Reference in a new issue