mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-12 00:23:08 +00:00
Move glue tutorial to imgur.
Former-commit-id: c67a532677c00d7ce65727abc2898db5448d2a96
This commit is contained in:
parent
c1bab1d7ba
commit
fe1a2e9ee9
5 changed files with 38 additions and 50 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env stack
|
||||
-- stack runghc --package reanimate
|
||||
-- stack runghc --package reanimate --package here
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
|
|
@ -25,7 +25,7 @@ main = seq texture $ reanimate $ pauseAtEnd 1 $ parA bg $ sceneAnimation $ do
|
|||
trans <- newVar 0
|
||||
rotX <- newVar 0
|
||||
rotY <- newVar 0
|
||||
_ <- newSprite $ do
|
||||
newSprite_ $ do
|
||||
getBend <- unVar bend
|
||||
getTrans <- unVar trans
|
||||
getRotX <- unVar rotX
|
||||
|
|
@ -35,17 +35,16 @@ main = seq texture $ reanimate $ pauseAtEnd 1 $ parA bg $ sceneAnimation $ do
|
|||
return $ seq (texture (t/dur)) $
|
||||
blender (script (texture (t/dur)) getBend getTrans getRotX getRotY)
|
||||
wait 2
|
||||
tweenVar trans 5 (\t v -> fromToS v (-2) $ curveS 2 t)
|
||||
tweenVar bend 5 (\t v -> fromToS v 1 $ curveS 2 t)
|
||||
tweenVar rotY 15 (\t v -> fromToS v (pi*2*2) $ curveS 2 t)
|
||||
fork $ tweenVar trans 5 $ \v -> fromToS v (-2) . curveS 2
|
||||
fork $ tweenVar bend 5 $ \v -> fromToS v 1 . curveS 2
|
||||
fork $ tweenVar rotY 15 $ \v -> fromToS v (pi*2*2) . curveS 2
|
||||
fork $ do
|
||||
tweenVar rotX 5 (\t v -> fromToS v (-pi/5) $ curveS 2 t)
|
||||
wait 5
|
||||
tweenVar rotX 5 (\t v -> fromToS v (pi/5) $ curveS 2 t)
|
||||
tweenVar rotX 5 $ \v -> fromToS v (-pi/5) . curveS 2
|
||||
tweenVar rotX 5 $ \v -> fromToS v (pi/5) . curveS 2
|
||||
wait (15-5)
|
||||
tweenVar bend 5 (\t v -> fromToS v 0 $ curveS 2 t)
|
||||
tweenVar rotX 5 (\t v -> fromToS v 0 $ curveS 2 t)
|
||||
tweenVar trans 5 (\t v -> fromToS v 0 $ curveS 2 t)
|
||||
fork $ tweenVar bend 5 $ \v -> fromToS v 0 . curveS 2
|
||||
fork $ tweenVar rotX 5 $ \v -> fromToS v 0 . curveS 2
|
||||
fork $ tweenVar trans 5 $ \v -> fromToS v 0 . curveS 2
|
||||
wait 4
|
||||
-- tweenVar trans 1 (\t v -> fromToS v 0 $ curveS 2 t)
|
||||
wait 1
|
||||
|
|
@ -180,7 +179,7 @@ latexExample = sceneAnimation $ do
|
|||
-- Draw equation
|
||||
play $ drawAnimation strokedSvg
|
||||
sprites <- forM glyphs $ \(fn, _, elt) ->
|
||||
newSpriteA $ animate $ const $ fn elt
|
||||
newSpriteSVG $ fn elt
|
||||
-- Yoink each glyph
|
||||
forM_ (reverse sprites) $ \sprite -> do
|
||||
spriteE sprite (overBeginning 1 $ aroundCenterE $ highlightE)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ mainScene = sceneAnimation $ mdo
|
|||
svgCAF = center $ latex "\\LaTeX"
|
||||
getNth n = snd (splitGlyphs [n] svgCAF)
|
||||
svgs = [
|
||||
withStrokeWidth 0.01 $
|
||||
withStrokeWidth defaultStrokeWidth $
|
||||
scale 2 $
|
||||
translate 0 (tickLength*2) $
|
||||
withStrokeColor "black" $
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ main = reanimate $ parA bg $ sceneAnimation $ do
|
|||
xRot <- newVar (-30)
|
||||
yRot <- newVar 180
|
||||
zRot <- newVar 0
|
||||
_ <- newSprite $ do
|
||||
newSprite_ $ do
|
||||
getX <- unVar xRot
|
||||
getY <- unVar yRot
|
||||
getZ <- unVar zRot
|
||||
|
|
@ -36,11 +36,11 @@ main = reanimate $ parA bg $ sceneAnimation $ do
|
|||
script (svgAsPngFile (texture (t/dur))) getX getY getZ
|
||||
wait 2
|
||||
let tDuration = 10
|
||||
tweenVar yRot tDuration (\t v -> fromToS v (v+180) $ curveS 2 (t/tDuration))
|
||||
tweenVar xRot (tDuration/2) (\t v -> fromToS v (v+60) $ curveS 2 (t/(tDuration/2)))
|
||||
fork $ tweenVar yRot tDuration $ \v -> fromToS v (v+180) . curveS 2
|
||||
fork $ tweenVar xRot (tDuration/2) $ \v -> fromToS v (v+60) . curveS 2
|
||||
fork $ do
|
||||
wait (tDuration/2)
|
||||
tweenVar xRot (tDuration/2) (\t v -> fromToS v (v-60) $ curveS 2 (t/(tDuration/2)))
|
||||
tweenVar xRot (tDuration/2) $ \v -> fromToS v (v-60) . curveS 2
|
||||
wait tDuration
|
||||
wait 2
|
||||
where
|
||||
|
|
@ -128,7 +128,7 @@ latexExample = sceneAnimation $ do
|
|||
-- Draw equation
|
||||
play $ drawAnimation strokedSvg
|
||||
sprites <- forM glyphs $ \(fn, _, elt) ->
|
||||
newSpriteA $ animate $ const $ fn elt
|
||||
newSpriteSVG $ fn elt
|
||||
-- Yoink each glyph
|
||||
forM_ (reverse sprites) $ \sprite -> do
|
||||
spriteE sprite (overBeginning 1 $ aroundCenterE $ highlightE)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ main = reanimate $ bg `parA` chainT (overlapT transitionTime fadeT)
|
|||
comp4 = svgComponent "Images" (scale 0.5 svgLogo)
|
||||
comp5 = svgComponent "Paths" $
|
||||
withFillOpacity 0 $
|
||||
scale 8 $ withStrokeWidth (defaultStrokeWidth*0.3) $
|
||||
scale 8 $ withStrokeWidth defaultStrokeWidth $
|
||||
center $ latex "$\\pi$"
|
||||
comp6 = svgComponent "Blurs" mkBlur
|
||||
comp7 = svgComponent "Blobs" mkBlob
|
||||
|
|
|
|||
Loading…
Reference in a new issue