mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-18 03:12:40 +00:00
Fix examples.
Former-commit-id: 4257540d61687e043d18e0f29b86a0271a5f5ca6
This commit is contained in:
parent
83dae326e4
commit
a8a0fd8dd4
3 changed files with 7 additions and 5 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env stack
|
#!/usr/bin/env stack
|
||||||
-- stack --resolver lts-12.26 runghc --package reanimate
|
-- stack --resolver lts-13.14 runghc --package reanimate
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
module Main (main) where
|
module Main (main) where
|
||||||
|
|
||||||
|
|
@ -12,6 +12,7 @@ import Reanimate.Driver (reanimate)
|
||||||
import Reanimate.LaTeX (latex)
|
import Reanimate.LaTeX (latex)
|
||||||
import Reanimate.Monad
|
import Reanimate.Monad
|
||||||
import Reanimate.Svg
|
import Reanimate.Svg
|
||||||
|
import Reanimate.Signal
|
||||||
|
|
||||||
waveMultiplier :: Int
|
waveMultiplier :: Int
|
||||||
-- waveMultiplier = 1 -- Sawtooth wave
|
-- waveMultiplier = 1 -- Sawtooth wave
|
||||||
|
|
@ -33,7 +34,7 @@ sWidth = 0.5
|
||||||
fourierAnimation :: Int -> Animation
|
fourierAnimation :: Int -> Animation
|
||||||
fourierAnimation nCircles = repeatAnimation 2 $ mkAnimation 3 $ do
|
fourierAnimation nCircles = repeatAnimation 2 $ mkAnimation 3 $ do
|
||||||
emit $ mkBackground "black"
|
emit $ mkBackground "black"
|
||||||
phi <- signal 0 (2*pi)
|
phi <- getSignal $ signalFromTo 0 (2*pi) signalLinear
|
||||||
mapF (translate (-100) 0) $ do
|
mapF (translate (-100) 0) $ do
|
||||||
drawNCircles nCircles phi
|
drawNCircles nCircles phi
|
||||||
emit $ withStrokeColor "white" $
|
emit $ withStrokeColor "white" $
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import Reanimate.Driver (reanimate)
|
||||||
import Reanimate.LaTeX
|
import Reanimate.LaTeX
|
||||||
import Reanimate.Monad
|
import Reanimate.Monad
|
||||||
import Reanimate.Svg
|
import Reanimate.Svg
|
||||||
|
import Reanimate.Signal
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = reanimate $ pauseAtEnd 2 $
|
main = reanimate $ pauseAtEnd 2 $
|
||||||
|
|
@ -33,8 +34,8 @@ piPoints = lineToPoints 500 $
|
||||||
fourierAnimation_ :: Animation
|
fourierAnimation_ :: Animation
|
||||||
fourierAnimation_ = mkAnimation 50 $ do
|
fourierAnimation_ = mkAnimation 50 $ do
|
||||||
emit $ mkBackground "black"
|
emit $ mkBackground "black"
|
||||||
phi <- signal 0 15
|
phi <- getSignal $ signalFromTo 0 15 signalLinear
|
||||||
fLength <- signal 0 1
|
fLength <- getSignal signalLinear
|
||||||
|
|
||||||
let circles = setFourierLength (fLength*maxLength) piFourier
|
let circles = setFourierLength (fLength*maxLength) piFourier
|
||||||
maxLength = sum $ map magnitude $ take 499 $ drop 1 $ fourierCoefficients piFourier
|
maxLength = sum $ map magnitude $ take 499 $ drop 1 $ fourierCoefficients piFourier
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ main = reanimate $ autoReverse $ mkAnimation 5 $ do
|
||||||
] & filterRef .~ pure (Ref "goo")
|
] & filterRef .~ pure (Ref "goo")
|
||||||
where
|
where
|
||||||
sharpness = 10
|
sharpness = 10
|
||||||
dev = 10
|
dev = 5
|
||||||
radius = 25
|
radius = 25
|
||||||
circ = mkCircle (Num 0, Num 0) (Num radius)
|
circ = mkCircle (Num 0, Num 0) (Num radius)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue