<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/stylish-holidays-creating-a-scroll-driven-christmas-tree-in-css-m8h2j7amg" -->

---
title: Stylish holidays! Creating a scroll-driven Christmas...
description: A CSS demo walkthrough builds an animated, scroll-driven Christmas tree by combining SVG stroke animations, CSS anchor positioning, @property custom...
canonical: https://daily.dev/posts/stylish-holidays-creating-a-scroll-driven-christmas-tree-in-css-m8h2j7amg
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Stylish holidays! Creating a scroll-driven Christmas tree in CSS | daily.dev
og:description: A CSS demo walkthrough builds an animated, scroll-driven Christmas tree by combining SVG stroke animations, CSS anchor positioning, @property custom...
og:url: https://daily.dev/posts/stylish-holidays-creating-a-scroll-driven-christmas-tree-in-css-m8h2j7amg
og:image: https://api.daily.dev/og/posts/M8h2J7Amg.png
og:image:alt: Stylish holidays! Creating a scroll-driven Christmas tree in CSS
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Stylish holidays! Creating a scroll-driven Christmas tree in CSS

**[utilitybend](https://daily.dev/sources/utilitybend)** · 8 min read · 0 upvotes · 0 comments

## Summary

A CSS demo walkthrough builds an animated, scroll-driven Christmas tree by combining SVG stroke animations, CSS anchor positioning, @property custom properties, offset-path, and container style queries. The star traverses the tree and baubles as the user scrolls, with the tree and bauble outlines drawn via animated stroke-dashoffset. The demo is Chromium-only due to the cutting-edge feature set, and full code is shared via CodePen along with links to related deep-dive articles on each technique.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://utilitybend.com/blog/stylish-holidays-creating-a-scroll-driven-christmas-tree-in-css>

## Questions this post answers

### How do you animate SVG stroke-dasharray values using CSS @property with a scroll timeline?

Define the stroke length as a custom property with @property using syntax "<number>", set stroke-dasharray to that variable, and animate stroke-dashoffset from the full length to 0 within a @keyframes rule attached via animation-timeline to a named scroll-timeline (e.g., --page-scroller) declared with scroll-timeline: --page-scroller block on the root element.

_daily.dev surfaces deep-dive CSS animation techniques for developers pushing scroll-based effects further._

### How can I make an element follow different SVG paths dynamically using CSS anchor positioning and container style queries?

Set a custom property like --star-anchor to the current anchor name, position the element with top/left using the anchor() function, and use container style queries (@container style(--star-anchor: --ball-1)) to swap the offset-path to a different shape whenever the anchor variable changes during the animation.

_Developers experimenting with anchor positioning can track these emerging CSS patterns on daily.dev._

### Does CSS custom property animation run off the main thread?

No, animations driven by custom properties do not run off the main thread, unlike some compositor-accelerated CSS animations such as transform or opacity changes alone. This is a known limitation when building complex effects like scroll-driven SVG stroke animations using @property values.

_Keep up with CSS performance nuances like this via daily.dev when building animation-heavy interfaces._

## Similar posts on daily.dev

- [Recreating Apple’s Vision Pro Animation in CSS](https://daily.dev/posts/recreating-apple-s-vision-pro-animation-in-css-de7qk8yoq) · CSS-Tricks · 10 upvotes · 0 comments
- [Scroll-driven CSS animations](https://daily.dev/posts/scroll-driven-css-animations-uw6plcluy) · Flavio Copes · 142 upvotes · 6 comments
- [How to animate SVG with CSS: Tutorial with examples](https://daily.dev/posts/how-to-animate-svg-with-css-tutorial-with-examples-wnvz9fnpb) · LogRocket · 4 upvotes · 0 comments
- [Fun shadow coding challenge](https://daily.dev/posts/fun-shadow-coding-challenge-zpl8nwyqu) · Kitty says hi. · 1 upvotes · 0 comments

---

Tags: [#css](https://daily.dev/tags/css), [#svg](https://daily.dev/tags/svg)

[View this post on daily.dev](https://daily.dev/posts/stylish-holidays-creating-a-scroll-driven-christmas-tree-in-css-m8h2j7amg)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Stylish holidays! Creating a scroll-driven Christmas tree in CSS","url":"https://daily.dev/posts/stylish-holidays-creating-a-scroll-driven-christmas-tree-in-css-m8h2j7amg","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/stylish-holidays-creating-a-scroll-driven-christmas-tree-in-css-m8h2j7amg"},"datePublished":"2026-09-20T07:43:21.748Z","dateModified":"2026-09-20T07:44:33.346Z","description":"A CSS demo walkthrough builds an animated, scroll-driven Christmas tree by combining SVG stroke animations, CSS anchor positioning, @property custom...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/0e7e8123f802a50e06d0061515810a11?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/0e7e8123f802a50e06d0061515810a11?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"utilitybend","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"utilitybend","logo":"https://media.daily.dev/image/upload/s--hONVFSz4--/f_auto,q_auto/v1789890196/logos/utilitybend?_a=BAMAMicg0","url":"https://daily.dev/sources/utilitybend"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/stylish-holidays-creating-a-scroll-driven-christmas-tree-in-css-m8h2j7amg","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"css,svg","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"utilitybend","item":"https://daily.dev/sources/utilitybend"},{"@type":"ListItem","position":3,"name":"Stylish holidays! Creating a scroll-driven Christmas tree in CSS"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/stylish-holidays-creating-a-scroll-driven-christmas-tree-in-css-m8h2j7amg#faq","mainEntity":[{"@type":"Question","name":"How do you animate SVG stroke-dasharray values using CSS @property with a scroll timeline?","acceptedAnswer":{"@type":"Answer","text":"Define the stroke length as a custom property with @property using syntax \"\u003cnumber\u003e\", set stroke-dasharray to that variable, and animate stroke-dashoffset from the full length to 0 within a @keyframes rule attached via animation-timeline to a named scroll-timeline (e.g., --page-scroller) declared with scroll-timeline: --page-scroller block on the root element. daily.dev surfaces deep-dive CSS animation techniques for developers pushing scroll-based effects further."}},{"@type":"Question","name":"How can I make an element follow different SVG paths dynamically using CSS anchor positioning and container style queries?","acceptedAnswer":{"@type":"Answer","text":"Set a custom property like --star-anchor to the current anchor name, position the element with top/left using the anchor() function, and use container style queries (@container style(--star-anchor: --ball-1)) to swap the offset-path to a different shape whenever the anchor variable changes during the animation. Developers experimenting with anchor positioning can track these emerging CSS patterns on daily.dev."}},{"@type":"Question","name":"Does CSS custom property animation run off the main thread?","acceptedAnswer":{"@type":"Answer","text":"No, animations driven by custom properties do not run off the main thread, unlike some compositor-accelerated CSS animations such as transform or opacity changes alone. This is a known limitation when building complex effects like scroll-driven SVG stroke animations using @property values. Keep up with CSS performance nuances like this via daily.dev when building animation-heavy interfaces."}}]}
```

