mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-10 23:52:22 +00:00
Improve povray examples.
Former-commit-id: c7d6f6ced12cc3ee017d57bfc59fb0d54a1f5093
This commit is contained in:
parent
8333d3d4f1
commit
1f5ed42288
3 changed files with 22 additions and 37 deletions
|
|
@ -256,3 +256,18 @@ This file is auto-generated by docs/render_all.sh. DO NOT EDIT.
|
||||||
|
|
||||||
<br/><hr><br/>
|
<br/><hr><br/>
|
||||||
|
|
||||||
|
## tut_glue_povray_ortho
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>View tut_glue_povray_ortho.hs</summary>
|
||||||
|
<pre><code class="haskell">
|
||||||
|
{!examples/tut_glue_povray_ortho.hs!}
|
||||||
|
</code></pre>
|
||||||
|
</details>
|
||||||
|
<br/>
|
||||||
|
<video width="640" height="360" autoplay loop>
|
||||||
|
<source src="https://github.com/Lemmih/reanimate/raw/master/docs/rendered/tut_glue_povray_ortho.mp4">
|
||||||
|
</video>
|
||||||
|
|
||||||
|
<br/><hr><br/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ main = reanimate $ parA bg $ sceneAnimation $ do
|
||||||
getZ <- freezeVar zRot
|
getZ <- freezeVar zRot
|
||||||
return $ \real_t dur t ->
|
return $ \real_t dur t ->
|
||||||
povraySlow [] $
|
povraySlow [] $
|
||||||
script (svgAsPngFile (texture (t/dur))) (transZ real_t) (getX real_t) (getZ real_t)
|
script (svgAsPngFile (texture (t/dur))) (transZ real_t) (getX real_t) (getZ real_t)
|
||||||
wait 2
|
wait 2
|
||||||
tweenVar zPos 9 (\t v -> fromToS v 8 (t/9))
|
tweenVar zPos 9 (\t v -> fromToS v 8 (t/9))
|
||||||
tweenVar xRot 9 (\t v -> fromToS v 360 $ curveS 2 (t/9))
|
tweenVar xRot 9 (\t v -> fromToS v 360 $ curveS 2 (t/9))
|
||||||
|
|
@ -45,9 +45,7 @@ main = reanimate $ parA bg $ sceneAnimation $ do
|
||||||
bg = animate $ const $ mkBackgroundPixel $ PixelRGBA8 252 252 252 0xFF
|
bg = animate $ const $ mkBackgroundPixel $ PixelRGBA8 252 252 252 0xFF
|
||||||
|
|
||||||
texture :: Double -> SVG
|
texture :: Double -> SVG
|
||||||
texture t = mkGroup
|
texture t = frameAt (t*duration latexExample) latexExample
|
||||||
[ checker 10 10
|
|
||||||
, frameAt (t*duration latexExample) latexExample ]
|
|
||||||
|
|
||||||
script :: FilePath -> Double -> Double -> Double -> Text
|
script :: FilePath -> Double -> Double -> Double -> Text
|
||||||
script png transZ rotX rotZ = [iTrim|
|
script png transZ rotX rotZ = [iTrim|
|
||||||
|
|
@ -83,32 +81,6 @@ polygon {
|
||||||
}
|
}
|
||||||
|]
|
|]
|
||||||
|
|
||||||
checker :: Int -> Int -> SVG
|
|
||||||
checker w h =
|
|
||||||
withFillColor "white" $
|
|
||||||
withStrokeColor "white" $
|
|
||||||
withStrokeWidth 0.1 $
|
|
||||||
mkGroup
|
|
||||||
[ withStrokeWidth 0 $
|
|
||||||
withFillOpacity 1 $ mkBackground "blue"
|
|
||||||
, mkGroup
|
|
||||||
[ translate (stepX*x-offsetX + stepX/2) 0 $
|
|
||||||
mkLine (0, -screenHeight/2*0.9) (0, screenHeight/2*0.9)
|
|
||||||
| x <- map fromIntegral [0..w-1]
|
|
||||||
]
|
|
||||||
,
|
|
||||||
mkGroup
|
|
||||||
[ translate 0 (stepY*y-offsetY) $
|
|
||||||
mkLine (-screenWidth/2, 0) (screenWidth/2, 0)
|
|
||||||
| y <- map fromIntegral [0..h]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
where
|
|
||||||
stepX = screenWidth/fromIntegral w
|
|
||||||
stepY = screenHeight/fromIntegral h
|
|
||||||
offsetX = screenWidth/2
|
|
||||||
offsetY = screenHeight/2
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
-- COPIED FROM tut_glue_latex.hs --
|
-- COPIED FROM tut_glue_latex.hs --
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ main = reanimate $ parA bg $ sceneAnimation $ do
|
||||||
getZ <- freezeVar zRot
|
getZ <- freezeVar zRot
|
||||||
return $ \real_t dur t ->
|
return $ \real_t dur t ->
|
||||||
povraySlow [] $
|
povraySlow [] $
|
||||||
script (svgAsPngFile (texture (t/dur))) (getX real_t) (getY real_t) (getZ real_t)
|
script (svgAsPngFile (texture (t/dur))) (getX real_t) (getY real_t) (getZ real_t)
|
||||||
wait 2
|
wait 2
|
||||||
let tDuration = 20
|
let tDuration = 20
|
||||||
tweenVar yRot tDuration (\t v -> fromToS v (v+180) $ curveS 2 (t/tDuration))
|
tweenVar yRot tDuration (\t v -> fromToS v (v+180) $ curveS 2 (t/tDuration))
|
||||||
|
|
@ -52,7 +52,7 @@ main = reanimate $ parA bg $ sceneAnimation $ do
|
||||||
|
|
||||||
texture :: Double -> SVG
|
texture :: Double -> SVG
|
||||||
texture t = mkGroup
|
texture t = mkGroup
|
||||||
[ checker 10 10
|
[ checker 20 20
|
||||||
, frameAt (t*duration latexExample) latexExample
|
, frameAt (t*duration latexExample) latexExample
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -97,12 +97,11 @@ sphere {
|
||||||
|
|
||||||
checker :: Int -> Int -> SVG
|
checker :: Int -> Int -> SVG
|
||||||
checker w h =
|
checker w h =
|
||||||
withFillColor "white" $
|
withStrokeColor "lightblue" $
|
||||||
withStrokeColor "white" $
|
withStrokeWidth (defaultStrokeWidth/2) $
|
||||||
withStrokeWidth 0.1 $
|
|
||||||
mkGroup
|
mkGroup
|
||||||
[ withStrokeWidth 0 $
|
[ withStrokeWidth 0 $
|
||||||
withFillOpacity 0.7 $ mkBackground "blue"
|
withFillOpacity 0.8 $ mkBackground "white"
|
||||||
, mkGroup
|
, mkGroup
|
||||||
[ translate (stepX*x-offsetX + stepX/2) 0 $
|
[ translate (stepX*x-offsetX + stepX/2) 0 $
|
||||||
mkLine (0, -screenHeight/2*0.9) (0, screenHeight/2*0.9)
|
mkLine (0, -screenHeight/2*0.9) (0, screenHeight/2*0.9)
|
||||||
|
|
@ -200,4 +199,3 @@ drawAnimation' mbSeed fillDur step svg = sceneAnimation $ do
|
||||||
case mbSeed of
|
case mbSeed of
|
||||||
Nothing -> lst
|
Nothing -> lst
|
||||||
Just seed -> shuffle' lst (length lst) (mkStdGen seed)
|
Just seed -> shuffle' lst (length lst) (mkStdGen seed)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue