From a8a0fd8dd4c287bcb192e5b980cc9f8c728d40b7 Mon Sep 17 00:00:00 2001 From: David Himmelstrup Date: Sun, 8 Sep 2019 16:18:00 +0800 Subject: [PATCH] Fix examples. Former-commit-id: 4257540d61687e043d18e0f29b86a0271a5f5ca6 --- examples/fourier.hs | 5 +++-- examples/fourier_draw.hs | 5 +++-- examples/goo.hs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/fourier.hs b/examples/fourier.hs index 328872f..912c385 100755 --- a/examples/fourier.hs +++ b/examples/fourier.hs @@ -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" $ diff --git a/examples/fourier_draw.hs b/examples/fourier_draw.hs index d25e47f..5a0acea 100755 --- a/examples/fourier_draw.hs +++ b/examples/fourier_draw.hs @@ -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 diff --git a/examples/goo.hs b/examples/goo.hs index 74d8621..fdbd788 100755 --- a/examples/goo.hs +++ b/examples/goo.hs @@ -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)