Chapter 7 : CSS Animations Flashcards

1
Q

What do we need to specify to use CSS3 animation?

A
  1. Specify some keyframes for the animation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What will happen when we specify CSS styles inside the @keyframes rule?

A
  1. The animation will gradually change from the current style to the new style at certain times
  • To get an animation to work, we must bind the animation to an element
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Create a changeColor keyframes and assign it to a <div> element

A

div
{
width: 500px;
height: 500px;
border-radius: 50%;
background-color: red;
animation-name: changeColor;
animation-duration: 4s;
}

@keyframes changeColor
{
from {background-color: red;}
to {background-color: purple; }
}

  • CSS will automatically assign color when background color is changed ( Red -> Purple -> Blue )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Create a changeColor keyframes and assign it to a <div> element, but it requires
1. Red , then
2. Yellow, then
3. Blue, then
4. Green

A

div
{
width: 500px;
height: 500px;
border-radius: 50%;
background-color: red;
animation-name: changeColor;
animation-duration: 4s infinite;
}

@keyframes changeColor
{
0% {background-color: red;}
25% {background-color: yellow;}
50% {background-color: blue;}
100% {background-color: green;}
}

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

Create a changeColor keyframes and assign it to a <div> element, but it requires
1. Red , then
2. Yellow, then
3. Blue, then
4. Green

Also change the div element position

A

div {
width: 100px;
height: 100px;
border-radius: 50%;
background-color: red;
position: relative;
animation-name: changeColor;
animation-duration: 4s;
}

@keyframes changeColor {
0% {background-color:red; left:0px; top:0px;}
25% {background-color:yellow; left:200px; top:0px;}
50% {background-color:blue; left:200px; top:200px;}
75% {background-color:green; left:0px; top:200px;}
100% {background-color:red; left:0px; top:0px;}
}

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

What does animation-dealy does?

A
  1. Specifies a dealy for the start of an animation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Create a div element to specify delay for 2 seonds before animation starts playing

A

div
{
width: 100px;
height: 100px;
position: relative;
background-color:red;
animation-name: changeColor;
animation-duration: 4s;
animation-delay: 2s;
}

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

What property should we use to specify the number of times an animation should run?

A
  1. animation-iteration-count
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the 2 values for animation-iteration-count property?

A
  1. Number ( 1, 2 )
    • Loops though the numbers define
  2. infinite
  • animation-iteration-count: 3 ; / animation-iteration-count: infinite ;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the usage of animation-direction property?

A
  1. Used to let an animation run in reverse direction or alternat cycles
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the 2 values for animation-direction property?

A
  1. reverse
  2. alternate
  • animation-direction: reverse
    animation-direction: alternate
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does the animation-timing-function property specifies?

A
  1. The speed curve of the animation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

List out all the 6 values for animation-timing-function property

A
  1. ease
  2. linear
  3. ease-in
  4. ease-out
  5. ease-in-out
  6. cubic-bezier(n,n,n,n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the shorthand property for
div {
animation-name: changeColor;
animation-duration: 5s;
animation-timing-function: linear;
animation-delay: 2s;
animation-iteration-count: infinite;
animation-direction: alternate;
}

A

div
{
animation: changeColor 5s linear 2s infinite alternate
}

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