Version selector

This demo has several versions:

  1. Named Scroll-Timeline with scroll-timeline
  2. Anonymous Scroll-Timeline with scroll(block root)
  3. Anonymous Scroll-Timeline with scroll(block nearest)
  4. Anonymous Scroll-Timeline with scroll()
  5. WAAPI + ScrollTimeline
🏠

About this demo

This demo has a progress fixed to the top of the viewport. As you scroll down the page, the progress bar grows until it takes up the full viewport width upon reaching the end of the document.

The Code

The reading progress indicator is positioned at the top of the page using position fixed. To leverage composited animations, not the width is being animated but the element is scaled down on the x-axis using a transform.

<body>
	<div id="progress"></div>
	…
</body>
#progress {
	position: fixed;
	left: 0; top: 0;
	width: 100%; height: 1em;
	background: red;
}
const $progressbar = document.querySelector('#progress');

$progressbar.style.transformOrigin = '0% 50%';
$progressbar.animate(
	{
		transform: ['scaleX(0)', 'scaleX(1)'],
	},
	{
		fill: 'forwards',
		timeline: new ScrollTimeline({
			source: document.documentElement,
		}),
	}
);

Explanation

Using the Web Animations API, the progress bar is animated. The animation is linked to a ScrollTimeline instance that tracks the root scroller. Because no axis is specified, it tracks the scroller’s block axis.

The Polar Bear

⚠️ Your browser does not support Scroll-Linked Animations with JS + WAAPI. Please use Chrome 115 or newer.

From Wikipedia, the free encyclopedia

The polar bear (Ursus maritimus) is a hypercarnivorous species of bear. Its native range lies largely within the Arctic Circle, encompassing the Arctic Ocean and its surrounding seas and landmasses, which includes the northernmost regions of North America and Eurasia. It is the largest extant bear species, as well as the largest extant land carnivore. A boar (adult male) weighs around 350–700 kg (770–1,540 lb), while a sow (adult female) is about half that size. Although it is the sister species of the brown bear, it has evolved to occupy a narrower ecological niche, with many body characteristics adapted for cold temperatures, for moving across snow, ice and open water, and for hunting seals, which make up most of its diet. Although most polar bears are born on land, they spend most of their time on the sea ice. Their scientific name means "maritime bear" and derives from this fact. Polar bears hunt their preferred food of seals from the edge of sea ice, often living off fat reserves when no sea ice is present. Because of their dependence on the sea ice, polar bears are classified as marine mammals.

Because of expected habitat loss caused by climate change, the polar bear is classified as a vulnerable species. For decades, large-scale hunting raised international concern for the future of the species, but populations rebounded after controls and quotas began to take effect. For thousands of years, the polar bear has been a key figure in the material, spiritual, and cultural life of circumpolar peoples, and polar bears remain important in their cultures. Historically, the polar bear has also been known as the "white bear". It is sometimes referred to as the "nanook", based on the Inuit term nanuq.

Polar bear walking by Daniel Bosse

Naming and etymology

Constantine John Phipps was the first to describe the polar bear as a distinct species in 1774 in his report about his 1773 expedition towards the North Pole. He chose the scientific name Ursus maritimus, the Latin for "maritime bear", due to the animal's native habitat. The Inuit refer to the animal as nanook (transliterated as nanuq in the Inupiat language). The Yupik also refer to the bear as nanuuk in Siberian Yupik. In the Chukotko-Kamchatkan languages of Alyutor and Koryak, the name of the polar bear is umqa, while in the related Chukchi, it is umqə. In Russian, it is usually called бе́лый медве́дь (bélyj medvédj, 'white bear'), though an older word still in use is ошку́й (Oshkúj, which comes from the Komi oski, "bear"). In Quebec, the polar bear is referred to by the french terms ours blanc ('white bear') or ours polaire ('polar bear'). In Norwegian, one of the primary languages of the Svalbard archipelago, the polar bear is referred to as isbjørn ('ice bear') or kvitbjørn ('white bear').

The polar bear was previously considered to be in its own genus, Thalarctos. However, evidence of hybrids between polar bears and brown bears, and of the recent evolutionary divergence of the two species, does not support the establishment of this separate genus, and the accepted scientific name is now therefore Ursus maritimus, as Phipps originally proposed.

Polar bear shaking off water by Daniel Bosse

Taxonomy and evolution

The bear family, Ursidae, is thought to have split from other carnivorans about 38 million years ago. The subfamily Ursinae originated approximately 4.2 million years ago. The oldest known polar bear fossil is a 130,000 to 110,000-year-old jaw bone, found on Prince Charles Foreland in 2004. Fossils show that between 10,000 and 20,000 years ago, the polar bear's molar teeth changed significantly from those of the brown bear. Polar bears are thought to have diverged from a population of brown bears that became isolated during a period of glaciation in the Pleistocenefrom the eastern part of Siberia (from Kamchatka and the Kolym Peninsula).

The evidence from DNA analysis is more complex. The mitochondrial DNA (mtDNA) of the polar bear diverged from the brown bear, Ursus arctos, roughly 150,000 years ago. Further, some clades of brown bear, as assessed by their mtDNA, were thought to be more closely related to polar bears than to other brown bears, meaning that the brown bear might not be considered a species under some species concepts, but paraphyletic. The mtDNA of extinct Irish brown bears is particularly close to polar bears. A comparison of the nuclear genome of polar bears with that of brown bears revealed a different pattern, the two forming genetically distinct clades that diverged approximately 603,000 years ago, although the latest research is based on analysis of the complete genomes (rather than just the mitochondria or partial nuclear genomes) of polar and brown bears, and establishes the divergence of polar and brown bears at 400,000 years ago.

However, the two species have mated intermittently for all that time, most likely coming into contact with each other during warming periods, when polar bears were driven onto land and brown bears migrated northward. Most brown bears have about 2 percent genetic material from polar bears, but one population, the ABC Islands bears, has between 5 percent and 10 percent polar bear genes, indicating more frequent and recent mating. Polar bears can breed with brown bears to produce fertile grizzly–polar bear hybrids; rather than indicating that they have only recently diverged, the new evidence suggests more frequent mating has continued over a longer period of time, and thus the two bears remain genetically similar. However, because neither species can survive long in the other's ecological niche, and because they have different morphology, metabolism, social and feeding behaviours, and other phenotypic characteristics, the two bears are generally classified as separate species.

When the polar bear was originally documented, two subspecies were identified: the American polar bear (Ursus maritimus maritimus) by Constantine J. Phipps in 1774, and the Siberian polar bear (Ursus maritimus marinus) by Peter Simon Pallas in 1776. This distinction has since been invalidated. One alleged fossil subspecies has been identified: Ursus maritimus tyrannus, which became extinct during the Pleistocene. U.m. tyrannus was significantly larger than the living subspecies. However, recent reanalysis of the fossil suggests that it was actually a brown bear.

Source: Wikipedia