Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a simple animation mixin that sets the animation name.
SASS
@mixin animation-name($name) {
animation-name: [1];
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string literal instead of the variable.
Forgetting the $ sign for the variable.
✗ Incorrect
The mixin uses the parameter $name to set the animation-name property. So, $name is correct.
2fill in blank
mediumComplete the mixin to include animation duration with a default value of 1s.
SASS
@mixin animation-duration($duration: [1]) {
animation-duration: $duration;
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using milliseconds instead of seconds.
Leaving the default value empty.
✗ Incorrect
The default duration for animations is commonly set to 1s for smooth effect.
3fill in blank
hardFix the error in the mixin to correctly apply animation timing function.
SASS
@mixin animation-timing($timing) {
animation-timing-function: [1];
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the $ sign before the variable.
Using incorrect property names.
✗ Incorrect
Variables in Sass must be prefixed with $, so $timing is correct to use the parameter.
4fill in blank
hardFill both blanks to create a mixin that sets animation name and duration with default 2s.
SASS
@mixin animation-settings($name, $duration: [1]) { animation-name: [2]; animation-duration: $duration; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without $.
Setting default duration without units.
✗ Incorrect
The default duration is 2s, and animation-name uses the $name variable.
5fill in blank
hardFill all three blanks to create a mixin that sets animation name, duration, and timing function with defaults.
SASS
@mixin animation-full($name, $duration: [1], $timing: [2]) { animation-name: [3]; animation-duration: $duration; animation-timing-function: $timing; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting $ before variable names.
Using invalid timing function strings.
✗ Incorrect
Default duration is 1.5s, default timing is ease-in-out, and animation-name uses $name variable.