module Reanimate.Builtin.Slide where
import Reanimate.Constants (screenHeight, screenWidth)
import Reanimate.Effect (constE, translateE)
import Reanimate.Svg (translate)
import Reanimate.Transition (Transition, effectT)
slideLeftT :: Transition
slideLeftT :: Transition
slideLeftT = Effect -> Effect -> Transition
effectT Effect
slideLeft (Effect -> Effect -> Effect
forall t t b c a.
(t -> t -> b -> c) -> (t -> t -> a -> b) -> t -> t -> a -> c
andE Effect
slideLeft Effect
moveRight)
where
slideLeft :: Effect
slideLeft = Double -> Double -> Effect
translateE (-Double
forall a. Fractional a => a
screenWidth) Double
0
moveRight :: Effect
moveRight = (Tree -> Tree) -> Effect
constE (Effect
translate Double
forall a. Fractional a => a
screenWidth Double
0)
andE :: (t -> t -> b -> c) -> (t -> t -> a -> b) -> t -> t -> a -> c
andE t -> t -> b -> c
a t -> t -> a -> b
b t
d t
t = t -> t -> b -> c
a t
d t
t (b -> c) -> (a -> b) -> a -> c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t -> t -> a -> b
b t
d t
t
slideDownT :: Transition
slideDownT :: Transition
slideDownT = Effect -> Effect -> Transition
effectT Effect
slideDown (Effect -> Effect -> Effect
forall t t b c a.
(t -> t -> b -> c) -> (t -> t -> a -> b) -> t -> t -> a -> c
andE Effect
slideDown Effect
moveUp)
where
slideDown :: Effect
slideDown = Double -> Double -> Effect
translateE Double
0 (-Double
forall a. Fractional a => a
screenHeight)
moveUp :: Effect
moveUp = (Tree -> Tree) -> Effect
constE (Effect
translate Double
0 Double
forall a. Fractional a => a
screenHeight)
andE :: (t -> t -> b -> c) -> (t -> t -> a -> b) -> t -> t -> a -> c
andE t -> t -> b -> c
a t -> t -> a -> b
b t
d t
t = t -> t -> b -> c
a t
d t
t (b -> c) -> (a -> b) -> a -> c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t -> t -> a -> b
b t
d t
t
slideUpT :: Transition
slideUpT :: Transition
slideUpT = Effect -> Effect -> Transition
effectT Effect
slideUp (Effect -> Effect -> Effect
forall t t b c a.
(t -> t -> b -> c) -> (t -> t -> a -> b) -> t -> t -> a -> c
andE Effect
slideUp Effect
moveDown)
where
slideUp :: Effect
slideUp = Double -> Double -> Effect
translateE Double
0 Double
forall a. Fractional a => a
screenHeight
moveDown :: Effect
moveDown = (Tree -> Tree) -> Effect
constE (Effect
translate Double
0 (-Double
forall a. Fractional a => a
screenHeight))
andE :: (t -> t -> b -> c) -> (t -> t -> a -> b) -> t -> t -> a -> c
andE t -> t -> b -> c
a t -> t -> a -> b
b t
d t
t = t -> t -> b -> c
a t
d t
t (b -> c) -> (a -> b) -> a -> c
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t -> t -> a -> b
b t
d t
t