Animations
Ce contenu n’est pas encore disponible dans votre langue.
CSS animations allow you to create smooth and engaging visual effects on your website or web application without using JavaScript. Animations can be used to add visual interest to interactive elements like buttons and menus, or to create immersive effects like parallax scrolling and transitions between different sections of a page.
This page contains high motion elements as it demonstrates the framework animation props and classes
TL;DR
link TL;DROxyProps includes a set of premade animations that you can use to add visual interest to your website or web application. You can use these animations to add visual interest to interactive elements like buttons and menus, or to create immersive effects like parallax scrolling and transitions between different sections of a page.
Here is the list of available animations CSS variables and utility classes. If you want to learn more about CSS animations, and see samples of how to use them, read on.
Blink
link BlinkBase
Hover
Active
Bounce
link BounceBase
Hover
Active
Fade-in
link Fade-inBase
Hover
Active
Fade In Bloom
link Fade In BloomBase
Hover
Active
Fade Out
link Fade OutBase
Hover
Active
Fade Out Bloom
link Fade Out BloomBase
Hover
Active
Float
link FloatBase
Hover
Active
Ping
link PingBase
Hover
Active
Pulse
link PulseBase
Hover
Active
Scale Down
link Scale DownBase
Hover
Active
Scale Up
link Scale UpBase
Hover
Active
Shake X
link Shake XBase
Hover
Active
Shake Y
link Shake YBase
Hover
Active
Slide In Down
link Slide In DownBase
Hover
Active
Slide In Left
link Slide In LeftBase
Hover
Active
Slide In Right
link Slide In RightBase
Hover
Active
Slide In Up
link Slide In UpBase
Hover
Active
Slide Out Down
link Slide Out DownBase
Hover
Active
Slide Out Left
link Slide Out LeftBase
Hover
Active
Slide Out Right
link Slide Out RightBase
Hover
Active
Spin
link SpinBase
Hover
Active
Introduction to CSS Animations
link Introduction to CSS AnimationsTo create a CSS animation, we need to use the @keyframes
rule to define the animation’s keyframes (or stages) and the animation property to specify the animation’s duration, timing, and other settings.
Defining Keyframes
link Defining KeyframesThe @keyframes
rule allows you to define a series of keyframes that specify how the animation should change over time. Each keyframe represents a specific point in the animation, and can include properties that define the element’s style at that point.
Here’s an example of a @keyframes
rule that defines a simple animation that changes an element’s opacity from 0 to 1 over a duration of 2 seconds:
In this example, we’ve named the animation fade-in and defined two keyframes: 0% and 100%. The 0% keyframe sets the element’s opacity to 0 at the beginning of the animation, while the 100% keyframe sets the opacity to 1 at the end of the animation.
Applying Animations
link Applying AnimationsOnce you’ve defined your @keyframes
rule, you can apply the animation to an element using the animation property. Here’s an example of how to apply the fade-in animation we defined earlier to a <div>
element:
In this example, we’ve set the animation property to fade-in 2s
, which applies the fade-in
animation we defined earlier and specifies a duration of 2 seconds.
Animation Properties
link Animation PropertiesIn addition to the @keyframes
rule and the animation property, there are a number of other CSS properties that can be used to customize the behavior and appearance of CSS animations. Here are a few examples:
animation-delay
: specifies a delay before the animation beginsanimation-direction
: specifies whether the animation should play forwards, backwards, or alternate between forwards and backwardsanimation-timing-function
: specifies the timing function used for the animation (e.g. linear, ease-in, ease-out, ease-in-out)animation-iteration-count
: specifies the number of times the animation should repeat (e.g. infinite, 3)animation-fill-mode
: specifies what styles should be applied to the element before and after the animation plays (e.g. forwards, backwards, both)
Conclusion
link ConclusionCSS animations are a powerful tool for adding visual interest and interactivity to your website or web application. With the @keyframes
rule and the animation property, you can create smooth, engaging effects without the need for JavaScript. So why not give it a try and see what you can create!