Timeline-scope - Property CSS

timeline-scope

Summary of characteristics of the timeline-scope property

Quick description
Sets the scope of a timeline for scroll-driven animation.
Status
Standard
Applies to
Tous les éléments.
Usable for
HTML
Percentages
Not applicable.
Initial value
none
Inherited by default
No.
Animation type
[none}
W3C Module
Scroll-driven Animations
References (W3C)
Document status: WD (Working Draft)

Description of the timeline-scope property.

Recent feature described in the CSS module 'Scroll-driven Animations'.

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.

Example of scroll-driven animation





 

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.

Sans utilisation de timeline-scope
Without use of timeline-scope
Avec utilisation de 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.

Example with timeline-scope





 

Values for timeline-scope.

  • timeline-scope: none;

    With a value of none, the timeline-scope property has no effect. However, this value can be useful for overriding an inherited value.

  • timeline-scope: --id;

    --id is 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 the animation-timeline property. It is also found in the scroll bar as a value of scroll-timeline or view-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.

Example for animation-scope

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.

Example for animation-scope

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.

Cube in CSS - Front side Cube in CSS - Top side Cube in CSS - Left side Cube in CSS - Right side Cube in CSS - Bottom side Cube in CSS - Back side

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).

timeline-scope :












 

Browsers compatibility.

Column 1
Support for the 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.

1
timeline-scope
property
Estimated overall support.
74%

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.

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:

animation-range
Specifies the start and end point of the animation, in the case of scroll-driven animation.
animation-range-end
Specifies the end point of the animation, in the case of scroll-driven animation.
animation-range-start
Specifies the starting point of the animation, in the case of scroll-driven animation.
scroll-timeline
A short hand property that defines the parameters of a scroll-driven animation.
scroll-timeline-axis
Langue française
Specifies which axis (vertical or horizontal) should synchronize the scroll-driven animation.
scroll-timeline-name
Langue française
Sets an identifier for a scroll-driven animation.
view-timeline
Langue française
A short hand property that defines the parameters of a scroll-driven animation.
view-timeline-axis
Langue française
Defines which axis (vertical or horizontal) is used for a scroll-driven animation.
view-timeline-inset
Langue française
Specifies an adjustment of the scroll box in the context of a scroll-driven animation.
view-timeline-name
Langue française
Sets an identifier for a scroll-driven animation.

Functions:

scroll()
Langue française
Facilitates the implementation of scroll-driven animations.
view()
Langue française
Defines a Scroll Driver Animation.