Bird
0
0

Given the Angular animation code below, what will be the final background color after the animation completes?

medium📝 state output Q13 of 15
Angular - Animations
Given the Angular animation code below, what will be the final background color after the animation completes?
animate('2s', keyframes([
  style({ backgroundColor: 'red', offset: 0 }),
  style({ backgroundColor: 'blue', offset: 0.5 }),
  style({ backgroundColor: 'green', offset: 1 })
]))
Ared
Bblue
Ctransparent
Dgreen
Step-by-Step Solution
Solution:
  1. Step 1: Understand keyframe offsets and colors

    The animation starts at red (offset 0), changes to blue at halfway (offset 0.5), and ends at green (offset 1).
  2. Step 2: Determine final style after animation

    At offset 1 (end), the background color is green, so the final color after animation is green.
  3. Final Answer:

    green -> Option D
  4. Quick Check:

    Final offset color = green [OK]
Quick Trick: Final offset (1) style is final animation state [OK]
Common Mistakes:
  • Choosing the first or middle color instead of final
  • Confusing offset values with time
  • Assuming default color remains after animation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes