Experimenting With Scroll-Driven corner-shape Animations

来源: CSS-Tricks | 作者: Daniel Schwarz | 日期: 2026-03

核心内容

文章探讨了如何将 CSS 新属性 corner-shape 与 scroll-driven animations 结合,创造有趣的 UI 效果。

corner-shape 快速入门

corner-shape 支持多种关键字和 superellipse() 函数:

滚动驱动动画示例

@keyframes bend-it-like-beckham {
  from {
    corner-shape: superellipse(notch);
    /* or */
    corner-shape: superellipse(-infinity);
  }
  to {
    corner-shape: superellipse(square);
    /* or */
    corner-shape: superellipse(infinity);
  }
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: difference;
  background: white;
  border-bottom-left-radius: 100%;
  animation: bend-it-like-beckham;
  animation-timeline: scroll();
}

关键要点

进阶用法

技术价值

这是一篇实用性很强的 CSS 实战教程,展示了两个即将成为 CSS Baseline 的特性如何配合使用。corner-shape 是 border-radius 的伴侣属性,而 scroll-driven animations 是 Interop 2026 的重点特性。两者结合可以创造出过去需要 JavaScript 才能实现的视觉效果。

CSS Animation corner-shape Scroll-driven UI Chrome 139+