Fix examples.

Former-commit-id: 4257540d61687e043d18e0f29b86a0271a5f5ca6
This commit is contained in:
David Himmelstrup 2019-09-08 16:18:00 +08:00
commit a8a0fd8dd4
3 changed files with 7 additions and 5 deletions

View file

@ -1,5 +1,5 @@
#!/usr/bin/env stack
-- stack --resolver lts-12.26 runghc --package reanimate
-- stack --resolver lts-13.14 runghc --package reanimate
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
@ -12,6 +12,7 @@ import Reanimate.Driver (reanimate)
import Reanimate.LaTeX (latex)
import Reanimate.Monad
import Reanimate.Svg
import Reanimate.Signal
waveMultiplier :: Int
-- waveMultiplier = 1 -- Sawtooth wave
@ -33,7 +34,7 @@ sWidth = 0.5
fourierAnimation :: Int -> Animation
fourierAnimation nCircles = repeatAnimation 2 $ mkAnimation 3 $ do
emit $ mkBackground "black"
phi <- signal 0 (2*pi)
phi <- getSignal $ signalFromTo 0 (2*pi) signalLinear
mapF (translate (-100) 0) $ do
drawNCircles nCircles phi
emit $ withStrokeColor "white" $

View file

@ -14,6 +14,7 @@ import Reanimate.Driver (reanimate)
import Reanimate.LaTeX
import Reanimate.Monad
import Reanimate.Svg
import Reanimate.Signal
main :: IO ()
main = reanimate $ pauseAtEnd 2 $
@ -33,8 +34,8 @@ piPoints = lineToPoints 500 $
fourierAnimation_ :: Animation
fourierAnimation_ = mkAnimation 50 $ do
emit $ mkBackground "black"
phi <- signal 0 15
fLength <- signal 0 1
phi <- getSignal $ signalFromTo 0 15 signalLinear
fLength <- getSignal signalLinear
let circles = setFourierLength (fLength*maxLength) piFourier
maxLength = sum $ map magnitude $ take 499 $ drop 1 $ fourierCoefficients piFourier

View file

@ -58,7 +58,7 @@ main = reanimate $ autoReverse $ mkAnimation 5 $ do
] & filterRef .~ pure (Ref "goo")
where
sharpness = 10
dev = 10
dev = 5
radius = 25
circ = mkCircle (Num 0, Num 0) (Num radius)