我发现了一个带有烟雾动画的漂亮戒指,但我不能完全理解它.

我想改变这个戒指的尺寸,比如说80px.而且,这里只剩下一种给定的 colored颜色 .

我试着减少像素,但后来一切都崩溃了.

我怎样才能缩小这枚戒指的尺寸,只使用一种 colored颜色 ?请帮帮我.

body {
  background: #111;
}
.circle {
  position: relative;
  height: 500px;
  width: 500px;
  filter: url(#wave);
}
.circle::before {
  content: "";
  position: absolute;
  top: 100px;
  left: 100px;
  right: 100px;
  bottom: 100px;
  border: 10px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 50px #fff, inset 0 0 50px #fff;
  filter: url(#wave) blur(10px);
  animation: anim 4s linear infinite;
}

@keyframes anim {
  0% {
    box-shadow: 0 0 50px #fff, inset 0 0 50px #fff;
  }
  20% {
    box-shadow: 0 0 50px #f00, inset 0 0 50px #f00;
  }
  40% {
    box-shadow: 0 0 50px #ff0, inset 0 0 50px #ff0;
  }
  60% {
    box-shadow: 0 0 50px #0ff, inset 0 0 50px #0ff;
  }
  80% {
    box-shadow: 0 0 50px #f0f, inset 0 0 50px #f0f;
  }
}

svg {
  display: none;
}
<div class="circle"></div>

<svg>
  <filter id="wave">
    <feTurbulence x="0" y="0" baseFrequency="0.009" numOctaves="5" seed="2">
      <animate attributeName="baseFrequency" dur="30s" values="0.02;0.005;0.02" repeatCount="indefinite" />
    </feTurbulence>
    <feDisplacementMap in="SourceGraphic" scale="30" />
  </filter>
</svg>

推荐答案

I have editted your snippet to suit your needs.
Note:
because this effect uses a #wave, resizing it by setting the height and width property will ruin the effect, because #wave is not resized. you can instead use transform: scale(0.625) to adjust the scale.

body {
  background: #111;
}
.circle {
  position: relative;
  height: 500px;
  width: 500px;
  filter: url(#wave);
  transform: scale(0.625) /* add this to adjust the scale */
}
.circle::before {
  content: "";
  position: absolute;
  top: 100px;
  left: 100px;
  right: 100px;
  bottom: 100px;
  border: 10px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 50px red, inset 0 0 50px red; /* change red with your desired color */
  filter: url(#wave) blur(10px);
}

/* remove the keyframe animation so the color stays static */

svg {
  display: none;
}
<div class="circle"></div>

<svg>
  <filter id="wave">
    <feTurbulence x="0" y="0" baseFrequency="0.009" numOctaves="5" seed="2">
      <animate attributeName="baseFrequency" dur="30s" values="0.02;0.005;0.02" repeatCount="indefinite" />
    </feTurbulence>
    <feDisplacementMap in="SourceGraphic" scale="30" />
  </filter>
</svg>

Html相关问答推荐

如何使用wai-aria标签访问相关的复选框?

悬停效果在新西兰表上不起作用

SVG';COLOR&39;属性不优先于通用css';COLOR&39;属性

根据Tailwind CSS中的子计数而非子宽度进行对齐,并水平对齐

为什么我的 html 对话框在 React 中没有渲染在我的内容之上?

Angular MatBadge 在高于 99 时不显示完整数字

jquery向单词中的一组字母添加跨度

带有数据 URI 的音频在 Chrome 中失败

::可点击图标之前

在 flexbox 中使用 spacer 是否有效

在Angular中,类型"HTMLDivElement"不能分配给类型"Node"

为什么每当我调整图片大小时它都会使我的其他元素移动

视频添加到 Html 与 Github 不同步

您如何动态更改 Vue 中更高级别的标签的 CSS

具有 css 高度的输入元素:100% 溢出父 div

将 div 放在图片旁边而不是下方

每次按下按钮时减小字体大小的 jquery 函数

在不扭曲图像的情况下将图像放入灵活的 Div 框内

如何向弹出窗口添加 sanitize: false 选项?

所有幻灯片上的 Quarto RevealJS 标题