mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-12 00:23:08 +00:00
Clean up examples.
Former-commit-id: 03934429a7a98d8c2891452e802e348a0456886a
This commit is contained in:
parent
07f47b92b0
commit
f10bc16726
12 changed files with 72 additions and 79 deletions
|
|
@ -6,7 +6,6 @@ module Main (main) where
|
|||
|
||||
import Data.String.Here
|
||||
import Reanimate
|
||||
import Reanimate.Blender
|
||||
|
||||
main :: IO ()
|
||||
main = reanimate $ mkAnimation 5 $ \t ->
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ module Main (main) where
|
|||
import Data.String.Here
|
||||
import qualified Data.Text as T
|
||||
import Reanimate
|
||||
import Reanimate.Blender
|
||||
import Reanimate.Raster
|
||||
|
||||
main :: IO ()
|
||||
main = reanimate $ mkAnimation 5 $ \t ->
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import Control.Monad (forM_)
|
|||
import Graphics.SvgTree (Tree)
|
||||
import Reanimate
|
||||
import Reanimate.Driver (reanimate)
|
||||
import Reanimate.Effect
|
||||
|
||||
main :: IO ()
|
||||
main = reanimate $ bg `parA` mainScene
|
||||
|
|
|
|||
|
|
@ -3,12 +3,10 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Main(main) where
|
||||
|
||||
import Reanimate
|
||||
|
||||
import Codec.Picture.Types
|
||||
import Data.Text (Text)
|
||||
import Reanimate
|
||||
import Reanimate.Animation
|
||||
import Reanimate.Effect
|
||||
import Reanimate.Scene
|
||||
|
||||
bgColor :: PixelRGBA8
|
||||
bgColor = PixelRGBA8 252 252 252 0xFF
|
||||
|
|
|
|||
|
|
@ -2,24 +2,19 @@
|
|||
-- stack runghc --package reanimate
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE BangPatterns #-}
|
||||
module Main (main) where
|
||||
|
||||
import Data.String.Here
|
||||
import qualified Data.Text as T
|
||||
import Reanimate
|
||||
import Reanimate.Blender
|
||||
import Reanimate.Raster
|
||||
import Reanimate.Scene
|
||||
import Reanimate.Animation
|
||||
import Reanimate.Effect
|
||||
import Graphics.SvgTree
|
||||
import System.Random
|
||||
import System.Random.Shuffle
|
||||
|
||||
import Codec.Picture.Types
|
||||
import Control.Lens ((^.))
|
||||
import Control.Monad
|
||||
import Data.Monoid
|
||||
import Codec.Picture.Types
|
||||
import Data.String.Here
|
||||
import qualified Data.Text as T
|
||||
import Graphics.SvgTree
|
||||
import System.Random
|
||||
import System.Random.Shuffle
|
||||
|
||||
main :: IO ()
|
||||
main = seq texture $ reanimate $ pauseAtEnd 1 $ parA bg $ sceneAnimation $ do
|
||||
|
|
|
|||
|
|
@ -4,11 +4,10 @@
|
|||
{-# LANGUAGE RecursiveDo #-}
|
||||
module Main (main) where
|
||||
|
||||
import Reanimate
|
||||
|
||||
import Control.Monad (forM_)
|
||||
import Graphics.SvgTree (Tree)
|
||||
import Reanimate
|
||||
import Reanimate.Driver (reanimate)
|
||||
import Reanimate.Effect
|
||||
import Codec.Picture
|
||||
|
||||
main :: IO ()
|
||||
|
|
|
|||
|
|
@ -3,15 +3,14 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Main (main) where
|
||||
|
||||
import Reanimate
|
||||
|
||||
import Codec.Picture
|
||||
import Codec.Picture.Types
|
||||
import Control.Lens ((^.))
|
||||
import Control.Monad
|
||||
import Data.Monoid
|
||||
import Graphics.SvgTree
|
||||
import Reanimate
|
||||
import Reanimate.Effect
|
||||
import Reanimate.Scene
|
||||
import System.Random
|
||||
import System.Random.Shuffle
|
||||
|
||||
|
|
|
|||
|
|
@ -4,32 +4,24 @@
|
|||
{-# LANGUAGE QuasiQuotes #-}
|
||||
module Main (main) where
|
||||
|
||||
import Reanimate
|
||||
import Reanimate.Povray (povraySlow')
|
||||
|
||||
import Codec.Picture
|
||||
import Control.Monad
|
||||
import Data.String.Here
|
||||
import Data.Text (Text)
|
||||
import Reanimate
|
||||
import Reanimate.Povray
|
||||
import Reanimate.Raster
|
||||
import Reanimate.Scene
|
||||
|
||||
main :: IO ()
|
||||
main = reanimate $ parA bg $ sceneAnimation $ do
|
||||
play $ mkAnimation drawDuration $ \t -> partialSvg t (wireframe (-45) 220)
|
||||
xRot <- newVar (-45)
|
||||
yRot <- newVar 220
|
||||
-- _ <- newSprite $ do
|
||||
-- getX <- freezeVar xRot
|
||||
-- getY <- freezeVar yRot
|
||||
-- return $ \real_t dur t ->
|
||||
-- povraySlow [] $
|
||||
-- script (svgAsPngFile (texture (t/dur))) (getX real_t) (getY real_t) 0
|
||||
wf <- newSprite $ do
|
||||
getX <- freezeVar xRot
|
||||
getY <- freezeVar yRot
|
||||
return $ \real_t _dur _t ->
|
||||
wireframe (getX real_t) (getY real_t)
|
||||
--wait 2
|
||||
tweenVar yRot spinDur (\t v -> fromToS v (v+60*3) $ curveS 2 (t/spinDur))
|
||||
replicateM_ wobbles $ do
|
||||
tweenVar xRot (wobbleDur/2) (\t v -> fromToS v (v+90) $ curveS 2 (t/(wobbleDur/2)))
|
||||
|
|
@ -37,7 +29,6 @@ main = reanimate $ parA bg $ sceneAnimation $ do
|
|||
wait (wobbleDur/2)
|
||||
tweenVar xRot (wobbleDur/2) (\t v -> fromToS v (v-90) $ curveS 2 (t/(wobbleDur/2)))
|
||||
wait wobbleDur
|
||||
--wait 2
|
||||
destroySprite wf
|
||||
play $ mkAnimation drawDuration (\t -> partialSvg t (wireframe (-45) 220))
|
||||
# reverseA
|
||||
|
|
@ -60,26 +51,16 @@ wireframe rotX rotY =
|
|||
mkPath $ extractPath $
|
||||
vectorize_ ["-t","100"] $
|
||||
povraySlow' [] $
|
||||
script (svgAsPngFile texture) rotX rotY 0
|
||||
script (svgAsPngFile texture) rotX rotY
|
||||
|
||||
texture :: SVG
|
||||
texture = checker 10 10
|
||||
|
||||
script :: FilePath -> Double -> Double -> Double -> Text
|
||||
script png rotX rotY rotZ = [iTrim|
|
||||
//Files with predefined colors and textures
|
||||
script :: FilePath -> Double -> Double -> Text
|
||||
script png rotX rotY = [iTrim|
|
||||
#include "colors.inc"
|
||||
|
||||
#include "shapes3.inc"
|
||||
|
||||
//Place the camera
|
||||
camera {
|
||||
orthographic
|
||||
location <0,0,-10>
|
||||
look_at <0,0,0>
|
||||
up y*9
|
||||
right x*16
|
||||
}
|
||||
camera {
|
||||
perspective
|
||||
location <0,0,-9>
|
||||
|
|
@ -88,13 +69,10 @@ camera {
|
|||
right x*16/9
|
||||
}
|
||||
|
||||
|
||||
//Ambient light to "brighten up" darker pictures
|
||||
global_settings { ambient_light White*3 }
|
||||
|
||||
//Set a background color
|
||||
//background { color White }
|
||||
//background { color rgbt <0.1, 0, 0, 0> } // red
|
||||
background { color rgbt <0, 0, 0, 1> } // transparent
|
||||
|
||||
//Sphere with specified center point and radius
|
||||
|
|
@ -105,16 +83,15 @@ sphere {
|
|||
image_map{ png ${png} }
|
||||
}
|
||||
}
|
||||
rotate <0,${rotY},${rotZ}>
|
||||
rotate <0,${rotY},0>
|
||||
rotate <${rotX},0,0>
|
||||
}
|
||||
|
||||
|]
|
||||
|
||||
checker :: Int -> Int -> SVG
|
||||
checker w h =
|
||||
withStrokeColor "lightblue" $
|
||||
withStrokeWidth (defaultStrokeWidth/2) $
|
||||
withStrokeWidth (defaultStrokeWidth*4) $
|
||||
mkGroup
|
||||
[ withStrokeWidth 0 $
|
||||
withFillOpacity 0.8 $ mkBackground "white"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
{-# LANGUAGE QuasiQuotes #-}
|
||||
module Main (main) where
|
||||
|
||||
import Reanimate
|
||||
import Reanimate.Povray (povraySlow)
|
||||
|
||||
import Codec.Picture
|
||||
import Codec.Picture.Types
|
||||
import Control.Lens ((^.))
|
||||
|
|
@ -12,12 +15,6 @@ import Data.Monoid
|
|||
import Data.String.Here
|
||||
import Data.Text (Text)
|
||||
import Graphics.SvgTree hiding (Text)
|
||||
import Reanimate
|
||||
import Reanimate.Animation
|
||||
import Reanimate.Effect
|
||||
import Reanimate.Povray
|
||||
import Reanimate.Raster
|
||||
import Reanimate.Scene
|
||||
import System.Random
|
||||
import System.Random.Shuffle
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
{-# LANGUAGE QuasiQuotes #-}
|
||||
module Main (main) where
|
||||
|
||||
import Reanimate
|
||||
import Reanimate.Povray
|
||||
|
||||
import Codec.Picture
|
||||
import Codec.Picture.Types
|
||||
import Control.Lens ((^.))
|
||||
|
|
@ -12,12 +15,6 @@ import Data.Monoid
|
|||
import Data.String.Here
|
||||
import Data.Text (Text)
|
||||
import Graphics.SvgTree hiding (Text)
|
||||
import Reanimate
|
||||
import Reanimate.Animation
|
||||
import Reanimate.Effect
|
||||
import Reanimate.Povray
|
||||
import Reanimate.Raster
|
||||
import Reanimate.Scene
|
||||
import System.Random
|
||||
import System.Random.Shuffle
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,13 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Main (main) where
|
||||
|
||||
import Data.Text (Text)
|
||||
import Reanimate
|
||||
import Reanimate.Builtin.Images
|
||||
import Reanimate.Effect
|
||||
import Reanimate.Scene
|
||||
import Graphics.SvgTree hiding (Text)
|
||||
import Control.Lens
|
||||
|
||||
import Codec.Picture
|
||||
import Control.Lens
|
||||
import Data.Text (Text)
|
||||
import Graphics.SvgTree hiding (Text)
|
||||
|
||||
bgColor :: PixelRGBA8
|
||||
bgColor = PixelRGBA8 252 252 252 0xFF
|
||||
|
|
@ -101,4 +100,3 @@ mkBlob =
|
|||
|
||||
mkFilter :: String -> [FilterElement] -> Filter
|
||||
mkFilter ident fe = defaultSvg & filterChildren .~ fe & attrId .~ Just ident
|
||||
|
||||
|
|
|
|||
|
|
@ -26,10 +26,12 @@ module Reanimate
|
|||
reanimate,
|
||||
-- * Animations
|
||||
SVG,
|
||||
Time,
|
||||
Animation(..),
|
||||
mkAnimation,
|
||||
animate,
|
||||
duration,
|
||||
frameAt,
|
||||
-- ** Composition
|
||||
seqA,
|
||||
parA,
|
||||
|
|
@ -71,6 +73,32 @@ module Reanimate
|
|||
wait,
|
||||
adjustZ ,
|
||||
withSceneDuration,
|
||||
newSprite,
|
||||
newSpriteA,
|
||||
destroySprite,
|
||||
spriteE,
|
||||
newVar,
|
||||
tweenVar,
|
||||
freezeVar,
|
||||
|
||||
-- ** Effects
|
||||
Effect,
|
||||
overBeginning,
|
||||
overEnding,
|
||||
reverseE,
|
||||
delayE,
|
||||
applyE,
|
||||
constE,
|
||||
fadeInE,
|
||||
fadeOutE,
|
||||
fadeLineInE,
|
||||
fadeLineOutE,
|
||||
drawInE,
|
||||
drawOutE,
|
||||
fillInE,
|
||||
translateE,
|
||||
aroundCenterE,
|
||||
transitions,
|
||||
|
||||
-- * SVG
|
||||
module Reanimate.Svg.Constructors,
|
||||
|
|
@ -82,11 +110,18 @@ module Reanimate
|
|||
embedDynamicImage,
|
||||
embedPng,
|
||||
raster,
|
||||
svgAsPngFile,
|
||||
vectorize,
|
||||
vectorize_,
|
||||
-- ** External SVG providers
|
||||
latex,
|
||||
latexAlign,
|
||||
xelatex,
|
||||
-- * External 3D renderers
|
||||
povray,
|
||||
povray',
|
||||
blender,
|
||||
blender',
|
||||
-- * Colormaps
|
||||
turbo,
|
||||
viridis,
|
||||
|
|
@ -112,16 +147,18 @@ module Reanimate
|
|||
) where
|
||||
|
||||
import Reanimate.Animation
|
||||
import Reanimate.Blender
|
||||
import Reanimate.ColorMap
|
||||
import Reanimate.Constants
|
||||
import Reanimate.Driver
|
||||
import Reanimate.LaTeX
|
||||
import Reanimate.Parameters
|
||||
import Reanimate.Povray
|
||||
import Reanimate.Raster
|
||||
import Reanimate.Effect
|
||||
import Reanimate.Scene
|
||||
import Reanimate.Signal
|
||||
import Reanimate.Svg
|
||||
import Reanimate.Svg.BoundingBox
|
||||
import Reanimate.Svg.Constructors
|
||||
import Reanimate.Svg.LineCommand
|
||||
import Reanimate.Scene
|
||||
import Reanimate.Parameters
|
||||
|
|
|
|||
Loading…
Reference in a new issue