mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-09 15:12:21 +00:00
Add documentation for 'withViewBox'.
Former-commit-id: 2797121d09679950ac35b1bd08e9c6bfbedc5267
This commit is contained in:
parent
6e53e55de4
commit
84ba78c890
3 changed files with 21 additions and 0 deletions
|
|
@ -5,6 +5,8 @@ TINY='^(doc_turbo|doc_viridis|doc_magma|doc_inferno|doc_plasma|doc_sinebow|doc_c
|
|||
newline|doc_hsvMatlab|doc_greyscale|doc_parula|doc_rgbComponents|doc_hsvComponents|
|
||||
newline|doc_hsv|doc_lchComponents|doc_xyzComponents|doc_labComponents)$'
|
||||
|
||||
SQUARE='^(doc_withViewBox)$'
|
||||
|
||||
cd $ROOT/examples/
|
||||
for src in $ROOT/examples/doc_*.hs; do
|
||||
BASE=`basename $src .hs`
|
||||
|
|
@ -13,6 +15,9 @@ for src in $ROOT/examples/doc_*.hs; do
|
|||
if [[ "$BASE" =~ $TINY ]]; then
|
||||
echo "stack $src render -o $DST --width=320 --height=50"
|
||||
stack $src render -o $DST --width=320 --height=50
|
||||
elif [[ "$BASE" =~ $SQUARE ]]; then
|
||||
echo "stack $src render -o $DST --width=180 --height=180"
|
||||
stack $src render -o $DST --width=180 --height=180
|
||||
else
|
||||
echo "stack $src render -o $DST"
|
||||
stack $src render -o $DST
|
||||
|
|
|
|||
10
examples/doc_withViewBox.hs
Executable file
10
examples/doc_withViewBox.hs
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env stack
|
||||
-- stack runghc --package reanimate
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Main (main) where
|
||||
|
||||
import Reanimate
|
||||
|
||||
main :: IO ()
|
||||
main = reanimate $ animate $ const $
|
||||
withViewBox (0,0,1,1) $ mkBackground "yellow"
|
||||
|
|
@ -375,6 +375,12 @@ mkText str =
|
|||
-- to configure them by hand.
|
||||
--
|
||||
-- The viewbox argument is (min-x, min-y, width, height).
|
||||
--
|
||||
-- Example:
|
||||
--
|
||||
-- > withViewBox (-4,-4,8,8) $ mkBackground "yellow"
|
||||
--
|
||||
-- <<docs/gifs/doc_withViewBox.gif>>
|
||||
withViewBox :: (Double, Double, Double, Double) -> Tree -> Tree
|
||||
withViewBox vbox child = translate (-screenWidth/2) (-screenHeight/2) $
|
||||
SvgTree $ Document
|
||||
|
|
|
|||
Loading…
Reference in a new issue