CSS Animation Flashcards

1
Q

What’s the difference between animation properties and @keyframes?

A

animation properties control how the animation should behave and the @keyframes rule controls what happens during that animation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

animation-name

A

animation property that sets the name of the animation, which is later used by @keyframes to tell CSS which rules go with which animations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

animation-duration

A

animation property that sets the length of time for the animation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

how many animation properties?

A

eight
animation-name
animation-duration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

animation-fill-mode: forwards;

A

The animation-fill-mode specifies the style applied to an element when the animation has finished.

So if you have a button that changes background-color on hover, setting the animation-fil-mode: forwards; will have the button retain the background color it changed to once the animation is complete.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Animating elements with a specified position, like fixed or relative,

A

When elements have a specified position, fixed/relative, the CSS offset properties right, left, top, and bottom can be used in animation rules to create movement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

@keyframes

animation-iteration-count

A

allows you to control how many times you would like to loop through the animation. =)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
@keyframes twinkle-1 {
    50% {
      transform: scale(0.5);
      opacity: 0.5;
    }
  }
  @keyframes twinkle-2 {
    20% {
      transform: scale(0.5);
      opacity: 0.5;
    }
  }
A

Notice that how if you set the rate different between two similar animations you can get a twinkling effect.

https://www.freecodecamp.org/learn/responsive-web-design/applied-visual-design/animate-elements-at-variable-rates

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Another cool way to vary animations, in addition to manipulating the percentages in the @keyframes settings, is to set different lengths of time for animation-duration properties.

A
.star-1 {
    margin-top: 15%;
    margin-left: 60%;
    animation-duration: 1s;
    animation-name: twinkle;
  }
  .star-2 {
    margin-top: 25%;
    margin-left: 25%;
    animation-duration: .9s;
    animation-name: twinkle;
  }
  .star-3 {
    margin-top: 10%;
    margin-left: 50%;
    animation-duration: 1.1s;
    animation-name: twinkle;
  }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The animation-timing-function property controls how quickly an animated element changes over the duration of the animation.

A

If the animation is a car moving from point A to point B in a given time (your animation-duration), the animation-timing-function says how the car accelerates and decelerates over the course of the drive.

The rate at which the animation changes over the duration of the entire animation. Balls dropping example if you remember.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

animation-timing-function s

A

ease
ease-out
ease-in
linear

How well did you know this?
1
Not at all
2
3
4
5
Perfectly