mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-14 09:32:22 +00:00
Wibbles to bazier.
This commit is contained in:
parent
92333a1ad1
commit
8cc7e76efc
2 changed files with 10 additions and 12 deletions
BIN
gifs/bezier.gif
BIN
gifs/bezier.gif
Binary file not shown.
|
Before Width: | Height: | Size: 272 KiB After Width: | Height: | Size: 340 KiB |
|
|
@ -350,7 +350,7 @@ latex_basic = proc () -> do
|
||||||
text = latex "\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}"
|
text = latex "\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}"
|
||||||
|
|
||||||
bezier :: Ani ()
|
bezier :: Ani ()
|
||||||
bezier = adjustSpeed 0.5 $ proc () -> do
|
bezier = adjustSpeed 0.4 $ proc () -> do
|
||||||
emit -< rect_ [width_ "100%", height_ "100%", fill_ "black"]
|
emit -< rect_ [width_ "100%", height_ "100%", fill_ "black"]
|
||||||
follow
|
follow
|
||||||
[ orderN [pointA, pointB]
|
[ orderN [pointA, pointB]
|
||||||
|
|
@ -375,18 +375,16 @@ bezier = adjustSpeed 0.5 $ proc () -> do
|
||||||
orderN lst = defineAnimation $ proc () -> do
|
orderN lst = defineAnimation $ proc () -> do
|
||||||
duration 2 -< ()
|
duration 2 -< ()
|
||||||
s <- signalOscillate 0 1 -< ()
|
s <- signalOscillate 0 1 -< ()
|
||||||
emit -< orderN' (map const lst) s
|
emit -< primaryCircleAt =<< orderN' (map const lst) s <* mapM_ secondaryCircleAt lst
|
||||||
orderN' [a] s = do
|
orderN' [a] s = do
|
||||||
renderPath $ take (round $ 1000*s) $ approxFnData 1000 $ \idx -> a idx
|
renderPath $ take (round $ 1000*s) $ approxFnData 1000 $ \idx -> a idx
|
||||||
primaryCircleAt (a s)
|
return (a s)
|
||||||
orderN' lst s = do
|
orderN' lst s = do
|
||||||
forM_ (zip lst (tail lst)) $ \(a,b) -> renderPath $
|
forM_ (zip lst (tail lst)) $ \(a,b) -> renderPath $
|
||||||
approxFnData 1000 $ \idx ->
|
approxFnData 1000 $ \idx ->
|
||||||
between (a s) (b s) idx
|
between (a s) (b s) idx
|
||||||
let middlePoints = map (\(a,b) -> \idx -> between (a idx) (b idx) idx) (zip lst (tail lst))
|
let middlePoints = map (\(a,b) -> \idx -> between (a idx) (b idx) idx) (zip lst (tail lst))
|
||||||
mapM_ secondaryCircleAt $ map ($s) middlePoints
|
orderN' middlePoints s <* mapM_ secondaryCircleAt (map ($s) middlePoints)
|
||||||
mapM_ secondaryCircleAt $ map ($s) lst
|
|
||||||
orderN' middlePoints s
|
|
||||||
|
|
||||||
secondaryCircleAt (x,y) = circle_ [num_ cx_ x, num_ cy_ y, num_ r_ 3, fill_ "green"]
|
secondaryCircleAt (x,y) = circle_ [num_ cx_ x, num_ cy_ y, num_ r_ 3, fill_ "green"]
|
||||||
primaryCircleAt (x,y) = circle_ [num_ cx_ x, num_ cy_ y, num_ r_ 3, fill_ "red"]
|
primaryCircleAt (x,y) = circle_ [num_ cx_ x, num_ cy_ y, num_ r_ 3, fill_ "red"]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue