mirror of
https://github.com/reanimate/reanimate.git
synced 2026-09-14 09:32:22 +00:00
Clean up clip_rect example.
This commit is contained in:
parent
7afab76cff
commit
2ccfea2a4f
2 changed files with 18 additions and 22 deletions
20
README.md
20
README.md
|
|
@ -194,25 +194,23 @@ progressMeters = proc () -> do
|
||||||
clip_rect :: Ani ()
|
clip_rect :: Ani ()
|
||||||
clip_rect = proc () -> do
|
clip_rect = proc () -> do
|
||||||
emit -< toHtml $ mkBackground "black"
|
emit -< toHtml $ mkBackground "black"
|
||||||
follow
|
annotate' $ follow
|
||||||
[ sim
|
[ sim
|
||||||
[ sim [ paintStatic prev | prev <- [max 0 (n-4) .. n-1] ]
|
[ sim [ paintStatic prev | prev <- [max 0 (n-4) .. n-1] ]
|
||||||
, sim [ runAni "black" i | i <- [n-4], i>=0 ]
|
, sim [ runAni "black" i | i <- [n-4], i>=0 ]
|
||||||
, runAni "white" n ]
|
, runAni "white" n ]
|
||||||
| n <- [0..15]
|
| n <- [0..15]
|
||||||
] -< ()
|
] -< g_ [transform_ $ Lucid.translate (320/2) (180/2)]
|
||||||
where
|
where
|
||||||
paintStatic nth = proc () ->
|
paintStatic nth = proc () ->
|
||||||
annotate' (obj "white" (20+nth*10) (20+nth*10))
|
emit -< toHtml $ withStrokeColor "white" $
|
||||||
-< g_ [transform_ $ Lucid.translate 160 90]
|
square (20+nth*10)
|
||||||
runAni color nth = proc () ->
|
runAni color nth = circle_clip $ proc () -> do
|
||||||
annotate' (circle_clip (obj color (20+nth*10) (20+nth*10)))
|
|
||||||
-< g_ [transform_ $ Lucid.translate 160 90]
|
|
||||||
obj c width height = proc () -> do
|
|
||||||
duration 1 -< ()
|
duration 1 -< ()
|
||||||
emit -< rect_ [ num_ width_ width, num_ height_ height
|
emit -< toHtml $ withStrokeColor color $
|
||||||
, num_ x_ (-width/2), num_ y_ (-height/2)
|
square (20+nth*10)
|
||||||
, stroke_ c, fill_opacity_ "0", stroke_width_ "2" ]
|
square side = center $ withFillOpacity 0 $ withStrokeWidth (Num 2) $
|
||||||
|
mkRect (Num 0, Num 0) (Num side) (Num side)
|
||||||
```
|
```
|
||||||

|

|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,25 +159,23 @@ highlight = proc () -> do
|
||||||
clip_rect :: Ani ()
|
clip_rect :: Ani ()
|
||||||
clip_rect = proc () -> do
|
clip_rect = proc () -> do
|
||||||
emit -< toHtml $ mkBackground "black"
|
emit -< toHtml $ mkBackground "black"
|
||||||
follow
|
annotate' $ follow
|
||||||
[ sim
|
[ sim
|
||||||
[ sim [ paintStatic prev | prev <- [max 0 (n-4) .. n-1] ]
|
[ sim [ paintStatic prev | prev <- [max 0 (n-4) .. n-1] ]
|
||||||
, sim [ runAni "black" i | i <- [n-4], i>=0 ]
|
, sim [ runAni "black" i | i <- [n-4], i>=0 ]
|
||||||
, runAni "white" n ]
|
, runAni "white" n ]
|
||||||
| n <- [0..15]
|
| n <- [0..15]
|
||||||
] -< ()
|
] -< g_ [transform_ $ Lucid.translate (320/2) (180/2)]
|
||||||
where
|
where
|
||||||
paintStatic nth = proc () ->
|
paintStatic nth = proc () ->
|
||||||
annotate' (obj "white" (20+nth*10) (20+nth*10))
|
emit -< toHtml $ withStrokeColor "white" $
|
||||||
-< g_ [transform_ $ Lucid.translate 160 90]
|
square (20+nth*10)
|
||||||
runAni color nth = proc () ->
|
runAni color nth = circle_clip $ proc () -> do
|
||||||
annotate' (circle_clip (obj color (20+nth*10) (20+nth*10)))
|
|
||||||
-< g_ [transform_ $ Lucid.translate 160 90]
|
|
||||||
obj c width height = proc () -> do
|
|
||||||
duration 1 -< ()
|
duration 1 -< ()
|
||||||
emit -< rect_ [ num_ width_ width, num_ height_ height
|
emit -< toHtml $ withStrokeColor color $
|
||||||
, num_ x_ (-width/2), num_ y_ (-height/2)
|
square (20+nth*10)
|
||||||
, stroke_ c, fill_opacity_ "0", stroke_width_ "2" ]
|
square side = center $ withFillOpacity 0 $ withStrokeWidth (Num 2) $
|
||||||
|
mkRect (Num 0, Num 0) (Num side) (Num side)
|
||||||
|
|
||||||
circle_clip :: Ani () -> Ani ()
|
circle_clip :: Ani () -> Ani ()
|
||||||
circle_clip sub = proc () -> do
|
circle_clip sub = proc () -> do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue