CSS Animations Flashcards

1
Q

Which CSS rule specifies the animation code?

A

@keyframes

It will define the different states of the animation

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

Which property specifies the name of the @keyframes animation?

A

animation-name

To get an animation to work, you must bind the element to an animation.

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

Which property specifies a delay for the start of an animation?

A

animation-delay

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

Which property specifies whether an animation should play in reverse direction or alternate cycles?

A

animation-direction

It can be:

  • normal
  • reverse
  • alternate
  • alternate-reverse
  • initial
  • inherit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which property specifies how many seconds or milliseconds an animation takes to complete one cycle?

A

animation-duration

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

Which property specifies a style for the element when the animation is not playing (when it is finished, or when it has a delay)?

A

animation-fill-mode

animation-fill-mode: forwards; –> element will keep the end state
animation-fill-mode: backwards; –> element will go back to its initial state

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

Which property specifies the number of times an animation should be played?

A

animation-iteration-count

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

Which property specifies whether the animation is running or paused?

A

animation-play-state

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

Which property specifies the speed curve of the animation?

A

animation-timing-function

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

What is the syntax for the animation shorthand property?

A

div {
animation: value value value;
}

We just use the word animation. Values are separated with spaces.

The example below uses six of the animation properties:

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

What are the caveats when using the animation shorthand property?

A

Because when parsing, there could be confusions between time values (animation-duration and animation-delay), or between animation-name and property keywords.
So the animation-duration value must be stated before the delay value (but not necessarily immediately after).
And for the animation-name VS keyword, a good practice would be to declare the value of animation-name first (avoiding property keywords).

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

What does the animation-timing-function hold and what values can it be?

A

The animation-timing-function property specifies the speed curve of the animation.
It can have the following values:

  • ease - specifies an animation with a slow start, then fast, then end slowly (this is default)
  • linear - specifies an animation with the same speed from start to end
  • ease-in - specifies an animation with a slow start
  • ease-out - specifies an animation with a slow end
  • ease-in-out - specifies an animation with a slow start and end
  • cubic-bezier(n,n,n,n) - lets you define your own values in a cubic-bezier function
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to improve performance when using animations by letting the browser know which properties and elements are just about to be manipulated?

A

By using will-change property

[will-change] allows an author to inform the UA (User Agent) ahead of time of what kinds of changes they are likely to make to an element. This allows the UA to optimize how they handle the element ahead of time, performing potentially-expensive work preparing for an animation before the animation actually begins.

Ex:

.element { will-change: transform, opacity; }

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