Copyright | (c) 2023 Ruslan Gadeev Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Transform animation widget. Wraps a child widget whose content will be animated. Acts as a base for most animation widgets.
Messages:
- Accepts an
AnimationMsg
, used to control the state of the animation.
transform t (Rect x y w h) = [ animTranslation $ Point tx ty , animScale $ Point sx sy ] animTransform transform managed
With configuration options:
transform t (Rect x y w h) = [ animTranslation $ Point tx ty , animScale $ Point sx sy ] animTransform_ [duration 2000, autoStart] transform managed
For usage examples, see:
Synopsis
- data TransformCfg s e = TransformCfg {
- _tfcAutoStart :: Maybe Bool
- _tfcDuration :: Maybe Millisecond
- _tfcOnFinishedReq :: [WidgetRequest s e]
- data RenderTransform
- animTranslation :: Point -> RenderTransform
- animScale :: Point -> RenderTransform
- animRotation :: Double -> RenderTransform
- animGlobalAlpha :: Double -> RenderTransform
- animScissor :: Rect -> RenderTransform
- animTransform :: WidgetEvent e => Transformer -> WidgetNode s e -> WidgetNode s e
- animTransform_ :: WidgetEvent e => [TransformCfg s e] -> Transformer -> WidgetNode s e -> WidgetNode s e
Configuration
data TransformCfg s e Source #
Configuration options for transform:
autoStart
: whether the first time the widget is added, animation should run.duration
: how long the animation lasts in ms.onFinished
: event to raise when animation is complete.onFinishedReq
:WidgetRequest
to generate when animation is complete.
TransformCfg | |
|
Instances
Render transformations
data RenderTransform Source #
Possible render transformations:
animTranslation
: translates by the given offset.animScale
: scales by the given size.animRotation
: rotates by the given angle.animGlobalAlpha
: applies the given alpha.animScissor
: scissors to the given viewport.
Instances
Monoid RenderTransform Source # | |
Defined in Monomer.Widgets.Animation.Transform mappend :: RenderTransform -> RenderTransform -> RenderTransform # mconcat :: [RenderTransform] -> RenderTransform # | |
Semigroup RenderTransform Source # | |
Defined in Monomer.Widgets.Animation.Transform (<>) :: RenderTransform -> RenderTransform -> RenderTransform # sconcat :: NonEmpty RenderTransform -> RenderTransform # stimes :: Integral b => b -> RenderTransform -> RenderTransform # | |
Default RenderTransform Source # | |
Defined in Monomer.Widgets.Animation.Transform def :: RenderTransform # |
animTranslation :: Point -> RenderTransform Source #
Translate by the given offset.
animScale :: Point -> RenderTransform Source #
Scale by the given size.
animRotation :: Double -> RenderTransform Source #
Rotate by the given angle.
animGlobalAlpha :: Double -> RenderTransform Source #
Apply the given alpha.
animScissor :: Rect -> RenderTransform Source #
Scissor to the given viewport.
Constructors
:: WidgetEvent e | |
=> Transformer | Transformations from time (in ms) and viewport. |
-> WidgetNode s e | The child node. |
-> WidgetNode s e | The created animation container. |
Animates a widget through translation, scaling, rotation, transparency and scissor.
:: WidgetEvent e | |
=> [TransformCfg s e] | The config options. |
-> Transformer | Transformations from time (in ms) and viewport. |
-> WidgetNode s e | The child node. |
-> WidgetNode s e | The created animation container. |
Animates a widget through translation, scaling, rotation, transparency and scissor. Accepts config.