Lecture

Slide Animation

Providing visual effects when transitioning between slides makes the changed slide more distinguishable.

The fade class on a div containing slides applies an animation effect that adjusts opacity when a slide transitions.

Let's first look at the CSS below.

fade Animation CSS
.fade { animation-name: fade; animation-duration: 1.5s; } @keyframes fade { from { opacity: 0.4; } to { opacity: 1; } }

The fade class includes the animation-name and animation-duration properties.

The animation-name property specifies the name of the keyframe to use for the animation, which describes each stage of the animation. In this case, we use a keyframe named fade.

The animation-duration property specifies how long it takes for the animation to complete one cycle. Here, it's set to 1.5 seconds.

The @keyframes rule is a CSS rule used to define keyframe animations. We defined a keyframe animation named fade.

The from keyword represents the starting point of the animation, while the to keyword represents the end point.


Within the animation keyframes, the opacity is controlled using the opacity property.

The CSS opacity property indicates transparency with a value range from 0 to 1, where a value closer to 0 makes the element more transparent, and a value closer to 1 makes it more opaque.

Thus, the .fade CSS class creates an animation effect where elements with this class start at an opacity of 0.4 and transition to an opacity of 1 over 1.5 seconds.

This results in a new slide appearing in a way that the opacity gradually changes, providing a smooth appearance effect.

Next, let's change the style of the carousel buttons.

Lecture

AI Tutor

Design

Upload

Notes

Favorites

Help