Scroll-Linked Animations With the Web Animations API (WAAPI) and ScrollTimeline

Just before I left on holiday, the 2nd article I wrote for CSS-Tricks got published. In it, I take a look at the JavaScript side of the Scroll-Linked Animations specification. The typical progress-bar as you scroll can be code like this: const myScrollTimeline = new ScrollTimeline({ source: document.scrollingElement, orientation: ‘block’, scrollOffsets: [ new CSSUnitValue(0, ‘percent’), …


This content originally appeared on Bram.us and was authored by Bramus!

Just before I left on holiday, the 2nd article I wrote for CSS-Tricks got published. In it, I take a look at the JavaScript side of the Scroll-Linked Animations specification.

The typical progress-bar as you scroll can be code like this:

const myScrollTimeline = new ScrollTimeline({
  source: document.scrollingElement,
  orientation: 'block',
  scrollOffsets: [
    new CSSUnitValue(0, 'percent'),
    new CSSUnitValue(100, 'percent'),
  ],
});

document.querySelector("#progress").animate(
  {
    transform: ["scaleX(0)", "scaleX(1)"]
  },
  { 
    duration: 1, 
    fill: "forwards", 
    timeline: myScrollTimeline
  }
);

Find the details in the article.

Scroll-Linked Animations With the Web Animations API (WAAPI) and ScrollTimeline →


This content originally appeared on Bram.us and was authored by Bramus!


Print Share Comment Cite Upload Translate Updates
APA

Bramus! | Sciencx (2021-11-24T11:10:12+00:00) Scroll-Linked Animations With the Web Animations API (WAAPI) and ScrollTimeline. Retrieved from https://www.scien.cx/2021/11/24/scroll-linked-animations-with-the-web-animations-api-waapi-and-scrolltimeline-2/

MLA
" » Scroll-Linked Animations With the Web Animations API (WAAPI) and ScrollTimeline." Bramus! | Sciencx - Wednesday November 24, 2021, https://www.scien.cx/2021/11/24/scroll-linked-animations-with-the-web-animations-api-waapi-and-scrolltimeline-2/
HARVARD
Bramus! | Sciencx Wednesday November 24, 2021 » Scroll-Linked Animations With the Web Animations API (WAAPI) and ScrollTimeline., viewed ,<https://www.scien.cx/2021/11/24/scroll-linked-animations-with-the-web-animations-api-waapi-and-scrolltimeline-2/>
VANCOUVER
Bramus! | Sciencx - » Scroll-Linked Animations With the Web Animations API (WAAPI) and ScrollTimeline. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/24/scroll-linked-animations-with-the-web-animations-api-waapi-and-scrolltimeline-2/
CHICAGO
" » Scroll-Linked Animations With the Web Animations API (WAAPI) and ScrollTimeline." Bramus! | Sciencx - Accessed . https://www.scien.cx/2021/11/24/scroll-linked-animations-with-the-web-animations-api-waapi-and-scrolltimeline-2/
IEEE
" » Scroll-Linked Animations With the Web Animations API (WAAPI) and ScrollTimeline." Bramus! | Sciencx [Online]. Available: https://www.scien.cx/2021/11/24/scroll-linked-animations-with-the-web-animations-api-waapi-and-scrolltimeline-2/. [Accessed: ]
rf:citation
» Scroll-Linked Animations With the Web Animations API (WAAPI) and ScrollTimeline | Bramus! | Sciencx | https://www.scien.cx/2021/11/24/scroll-linked-animations-with-the-web-animations-api-waapi-and-scrolltimeline-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.