Replace 'here' dependency with the lightweight 'neat-interpolation' (#106)

Misc improvements:
 * Add tasty-rerun
 * Extend CI coverage
This commit is contained in:
David Himmelstrup 2020-07-12 13:27:01 +08:00 committed by GitHub
commit 34aa5780ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 155 additions and 91 deletions

View file

@ -11,6 +11,10 @@ jobs:
BUILD: stack
STACK_YAML: stack.yaml
ARGS: --pedantic
stack-no-hmatrix:
BUILD: stack
STACK_YAML: stack.yaml
ARGS: --flag reanimate:disable-hmatrix --flag reanimate:-test
stack-lts-15:
BUILD: stack
STACK_YAML: stack-lts-15.yaml
@ -25,16 +29,17 @@ jobs:
STACK_YAML: stack-lts-12.yaml
stack-nightly:
BUILD: stack
ARGS: --resolver nightly
ARGS: --resolver nightly --flag reanimate:-test
maxParallel: 6
steps:
- task: Cache@2
inputs:
key: ${{ parameters.name }} | ${{ parameters.vmImage }} | $(STACK_YAML) | stack-root | $(Agent.OS)
key: ${{ parameters.name }} | ${{ parameters.vmImage }} | $(ARGS) | $(STACK_YAML) | stack-root | $(Agent.OS)
path: $(STACK_ROOT)
cacheHitVar: CACHE_RESTORED
displayName: Cache stack root
- script: |
set -o xtrace
#sudo add-apt-repository ppa:jonathonf/ffmpeg-4
sudo apt-get update
# sudo apt-get install libopenblas-dev libgfortran4
@ -48,13 +53,16 @@ jobs:
export PATH=$HOME/.local/bin:$PATH
displayName: 'Setup'
- script: |
set -o xtrace
stack --install-ghc build $ARGS --only-dependencies
stack --install-ghc build --test $ARGS --flag reanimate:test --only-dependencies
stack --install-ghc build $ARGS --test --flag reanimate:test --only-dependencies
displayName: 'Install dependencies'
- script: |
set -o xtrace
# stack ./examples/counter.hs check
stack test --flag reanimate:test --test-arguments="-j2"
stack test $ARGS --flag reanimate:test --test-arguments="-j2"
displayName: 'Build & Test'
- script: |
stack haddock --no-haddock-deps
set -o xtrace
stack haddock --no-haddock-deps $ARGS
displayName: 'Build documentation'

View file

@ -27,8 +27,8 @@ jobs:
displayName: Cache stack root
- script: |
# brew install gcc
brew install blas
brew install lapack
# brew install blas
# brew install lapack
# brew install openblas
mkdir -p ~/.local/bin
curl -skL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin;

View file

@ -7,16 +7,23 @@ jobs:
vmImage: ${{ parameters.vmImage }}
strategy:
matrix:
stack:
BUILD: stack
STACK_YAML: stack-lts-14.yaml
ARGS: --pedantic
# lts-16 and lts-15 fails due to segfaults. Think it is a GHC issue.
# stack:
# BUILD: stack
# STACK_YAML: stack.yaml
# ARGS: --pedantic
# stack-lts-15:
# BUILD: stack
# STACK_YAML: stack-lts-15.yaml
stack-lts-14:
BUILD: stack
STACK_YAML: stack-lts-14.yaml
stack-lts-13:
BUILD: stack
STACK_YAML: stack-lts-13.yaml
stack-lts-12:
BUILD: stack
STACK_YAML: stack-lts-12.yaml
maxParallel: 6
steps:
- task: Cache@2
@ -37,13 +44,13 @@ jobs:
displayName: 'Setup'
- bash: |
set -o xtrace
stack --install-ghc build $ARGS --no-keep-going --fast --only-dependencies --flag reanimate:hmatrix --flag hmatrix:openblas --extra-lib-dirs=$CONDA/Library/mingw-w64/bin
stack --install-ghc test $ARGS --no-keep-going --fast --flag reanimate:test --only-dependencies --flag reanimate:hmatrix --flag hmatrix:openblas --extra-lib-dirs=$CONDA/Library/mingw-w64/bin
stack --install-ghc build $ARGS --no-keep-going --fast --only-dependencies --flag reanimate:enable-hmatrix --flag hmatrix:openblas --extra-lib-dirs=$CONDA/Library/mingw-w64/bin
stack --install-ghc test $ARGS --no-keep-going --fast --flag reanimate:test --only-dependencies --flag reanimate:enable-hmatrix --flag hmatrix:openblas --extra-lib-dirs=$CONDA/Library/mingw-w64/bin
displayName: 'Install dependencies'
- bash: |
set -o xtrace
# stack ./examples/counter.hs check
stack test --flag reanimate:test --test-arguments="-j2" --fast --flag reanimate:hmatrix --flag hmatrix:openblas --extra-lib-dirs=$CONDA/Library/mingw-w64/bin
stack test --flag reanimate:test --test-arguments="-j2" --fast --flag reanimate:enable-hmatrix --flag hmatrix:openblas --extra-lib-dirs=$CONDA/Library/mingw-w64/bin
displayName: 'Build & Test'
- bash: |
# stack haddock --no-haddock-deps

View file

@ -1,10 +1,11 @@
#!/usr/bin/env stack
-- stack runghc --package reanimate --package here
-- stack runghc --package reanimate
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
module Main (main) where
import Data.String.Here
import qualified Data.Text as T
import NeatInterpolation
import Reanimate
main :: IO ()
@ -12,13 +13,13 @@ main = reanimate $ mkAnimation 5 $ \t ->
let s = t * pi in
mkGroup
[ mkBackground "black"
, blender (script s)
, blender (script $ T.pack $ show s)
, withFillColor "white" $
translate 0 2 $
mkText "default cube"
]
where
script s = [iTrim|
script s = [text|
import bpy
if __name__ == "__main__":

View file

@ -1,11 +1,11 @@
#!/usr/bin/env stack
-- stack runghc --package reanimate --package here
-- stack runghc --package reanimate
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
module Main (main) where
import Data.String.Here
import qualified Data.Text as T
import NeatInterpolation
import Reanimate
main :: IO ()
@ -13,18 +13,18 @@ main = reanimate $ mkAnimation 5 $ \t ->
let s = t * pi * 2 in
mkGroup
[ mkBackground "black"
, blender (script s)
, blender (script $ T.pack $ show s)
]
texture :: FilePath
texture = svgAsPngFile (mkGroup
texture :: T.Text
texture = T.pack $ svgAsPngFile (mkGroup
[ checker 10 10
, withFillColor "red" $
scale 2 $ center $
latexAlign "\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}"])
script :: Double -> T.Text
script s = [iTrim|
script :: T.Text -> T.Text
script s = [text|
import os
import bpy
@ -48,7 +48,7 @@ texture = mat.node_tree.nodes['Principled BSDF']
texture.inputs['Roughness'].default_value = 1
mat.node_tree.links.new(image_node.outputs['Color'], texture.inputs['Base Color'])
image_node.image = bpy.data.images.load('${T.pack texture}')
image_node.image = bpy.data.images.load('${texture}')
scn = bpy.context.scene
#scn.render.engine = 'CYCLES'

View file

@ -1,20 +1,21 @@
#!/usr/bin/env stack
-- stack runghc --package reanimate --package here
-- stack runghc --package reanimate
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
module Main (main) where
import qualified Data.Text as T
import NeatInterpolation
import Reanimate
import Data.String.Here
main :: IO ()
main = reanimate $ mkAnimation 5 $ \t ->
let s = fromToS 0 360 t in
mkGroup
[ mkBackground "black"
, povray [] (script s) ]
, povray [] (script $ T.pack $ show s) ]
where
script s = [iTrim|
script s = [text|
//EXAMPLE OF SPHERE
//Files with predefined colors and textures

View file

@ -1,8 +1,8 @@
#!/usr/bin/env stack
-- stack runghc --package reanimate --package here
-- stack runghc --package reanimate
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ApplicativeDo #-}
module Main (main) where
import Reanimate
@ -11,9 +11,9 @@ import Codec.Picture.Types
import Control.Lens ((^.))
import Control.Monad
import Data.Monoid
import Data.String.Here
import qualified Data.Text as T
import Graphics.SvgTree
import Graphics.SvgTree hiding (text)
import NeatInterpolation
import System.Random
import System.Random.Shuffle
@ -59,14 +59,21 @@ texture t = svgAsPngFile $ mkGroup
]
script :: FilePath -> Double -> Double -> Double -> Double -> T.Text
script img bend transZ rotX rotY = [iTrim|
script img bend transZ rotX rotY =
let img_ = T.pack img
bend_ = T.pack $ show bend
transZ_ = T.pack $ show transZ
rotX_ = T.pack $ show rotX
rotY_ = T.pack $ show rotY
yScale_ = T.pack $ show (fromToS (9/2) 4 bend)
in [text|
import os
import math
import bpy
cam = bpy.data.objects['Camera']
cam.location = (0,0,22.25 + ${transZ})
cam.location = (0,0,22.25 + ${transZ_})
cam.rotation_euler = (0, 0, 0)
bpy.ops.object.empty_add(location=(0.0, 0, 0))
focus_target = bpy.context.object
@ -75,7 +82,7 @@ cam.select_set(True)
focus_target.select_set(True)
bpy.ops.object.parent_set()
focus_target.rotation_euler = (${rotX}, 0, 0)
focus_target.rotation_euler = (${rotX_}, 0, 0)
origin = bpy.data.objects['Cube']
@ -83,10 +90,10 @@ bpy.ops.object.select_all(action='DESELECT')
origin.select_set(True)
bpy.ops.object.delete()
x = ${bend}
x = ${bend_}
bpy.ops.mesh.primitive_plane_add()
plane = bpy.context.object
plane.scale = (16/2,${fromToS (9/2) 4 bend},1)
plane.scale = (16/2,${yScale_},1)
bpy.ops.object.shade_smooth()
bpy.context.object.active_material = bpy.data.materials['Material']
@ -96,7 +103,7 @@ texture = mat.node_tree.nodes['Principled BSDF']
texture.inputs['Roughness'].default_value = 1
mat.node_tree.links.new(image_node.outputs['Color'], texture.inputs['Base Color'])
image_node.image = bpy.data.images.load('${T.pack img}')
image_node.image = bpy.data.images.load('${img_}')
modifier = plane.modifiers.new(name='Subsurf', type='SUBSURF')
@ -130,7 +137,7 @@ plane.select_set(True);
bpy.ops.object.origin_clear()
bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN')
plane.rotation_euler = (0, ${rotY}, 0)
plane.rotation_euler = (0, ${rotY_}, 0)
scn = bpy.context.scene

View file

@ -1,5 +1,5 @@
#!/usr/bin/env stack
-- stack runghc --package reanimate --package here
-- stack runghc --package reanimate
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
module Main (main) where
@ -9,8 +9,9 @@ import Reanimate.Povray (povraySlow')
import Codec.Picture
import Control.Monad
import Data.String.Here
import Data.Text (Text)
import qualified Data.Text as T
import NeatInterpolation
main :: IO ()
main = reanimate $ parA bg $ sceneAnimation $ do
@ -50,7 +51,11 @@ texture :: SVG
texture = checker 10 10
script :: FilePath -> Double -> Double -> Text
script png rotX rotY = [iTrim|
script png rotX rotY =
let png_ = T.pack png
rotX_ = T.pack $ show rotX
rotY_ = T.pack $ show rotY
in [text|
#include "colors.inc"
//Place the camera
@ -73,11 +78,11 @@ sphere {
<0,0,0>, 3
texture {
uv_mapping pigment{
image_map{ png ${png} }
image_map{ png ${png_} }
}
}
rotate <0,${rotY},0>
rotate <${rotX},0,0>
rotate <0,${rotY_},0>
rotate <${rotX_},0,0>
}
|]

View file

@ -1,5 +1,5 @@
#!/usr/bin/env stack
-- stack runghc --package reanimate --package here
-- stack runghc --package reanimate
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ApplicativeDo #-}
@ -12,10 +12,11 @@ import Codec.Picture
import Codec.Picture.Types
import Control.Lens ((^.))
import Control.Monad
import qualified Data.Text as T
import Data.Monoid
import Data.String.Here
import NeatInterpolation
import Data.Text (Text)
import Graphics.SvgTree hiding (Text)
import Graphics.SvgTree hiding (Text,text)
import System.Random
import System.Random.Shuffle
@ -46,7 +47,12 @@ texture :: Double -> SVG
texture t = frameAt (t*duration latexExample) latexExample
script :: FilePath -> Double -> Double -> Double -> Text
script png transZ rotX rotZ = [iTrim|
script png transZ rotX rotZ =
let png_ = T.pack png
rotX_ = T.pack $ show rotX
transZ_ = T.pack $ show transZ
rotZ_ = T.pack $ show rotZ
in [text|
#include "colors.inc"
//Place the camera
@ -69,13 +75,13 @@ polygon {
<0, 0>, <0, 1>, <1, 1>, <1, 0>
texture {
pigment{
image_map{ png ${png} }
image_map{ png ${png_} }
}
}
translate <-1/2,-1/2>
scale <16,9>
rotate <0,${rotX},${rotZ}>
translate <0,0,${transZ}>
rotate <0,${rotX_},${rotZ_}>
translate <0,0,${transZ_}>
}
|]

View file

@ -1,8 +1,8 @@
#!/usr/bin/env stack
-- stack runghc --package reanimate --package here
-- stack runghc --package reanimate
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ApplicativeDo #-}
module Main (main) where
import Reanimate
@ -13,9 +13,10 @@ import Codec.Picture.Types
import Control.Lens ((^.))
import Control.Monad
import Data.Monoid
import Data.String.Here
import Data.Text (Text)
import Graphics.SvgTree hiding (Text)
import qualified Data.Text as T
import Graphics.SvgTree hiding (Text,text)
import NeatInterpolation
import System.Random
import System.Random.Shuffle
@ -53,7 +54,12 @@ texture t = mkGroup
]
script :: FilePath -> Double -> Double -> Double -> Text
script png rotX rotY rotZ = [iTrim|
script png rotX rotY rotZ =
let png_ = T.pack png
rotX_ = T.pack $ show rotX
rotY_ = T.pack $ show rotY
rotZ_ = T.pack $ show rotZ
in [text|
//Files with predefined colors and textures
#include "colors.inc"
@ -82,11 +88,11 @@ sphere {
<0,0,0>, 4
texture {
uv_mapping pigment{
image_map{ png ${png} }
image_map{ png ${png_} }
}
}
rotate <0,${rotY},${rotZ}>
rotate <${rotX},0,0>
rotate <0,${rotY_},${rotZ_}>
rotate <${rotX_},0,0>
}
|]

View file

@ -36,11 +36,18 @@ Source-Repository head
Type: git
Location: git://github.com/lemmih/reanimate.git
Flag hmatrix
-- If both 'enable-hmatrix' and 'disable-hmatrix' are false, then use
-- hmatrix on Macos and Linux but not Windows.
Flag enable-hmatrix
Description: Enable hmatrix dependency on Windows (requires openblas)
Default: False
Manual: True
Flag disable-hmatrix
Description: Force disable hmatrix dependency
Default: False
Manual: True
Flag test
Description: Enable testing (requires stack)
Default: False
@ -115,11 +122,12 @@ library
JuicyPixels >= 3.3.3, attoparsec, parallel,
cubicbezier, websockets >= 0.12.7.0,
hashable, fsnotify, open-browser, random, random-shuffle, base64-bytestring,
vector >= 0.12.0.0, colour, cassava, ansi-terminal, th-printf >= 0.6, temporary,
vector >= 0.12.0.0, colour, cassava, ansi-terminal, temporary,
optparse-applicative, chiphunk >= 0.1.2.1,
geojson, aeson >= 1.3.0.0, earcut >= 0.1.0.4,
split, fingertree, array, cereal, vector-space
if flag(hmatrix) || !os(windows) {
split, array, cereal, vector-space,
neat-interpolation >= 0.3
if (flag(enable-hmatrix) || !os(windows)) && !flag(disable-hmatrix) {
build-depends: hmatrix >= 0.20.0.0
exposed-modules: Reanimate.Morph.Rigid
Reanimate.Math.Smooth
@ -148,6 +156,4 @@ test-suite spec
reanimate, vector, linear,
QuickCheck >= 2.1.0, text,
tasty, tasty-golden, tasty-hunit,
tasty-quickcheck,
ansi-wl-pprint,
here
tasty-quickcheck, tasty-rerun >= 1.1.17

View file

@ -18,7 +18,7 @@ import Reanimate.Ease
import Reanimate.Transition
import Reanimate.Svg.Constructors
import Language.Haskell.Printf (s)
import NeatInterpolation (text)
import qualified Data.Text as T
data FlipSprite s = FlipSprite
@ -69,7 +69,15 @@ flipTransition = flipTransitionOpts bend zoom wobble
wobble = -pi*0.10
script :: FilePath -> FilePath -> Double -> Double -> Double -> Double -> T.Text
script frontImage backImage bend transZ rotX rotY = T.pack $ [s|
script frontImage backImage bend transZ rotX rotY =
let transZ_ = T.pack (show transZ)
rotX_ = T.pack (show rotX)
bend_ = T.pack (show bend)
yScale_ = T.pack (show $ fromToS (9/2) 4 bend)
frontImage_ = T.pack frontImage
backImage_ = T.pack backImage
rotY_ = T.pack (show rotY)
in [text|
import os
import math
@ -82,7 +90,7 @@ bpy.ops.object.delete()
cam = bpy.data.objects['Camera']
cam.location = (0,0,22.22 + %f)
cam.location = (0,0,22.22 + $transZ_)
cam.rotation_euler = (0, 0, 0)
bpy.ops.object.empty_add(location=(0.0, 0, 0))
focus_target = bpy.context.object
@ -91,7 +99,7 @@ cam.select_set(True)
focus_target.select_set(True)
bpy.ops.object.parent_set()
focus_target.rotation_euler = (%f, 0, 0)
focus_target.rotation_euler = ($rotX_, 0, 0)
origin = bpy.data.objects['Cube']
@ -99,10 +107,10 @@ bpy.ops.object.select_all(action='DESELECT')
origin.select_set(True)
bpy.ops.object.delete()
x = %f
x = $bend_
bpy.ops.mesh.primitive_plane_add()
plane = bpy.context.object
plane.scale = (16/2,%f,1)
plane.scale = (16/2,$yScale_,1)
bpy.ops.object.shade_smooth()
bpy.context.object.active_material = bpy.data.materials['Material']
@ -129,10 +137,10 @@ mat.node_tree.links.new(gh_node.outputs['Alpha'], gh_mix.inputs['Fac'])
mat.node_tree.links.new(transparent.outputs['BSDF'], gh_mix.inputs[1])
mat.node_tree.links.new(gh_mix.outputs['Shader'], mix.inputs[2])
image_node.image = bpy.data.images.load('%s')
image_node.image = bpy.data.images.load('${frontImage_}')
image_node.interpolation = 'Closest'
gh_node.image = bpy.data.images.load('%s')
gh_node.image = bpy.data.images.load('${backImage_}')
gh_node.interpolation = 'Closest'
@ -166,7 +174,7 @@ plane.select_set(True);
bpy.ops.object.origin_clear()
bpy.ops.object.origin_set(type='GEOMETRY_ORIGIN')
plane.rotation_euler = (0, %f, 0)
plane.rotation_euler = (0, $rotY_, 0)
scn = bpy.context.scene
@ -182,4 +190,4 @@ scn.render.resolution_y = 1440
scn.render.film_transparent = True
bpy.ops.render.render( write_still=True )
|] transZ rotX bend (fromToS (9/2) 4 bend) frontImage backImage rotY
|]

View file

@ -1,6 +1,6 @@
resolver: lts-12.26
allow-newer: false
allow-newer: true
packages:
- .
@ -18,3 +18,7 @@ extra-deps:
- JuicyPixels-3.3.5@sha256:5c67dc066d67f5045221a8202f701f4c77eab8220f44414c00fadcdc3e4f872b,3911
- th-printf-0.7@sha256:c6b2c08e62a32a327b29b1a3739939f0c85b4079ff2ae6d79fac639f25ee48b1,2297
- earcut-0.1.0.4@sha256:d5118b3eecf24d130263d81fb30f1ff56b1db43036582bfd1d8cc9ba3adae8be,1010
- tasty-rerun-1.1.17@sha256:d4a3ccb0f63f499f36edc71b33c0f91c850eddb22dd92b928aa33b8459f3734a,1373
- tasty-1.3.1@sha256:01e35c97f7ee5ccbc28f21debea02a38cd010d53b4c3087f5677c5d06617a507,2520
- optparse-applicative-0.15.1.0@sha256:29ff6146aabf54d46c4c8788e8d1eadaea27c94f6d360c690c5f6c93dac4b07e,4810
- ansi-terminal-0.10.3@sha256:e2fbcef5f980dc234c7ad8e2fa433b0e8109132c9e643bc40ea5608cd5697797,3226

View file

@ -15,3 +15,4 @@ extra-deps:
- websockets-0.12.7.0@sha256:fc96169cc8268d3efb93bdc1e0b060dd88ce932237b837904118777a90d6db80,7863
- clock-0.8@sha256:b4ae207e2d3761450060a0d0feb873269233898039c76fceef9cc1a544067767,4113
- earcut-0.1.0.4@sha256:d5118b3eecf24d130263d81fb30f1ff56b1db43036582bfd1d8cc9ba3adae8be,1010
- tasty-rerun-1.1.17@sha256:d4a3ccb0f63f499f36edc71b33c0f91c850eddb22dd92b928aa33b8459f3734a,1373

View file

@ -13,3 +13,4 @@ extra-deps:
- matrices-0.5.0@sha256:b2761813f6a61c84224559619cc60a16a858ac671c8436bbac8ec89e85473058
- hmatrix-0.20.0.0@sha256:d79a9218e314f1a2344457c3851bd1d2536518ecb5f1a2fcd81daa45e46cd025,4870
- earcut-0.1.0.4@sha256:d5118b3eecf24d130263d81fb30f1ff56b1db43036582bfd1d8cc9ba3adae8be,1010
- tasty-rerun-1.1.17@sha256:d4a3ccb0f63f499f36edc71b33c0f91c850eddb22dd92b928aa33b8459f3734a,1373

View file

@ -1,13 +1,14 @@
module Main (main) where
import Test.Tasty
import Test.Tasty.Ingredients.Rerun (defaultMainWithRerun)
import UnitTests
import Properties
import UnitTests
main :: IO ()
main = do
tests1 <- unitTestFolder "examples/"
tests2 <- compileTestFolder "examples/"
tests3 <- compileVideoFolder "videos/"
defaultMain $ testGroup "tests" [tests1, tests2, tests3, all_props]
defaultMainWithRerun $ testGroup "tests" [tests1, tests2, tests3, all_props]

View file

@ -1,8 +1,8 @@
#!/usr/bin/env stack
-- stack runghc --package reanimate
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ApplicativeDo #-}
module Main (main) where
import Codec.Picture
@ -11,17 +11,18 @@ import Control.Monad
import Data.Fixed
import Data.Maybe
import Data.Monoid
import Data.String.Here
import Data.Text (Text)
import qualified Data.Text as T
import Graphics.SvgTree (Number (..), strokeWidth, toUserUnit)
import NeatInterpolation
import Reanimate
import Reanimate.Animation
import Reanimate.Builtin.Images
import Reanimate.Ease
import Reanimate.Effect
import Reanimate.Povray
import Reanimate.Raster
import Reanimate.Scene
import Reanimate.Ease
import Reanimate.Svg
{- SCRIPT
@ -347,7 +348,7 @@ texture :: SVG
texture = checker 10 10
script :: FilePath -> Double -> Text
script png s = [iTrim|
script png s = [text|
//EXAMPLE OF SPHERE
//Files with predefined colors and textures
@ -387,7 +388,7 @@ sphere {
texture {
//pigment{ color rgbt <0,0,1,0.1> }
uv_mapping pigment{
image_map{ png ${png} }
image_map{ png ${png_} }
//color rgbt <0,0,1,0.1>
}
}
@ -396,8 +397,9 @@ sphere {
}
|]
where
png_ = T.pack png
precision = 0.1
s' = fromIntegral (round (s / precision)) * precision
s' = T.pack $ show $ fromIntegral (round (s / precision)) * precision
checker :: Int -> Int -> SVG
checker w h =