Timeline-scope - Property CSS
Summary of characteristics of the timeline-scope property
noneDescription of the timeline-scope property.
The timeline-scope property is about scroll-driven animations.
Recall that these animations are defined with the scroll-timeline or view-timeline properties on a container with scroll bars,
and that they can then be applied to any descendant element of that container, or to the container itself with the animation-timeline.
The timeline-scope property allows you to extend this use to elements that are not descendants of the container.
Here is a concrete example as a reminder of how scroll-driven animations work.
A container with a scroll bars defines a drive named --demo1
(The name can be chosen freely but the double dash is mandatory).
The animation (a simple rotation) is applied to the frame of a wheel, which is included in the previous container.
To ensure that the wheel does not disappear due to scrolling, its position has been set to sticky.
⚠ The example doesn't work on Firefox (2024), but the CSS codes can still be viewed.

So far so good because the animated element (the wheel) is included in the scrolling container. But if we want to animate an element that is not a descendant
of the scrolling container, it will not be possible. This is where the timeline-scope property comes in, which will allow us to use this scrolling to animate
any element on the page.

Without use of
timeline-scope

With use of
timeline-scope
Here's the code with timeline-scope. The scroll bar is not the parent of the image, but by applying timeline-scope on the container,
we find a correct functioning.

Main properties to know.
Here are the properties and functions you need to know to implement scroll-driven animations.
overflow :scroll or auto on the scrolling container.scroll() 
:view() 
:Values for timeline-scope.
- timeline-scope: none;
With a value of
none, thetimeline-scopeproperty has no effect. However, this value can be useful for overriding an inherited value. - timeline-scope: --id;
--idis an identifier chosen by the user. It must begin with a double hyphen. This identifier is found in a descendant of the element as the value of theanimation-timelineproperty. It is also found in the scroll bar as a value ofscroll-timelineorview-timeline. - timeline-scope: initial; (
none) timeline-scope: inherit; timeline-scope: revert; timeline-scope: revertLayer; timeline-scope: unset;Common values are presented on these pages:
initial,inherit,revert,revert-layer,unset.
Examples.
These examples will not work on Firefox unless you have enabled the flag layout.css.scroll-driven-animations.enabled (access flags on Firefox).
Controlling the rotation of an image.
In this example, the ex1-progress scroll bar rotates the ex1-image image. The scroll bar is not a parent of the image.
Their common parent bears the identifier ex1. Thanks to the timeline-scope property, it was possible to associate the rotation of the image
to the scroll bar.
Notching effect.
Here we play with the scale factor of the image.
The notching effect is achieved by the steps() function associated with the animation-timing-function property.
Managing along the three axes.
Here's an example with a slightly more complicated CSS. First of all, the cube must be built, which is done by successive transformation of six images representing the six faces of the cube (rotations and translations).
The cube once built is enclosed in three successive containers cube1, cube2 and cube3, each of them receives
a rotation in one of the axes.
Animation of the timeline-scope property.
The timeline-scope property cannot be animated, like all other properties that are used to define animations.
Simulator.
The scrolling container (in blue) sets the --demo2 identifier associated with its vertical scrolling. Both wheel images attempt to use
this identifier. For the first one, which is included in the scrolling container, it still works, but for the right wheel, you have to extend the
--demo2 scope.
The timeline-scope property is applied to the green container higher up the tree, which includes the second wheel.
⚠ The operation will not be possible on Firefox (2024).

Browsers compatibility.
timeline-scope property to change the scope of identifiers defined by scroll-timeline-name.Notes:
(1) Can be enabled by setting the flag layout.css.scroll-driven-animations.enabled to true.
timeline-scopeproperty
Browsers on computers :
Mobile browsers :
Outdated or marginal browsers :

Internet Explorer

Baidu Browser

QQ Browser

Opéra Mobile

Firefox

Chrome

Safari

Edge

Opéra

Chrome pour Androïd

Safari sur IOS

Samsung Internet

UC Browser pour Androïd

Androïd Brower

Firefox pour Androïd

KaiOS Browser

Opéra mini
timeline-scope property historic.
-
Scroll-driven Animations - Level 1
Regardingtimeline-scope. First introduction to thetimeline-scopeproperty.October 25, 2022Working Draft.
See also, about scroll-driven animations.
Scroll-driven animations are grouped in the Scroll-driven Animations module. The timeline-scope property
is included in this module, along with the following definitions:
Properties:









