Tie the animation on #box to the scroll progress.
Acceptance criteria
- 1.Tie the animation on #box to the scroll progress.
CSS Tutorial · CSS Animations & Transitions
These 10 tasks go with the Scroll Animations chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “Drive animation progress from a scroll container or an element's passage through the scrollport instead of elapsed time. It distinguishes scroll and view timelines, animation ranges, named timelines, progressive enhancement, and motion preferences.” .
1.Drive an animation by scrollexercise · easy · 10 min
Tie the animation on #box to the scroll progress.
Passes when: Tie the animation on #box to the scroll progress.
2.Use a view timelineexercise · easy · 10 min · practice plan
Tie the animation on #box to its visibility in the viewport.
Passes when: Tie the animation on #box to its visibility in the viewport.
3.Name and drive togetherexercise · easy · 10 min · practice plan
Attach the fade keyframes and a scroll timeline.
Passes when: Attach the fade keyframes and a scroll timeline.
4.Hold the end stateexercise · easy · 10 min · practice plan
Use a view timeline and keep the final frame.
Passes when: Use a view timeline and keep the final frame.
5.Build a scroll revealexercise · medium · 10 min · practice plan
Fade in as the element enters the view, holding both ends.
Passes when: Fade in as the element enters the view, holding both ends.
6.Fix the missing parenthesesbug fix · easy · 8 min
scroll is a timeline function and needs parentheses.
Passes when: scroll is a timeline function and needs parentheses.
7.Fix scroll used where view was meantbug fix · easy · 8 min · practice plan
This should react to the element entering the viewport.
Passes when: This should react to the element entering the viewport.
8.Fix the missing animation namebug fix · easy · 8 min · practice plan
A timeline drives nothing without keyframes attached.
Passes when: A timeline drives nothing without keyframes attached.
9.Fix the fill modebug fix · easy · 8 min · practice plan
Both ends should be held, not just the last frame.
Passes when: Both ends should be held, not just the last frame.
10.Fix the timeline on the wrong elementbug fix · easy · 8 min · practice plan
The animated box needs the timeline, not the wrapper.
Passes when: The animated box needs the timeline, not the wrapper.
Between them these tasks cover animation-timeline, scroll() and view() and Progress-driven motion.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.