CSS 动画渐变

CSS animted gradient

您好,我正在尝试使 CSS 中的渐变角度(度)更平滑。我想让它像滚动一样动画。

视频展示: https://imgur.com/a/IM3o7qK

body {
  min-height: 100vh;
  min-width: 100vw;
  margin:0;
  
  background: linear-gradient(115deg, #007fff 55%, #f5fafa 45%);
}

@media only screen and (max-width: 800px) {
  body {
    background: linear-gradient(340deg, #f5fafa 60%, #007fff 40%);
  }
}

你不能用渐变来做到这一点,但你可以像下面这样使用旋转:

html::before {
  content: "";
  position: fixed;
  top: 50%;
  left: 50%;
  height: 150vmax;
  width: 150vmax;
  background: linear-gradient(0deg, #007fff 55%, #f5fafa 45%);
  transform: translate(-50%, -50%) rotate(115deg);
  transition: transform 1s;
}

@media only screen and (max-width: 800px) {
  html::before {
    transform: translate(-50%, -50%) rotate(155deg);
  }
}