Move #box along a diagonal path from 0,0 to 100,100.
Acceptance criteria
- 1.Move #box along a diagonal path from 0,0 to 100,100.
CSS Tutorial · CSS Animations & Transitions
These 10 tasks go with the Motion Paths 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: “Position and animate an element along a path while controlling its rotation and distance. The lesson covers path geometry, offset distance, automatic rotation, anchor points, keyframe animation, basic shapes, and reduced motion.” .
1.Define a motion pathexercise · easy · 10 min
Move #box along a diagonal path from 0,0 to 100,100.
Passes when: Move #box along a diagonal path from 0,0 to 100,100.
2.Place along the pathexercise · easy · 10 min · practice plan
Put #box halfway along its path.
Passes when: Put #box halfway along its path.
3.Keep the element uprightexercise · easy · 10 min · practice plan
Stop #box turning as it travels, by locking its rotation to 0 degrees.
Passes when: Stop #box turning as it travels, by locking its rotation to 0 degrees.
4.Set the anchor pointexercise · easy · 10 min · practice plan
Anchor #box by its centre.
Passes when: Anchor #box by its centre.
5.Animate along the pathexercise · medium · 10 min · practice plan
Attach a path, start at 25%, and follow the tangent.
Passes when: Attach a path, start at 25%, and follow the tangent.
6.Fix the unquoted pathbug fix · easy · 8 min
The path data must be a quoted string.
Passes when: The path data must be a quoted string.
7.Fix the distance with no unitbug fix · easy · 8 min · practice plan
offset-distance needs a length or percentage.
Passes when: offset-distance needs a length or percentage.
8.Fix the fixed rotationbug fix · easy · 8 min · practice plan
This element should follow the path direction, not hold a 90 degree angle.
Passes when: This element should follow the path direction, not hold a 90 degree angle.
9.Fix the misspelled propertybug fix · easy · 8 min · practice plan
The property is offset-anchor.
Passes when: The property is offset-anchor.
10.Fix the path on the wrong elementbug fix · easy · 8 min · practice plan
The moving box needs the path, not the wrapper.
Passes when: The moving box needs the path, not the wrapper.
Between them these tasks cover offset-path, offset-distance and offset-rotate.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.