On Scroll Animation for Angular
npm install @wizdm/animatewmAnimate directive to the element you want to animate. The aos flag is then used to enable the "Animate On Scroll" triggering mechanism: ``html`
My animated content goes here
beat, bounce, flip, headShake, heartBeat, jello, pulse, rubberBand, shake, swing, tada, wobble.
bumpIn, bounceIn, bounceInDown, bounceInLeft, bounceInUp, bounceInRight, fadeIn, fadeInRight, fadeInLeft, fadeInUp, fadeInDown, flipInX, flipInY, jackInTheBox, landing, rollIn, zoomIn, zoomInDown, zoomInLeft, zoomInUp, zoomInRight.
bounceOut, bounceOutDown, bounceOutUp, bounceOutRight, bounceOutLeft, fadeOut, fadeOutRight, fadeOutLeft, fadeOutDown, fadeOutUp, hinge, rollOut, zoomOut, zoomOutDown, zoomOutRight, zoomOutUp, zoomOutLeft.
input. Every change in this input value will trigger the animation again provided the value can be coerced into a truthful boolean. Use the paused flag to prevevnt the animation from triggering at first in order to get the full control about when the triggering will happen. $3
Setting the aos flag enables the "Animate On Scroll" mechanism with a default threshold of 0.5, so, the animation triggers as soon as the 50% of the element area intersects the viewport area. The triggering threshold can be customized setting the aos input to a different numeric value from 0 (escluded) up to 1 (included). Setting aos=0 disables the trigger. When the element scrolls out completely, the trigger resets, so, the animation will trigger as soon as the element enters the visible portion of the viewport again. Use the
once flag to prevent the trigger to reset for the animation to run just once.Timing
By default every animation applies the optimal timing. However, timing can be overridden with the speed input. Possible values are:
* slower: running the animation with a 3s timing
* slow: running the animation with a 2s timing
* normal: running the animation with a 1s timing
* fast : running the animation with a 500ms timing
* faster: running the animation with a 300ms timing Additionally, the animation can be delayed using
delay input. The input accepts both a string describing the delay such as '1s' or '250ms' or a number that will be considered a delay expressed in ms.Viewport
When aos is enabled each animated element's area is checked against the viewport area to evaluate its visibility ratio and trigger the animation accordingly. The triggering area can optionally be adjusted, so, to shrink (or expand) the effective area by
left, top, right and bottom margins:`html
My animated content goes here
...
`By using the
wmAnimateView directive on a parent container in the example above, the effective triggering area has been reduced by a 64 pixels offset from the top of the viewport. Alternatively, by setting the
useElement flag, the container's client bounding box will be used as the triggering area instead of the viewport: `html
My animated content goes here
...
``The customizations above will affect the container's children elements only, so, different triggering areas can be used for different containers.