Description
Currently the spec treats <timeline-range-name>
as an <ident>
and a named range is specified as <timeline-range-name> <length-percentage>
.
A range can also be simply a <length-percentage>
without a name for use with ScrollTimelines, and there's a suggestion for allowing the same for ViewTimelines, for attaching to the entire scroll range.
However, there are some use-cases, which are currently not addressed, more specifically: clamping a scroll range at the edges of the scroll container, so the effect, for example, will always start at 0% progress or end at 100% progress, regardless of layout.
Example could be an element that has the following animation:
@keyframes fadeIn {
from {
opacity: 0;
}
}
.target {
animation: fadeIn auto both view();
animation-range: entry;
}
But when the page loads the target is already partially visible in the viewport. So it will present on load as semi-transparent.
One way to address these could be but can be done if we could use named ranges inside math functions, so authors could write it as:
@keyframes fadeIn {
from {
opacity: 0;
}
}
.target {
animation: fadeIn auto both view();
animation-range: max(0%, entry 0%) entry 100%;
}
So questions are:
- can we make it possible?
- does this require syntax changes? Or just spec changes to how these types interact?
Metadata
Metadata
Assignees
Type
Projects
Status