RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题 / 1273287
Accepted
DiD
DiD
Asked:2022-04-22 14:49:07 +0000 UTC2022-04-22 14:49:07 +0000 UTC 2022-04-22 14:49:07 +0000 UTC

为什么 stroke-dashoffset 在 SVG 中不起作用?

  • 772

有一个很好的脚本,不幸的是它只适用于 codepen.io 网站。

我正在尝试将其移植到 SVG。起初我使用<animate>and <animateTransform>。但是有些事情没有解决,所以我决定将其更改为 SVG+CSS。但是,它也被证明是错误的。在 codepen 网站上的脚本上,时钟以一种活泼的方式工作。我得到了一些不真实的物理学。

html,
      body {
        min-height: 100vh;
        margin: 0;
        padding: 0;
      }
      body {
        background: #4873a9;
      }
      * {
        box-sizing: border-box;
      }
      svg {
        position: absolute;
        width: 600px;
        height: 600px;
        left: calc(50vw - 300px);
        top: calc(50vh - 300px);
      }
      :root {
        --animation-duration: 10s;
      }
      .topSand {
        animation: topSand var(--animation-duration) linear infinite;
      }
      .botSand {
        animation: botSand var(--animation-duration) linear infinite;
      }
      .topShadow {
        animation: topShadow var(--animation-duration) linear infinite;
      }
      .botShadow {
        animation: botShadow var(--animation-duration) linear infinite;
      }
      .rightShine {
        animation: rightShine var(--animation-duration) linear infinite;
      }
      .leftShine {
        animation: leftShine var(--animation-duration) linear infinite;
      }
      .allGrouped {
        animation: rotate var(--animation-duration) linear infinite;
        transform-origin: 306px 275px;
      }
      .drip {
        animation: drip var(--animation-duration) linear infinite;
        stroke-miterlimit: 10;
      }
      @keyframes topSand {
        0% {
          y: 90px;
        }
        90% {
          y: 280px;
        }
        100% {
          y: 280px;
        }
      }
      @keyframes botSand {
        0% {
          cy: 580px;
          rx: 47.5;
        }
        5% {
          cy: 580px;
          rx: 47.5;
        }
        90% {
          cy: 415px;
          rx: 247.5;
        }
        93% {
          cy: 415px;
          rx: 247.5;
        }
        100% {
          cy: 415px;
          rx: 247.5;
          cy: 375px;
        }
      }
      @keyframes rotate {
        0% {
          transform: rotate(0deg);
        }
        90% {
          transform: rotate(0deg);
        }
        100% {
          transform: rotate(180deg);
        }
      }
      @keyframes topShadow {
        0% {
          opacity: 0.12;
        }
        90% {
          opacity: 0.12;
        }
        100% {
          opacity: 0;
        }
      }
      @keyframes botShadow {
        0% {
          opacity: 0;
        }
        90% {
          opacity: 0;
        }
        100% {
          opacity: 0.12;
        }
      }
      @keyframes rightShine {
        0% {
          opacity: 0.1;
        }
        90% {
          opacity: 0.1;
        }
        100% {
          opacity: 0.28;
        }
      }
      @keyframes leftShine {
        0% {
          opacity: 0.28;
        }
        90% {
          opacity: 0.28;
        }
        100% {
          opacity: 0.1;
        }
      }
      @keyframes drip {
        0% {
          stroke-dashoffset: 180px;
          stroke-dasharray: 1px 86px;
        }
        5% {
          stroke-dashoffset: -186px;
          stroke-dasharray: 1px, 2px;
        }
        8% {
          stroke-dashoffset: 0;
          stroke-dasharray: 1px, 1px;
        }
        11% {
          stroke-dashoffset: -186px;
          stroke-dasharray: 1px, 0px;
        }
        84.9% {
          stroke-dashoffset: 0px;
          stroke-dasharray: 1px, 0px;
        }
        88% {
          stroke-dashoffset: 0px;
          stroke-dasharray: 1px, 1px;
        }
        89.9% {
          stroke-dashoffset: 0px;
          stroke-dasharray: 1px, 48px;
        }
        90% {
          stroke-dashoffset: -186px;
          stroke-dasharray: 0px, 196px;
        }
        100% {
          stroke-dashoffset: -186px;
          stroke-dasharray: 0px, 196px;
        }
      }
<svg viewBox="0 0 600 600" width="600" height="600" xml:space="preserve">
      <defs>
        <circle id="grain" cx="0" cy="0" r="1" fill="#F7E0B7"></circle>
        <clipPath id="topMask">
          <path
            class="topMask"
            fill="#6D00BF"
            d="M316.7,266.3c-0.2,0.1-3.7,1.5-4.8,2.5c0,0,0,0,0,0.1c-1.8,1.5-3.2,4.5-3.2,7.1l-1.6,0l-1.4,0c0-2.6-1.4-5.6-3.2-7.1c0,0,0-0.1,0-0.1c-1.1-1-4.6-2.5-4.8-2.5C237.1,249.5,195,174,188,91h119h119.3C419.3,174,377.2,249.5,316.7,266.3z"
          ></path>
        </clipPath>
        <clipPath id="botMask">
          <path
            class="botMask"
            fill="#6D00BF"
            d="M316.7,283.7c-0.2-0.1-3.7-1.5-4.8-2.5c0,0,0,0,0-0.1c-1.8-1.5-3.2-4.5-3.2-7.1l-1.6,0l-1.4,0c0,2.6-1.4,5.6-3.2,7.1c0,0,0,0.1,0,0.1c-1.1,1-4.6,2.5-4.8,2.5C237.1,300.5,195,376,188,459h119h119.3C419.3,376,377.2,300.5,316.7,283.7z"
          ></path>
        </clipPath>
      </defs>
      <g class="allGrouped">
        <g clip-path="url(#topMask)">
          <rect
            class="topSand"
            x="0"
            y="90"
            fill="#F7E0B7"
            width="600"
            height="185"
          ></rect>
        </g>
        <g clip-path="url(#botMask)">
          <ellipse
            class="botSand"
            fill="#F7E0B7"
            cx="307.5"
            cy="580"
            rx="47.5"
            ry="120"
          ></ellipse>
        </g>
        <rect
          class="top"
          x="175"
          y="70"
          fill="#F1AF31"
          width="263"
          height="21"
        ></rect>
        <line
          class="drip"
          fill="none"
          stroke="#F7E0B7"
          stroke-dashoffset="-186"
          stroke-dasharray="1, 1"
          stroke-width="2"
          stroke-miterlimit="10"
          x1="307"
          y1="275"
          x2="307"
          y2="460"
        ></line>
        <path
          class="body"
          opacity="0.23"
          fill="#FFFFFF"
          d="M432.2,459H180.8c4.3-90,49.8-165,108.7-175.2c6.1-1,10.3-5.2,10.3-8.8c0-3-4.2-7.8-10.3-8.8C230.6,256,185.2,180.5,180.8,91h251.3c-4.3,89.6-49.7,166.3-108.8,175.2c-6,0.9-10.2,6.1-10.2,8.8c0,2.7,4.3,7.9,10.2,8.8C382.5,292.7,427.8,369,432.2,459z"
        ></path>
        <path
          class="topShadow"
          fill="#121212"
          opacity="0.12"
          d="M432.5,91h-252c0.3,4.1,0.8,8.8,1.4,14h249.3C432,98.3,432.2,95,432.5,91z"
          style="opacity: 0.12"
        ></path>
        <path
          class="botShadow"
          fill="#121212"
          opacity="0"
          d="M432.5,459h-252c0.3-4.1,0.8-8.8,1.4-14h249.3C432,451.7,432.2,455,432.5,459z"
          style="opacity: 0"
        ></path>
        <path
          class="rightShine"
          opacity="0.10"
          fill="#FFFFFF"
          d="M316.6,283.8c-5.2-1.2-8-6.1-8-8.8c0-2.7,2.8-7.5,8-8.8c58.6-14,105.6-87,106.5-175.2h-22.8c-3.6,85.6-38.3,168.8-102.8,177.2c0,0,8,0.7,8,6.8c0,6.2-8,6.8-8,6.8c64.5,8.3,99.2,91.6,102.8,177.2h22.8C422.3,370.8,375.3,297.8,316.6,283.8z"
          style="opacity: 0.1"
        ></path>
        <path
          class="leftShine"
          opacity="0.28"
          fill="#FFFFFF"
          d="M297,283.8c5.2-1.2,8-6.1,8-8.8c0-2.7-2.8-7.5-8-8.8c-58.6-14-105.6-87-106.5-175.2h22.8c3.6,85.6,38.3,168.8,102.8,177.2c0,0-8,0.7-8,6.8c0,6.2,8,6.8,8,6.8c-64.5,8.3-99.2,91.6-102.8,177.2h-22.8C191.4,370.8,238.4,297.8,297,283.8z"
          style="opacity: 0.28"
        ></path>
        <rect
          class="bottom"
          x="175"
          y="459"
          fill="#F1AF31"
          width="263"
          height="21"
        ></rect>
      </g>
    </svg>

一般来说,我会更具体地说明这个问题。

沙子飞溅,像codepen脚本的作者,我什至不尝试做。但是一粒沙粒,应该掉下来的,对我来说,有时悬在空中,有时又飞起来……

我想做一个低速下落的点射流。为此,我扭曲了 CSS 中的两个属性:stroke-dasharray和stroke-dashoffset. 该物业stroke-dasharray按其应有的方式工作。而on stroke-dashoffset,应该负责点的向下移动,图片完全没有反应。

为什么?

html
  • 1 1 个回答
  • 10 Views

1 个回答

  • Voted
  1. Best Answer
    Sevastopol'
    2022-04-26T08:27:33Z2022-04-26T08:27:33Z

    SMIL SVG

    根据 TS 的逻辑,回答主要问题:

    为什么 stroke-dashoffset 在 SVG 中不起作用?

    使用标签<animate>和属性,attributeName可以设置属性动画stroke-dashoffset(虚线笔画相对于原始位置的偏移量)和stroke-dasharray(虚线笔画类型)。指定属性的值和其他属性一样,也会以一定的间隔从起始值变为结束值。

    ……一团沙点,应该掉下来,对我来说要么悬在空中,要么飞起来……

    为了重现真正的沙尘坠落,动画中不仅需要包含上面列出的属性,还需要包含元素垂直轴的坐标(属性y1和y2),其值会发生变化无论是在通过颈部倒沙的初始阶段,还是在最后阶段。

    body {margin: 0; background: #4873a9;}
    <svg viewBox="0 0 600 600" width="600" height="600" xml:space="preserve">
    
    <defs>
    <circle id="grain" cx="0" cy="0" r="1" fill="#F7E0B7"></circle>
    
    <clipPath id="topMask">
    <path class="topMask" fill="#6D00BF" d="M316.7,266.3c-0.2,0.1-3.7,1.5-4.8,2.5c0,0,0,0,0,0.1c-1.8,1.5-3.2,4.5-3.2,7.1l-1.6,0l-1.4,0c0-2.6-1.4-5.6-3.2-7.1c0,0,0-0.1,0-0.1c-1.1-1-4.6-2.5-4.8-2.5C237.1,249.5,195,174,188,91h119h119.3C419.3,174,377.2,249.5,316.7,266.3z"></path>
    </clipPath>
    
    <clipPath id="botMask">
    <path class="botMask" fill="#6D00BF" d="M316.7,283.7c-0.2-0.1-3.7-1.5-4.8-2.5c0,0,0,0,0-0.1c-1.8-1.5-3.2-4.5-3.2-7.1l-1.6,0l-1.4,0c0,2.6-1.4,5.6-3.2,7.1c0,0,0,0.1,0,0.1c-1.1,1-4.6,2.5-4.8,2.5C237.1,300.5,195,376,188,459h119h119.3C419.3,376,377.2,300.5,316.7,283.7z"></path>
    </clipPath>
    
    </defs>
    
    <g id="allGrouped" transform-origin="306px 275px">
    
    <!--Трансформация часов-->
    <animateTransform id="rotate" href="#allGrouped" attributeType="xml" attributeName="transform" type="rotate" additive="replace" calcMode="linear" values="0; 180;" dur="1s" begin="drip1.end+1s" fill="freeze" repeatCount="1"/>
    <animateTransform id="rotate__revers" href="#allGrouped" attributeType="xml" attributeName="transform" type="rotate" additive="replace" values="180; 0;" dur="0.0001s" begin="rotate.end" fill="freeze" repeatCount="1"/>
    
    <!--Верхний сосуд-->
    <g clip-path="url(#topMask)">
    <rect id="topSand" x="0" y="90" fill="#F7E0B7" width="600" height="185"></rect>
    </g>
    <!--Анимация песка в верхнем сосуде-->
    <animate id="topS" href="#topSand" attributeName="y" calcMode="linear" from="90" to="280" dur="8s" begin="rotate__revers.end+1s;1.5s" fill="freeze" repeatCount="1"/>
    <animate id="topS_rev" href="#topSand" attributeName="y" calcMode="linear" from="280" to="90" dur="0.0001s" begin="rotate.end" fill="freeze" repeatCount="1"/>
    
    <!--Нижний сосуд-->
    <g clip-path="url(#botMask)">
    <ellipse id="botSand" fill="#F7E0B7" cx="307.5" cy="580" rx="47.5" ry="120"></ellipse>
    <!--Анимация песка в нижнем сосуде-->
    <animate id="botS1" href="#botSand" attributeName="cy" calcMode="linear" from="580" to="415" dur="7.4s" begin="rotate__revers.end+1.5s;2s" fill="freeze" repeatCount="1"/>
    <animate id="botS2" href="#botSand" attributeName="rx" calcMode="linear" from="47.5" to="247.5" dur="7.4s" begin="rotate__revers.end+1.5s;2s" fill="freeze" repeatCount="1"/>
    <animate id="botS1_rev" href="#botSand" attributeName="cy" calcMode="linear" from="415" to="580" dur="0.0001s" begin="rotate.end" fill="freeze" repeatCount="1"/>
    <animate id="botS2_rev" href="#botSand" attributeName="rx" calcMode="linear" from="247.5" to="47.5" dur="0.0001s" begin="rotate.end" fill="freeze" repeatCount="1"/>
    </g>
    
    <rect class="top" x="175" y="70" fill="#F1AF31" width="263" height="21"></rect>
    
    <!--Песок пересыпается через горловину-->
    <line id="drip" fill="none" stroke="#F7E0B7" stroke-dashoffset="-186" stroke-dasharray="1, 1" stroke-width="2" stroke-miterlimit="10" x1="307" y1="275" x2="307" y2="275"></line>
    <!--start Меняем координаты в начале-->
    <animate id="drip02" href="#drip" attributeName="y2" calcMode="linear" values="275; 460;" dur="0.5s" begin="rotate__revers.end+1s;1.5s" fill="freeze" repeatCount="1"/>
    <animate id="drip02_rev" href="#drip" attributeName="y2" calcMode="linear" values="460; 275;" dur="0.0001s" begin="drip02.end+9.5s" fill="freeze" repeatCount="1"/>
    <!--end Меняем координаты в конце-->
    <animate id="drip01" href="#drip" attributeName="y1" calcMode="linear" values="275; 459;" dur="1s" begin="rotate__revers.end+8.8s;9.3s" fill="freeze" repeatCount="1"/>
    <animate id="drip01_rev" href="#drip" attributeName="y1" calcMode="linear" values="459; 275;" dur="0.0001s" begin="drip01.end+2s" fill="freeze" repeatCount="1"/>
    <!--Анимация песка, который пересыпается через горловину-->
    <animate id="drip1" href="#drip" attributeName="stroke-dashoffset" calcMode="linear" values="-186px; 186px; 0; 0; 0; 0; 0; 0; 0; -186px;" dur="10s" begin="rotate__revers.end;1s" fill="freeze" repeatCount="1"/>
    <animate id="drip2" href="#drip" attributeName="stroke-dasharray" calcMode="linear" values="1,86; 1,2; 1,1; 1,0; 1,0; 1,0; 1,0; 1,0; 1,0; 1,0; 1,0; 1,0; 1,86;" dur="10s" begin="rotate__revers.end;1s" fill="freeze" repeatCount="1"/>
    
    <path class="body" opacity="0.23" fill="#FFFFFF" d="M432.2,459H180.8c4.3-90,49.8-165,108.7-175.2c6.1-1,10.3-5.2,10.3-8.8c0-3-4.2-7.8-10.3-8.8C230.6,256,185.2,180.5,180.8,91h251.3c-4.3,89.6-49.7,166.3-108.8,175.2c-6,0.9-10.2,6.1-10.2,8.8c0,2.7,4.3,7.9,10.2,8.8C382.5,292.7,427.8,369,432.2,459z"></path>
    
    <!--Полоска верх-->
    <path id="topShadow" fill="#121212" d="M432.5,91h-252c0.3,4.1,0.8,8.8,1.4,14h249.3C432,98.3,432.2,95,432.5,91z" opacity="0.12"></path>
    <!--Анимация верхней полоски-->
    <animate id="topS" href="#topShadow" attributeName="opacity" calcMode="linear" from="0.12" to="0" dur="0.5s" begin="rotate.end-0.5s" fill="freeze" repeatCount="1"/>
    <animate id="topS_rot" href="#topShadow" attributeName="opacity" calcMode="linear" from="0" to="0.12" dur="0.001s" begin="rotate.end" fill="freeze" repeatCount="1"/>
    
    <!--Полоска низ-->
    <path id="botShadow" fill="#121212" d="M432.5,459h-252c0.3-4.1,0.8-8.8,1.4-14h249.3C432,451.7,432.2,455,432.5,459z" opacity="0"></path>
    <!--Анимация нижней полоски-->
    <animate id="botS" href="#botShadow" attributeName="opacity" calcMode="linear" from="0" to="0.12" dur="1s" begin="rotate.end-1s" fill="freeze" repeatCount="1"/>
    <animate id="botS_rot" href="#botShadow" attributeName="opacity" calcMode="linear" from="0.12" to="0" dur="0.0001s" begin="rotate.end+0.0001s" fill="freeze" repeatCount="1"/>
    
    <!--Отблеск справа-->
    <path id="rightShine" fill="#FFFFFF" d="M316.6,283.8c-5.2-1.2-8-6.1-8-8.8c0-2.7,2.8-7.5,8-8.8c58.6-14,105.6-87,106.5-175.2h-22.8c-3.6,85.6-38.3,168.8-102.8,177.2c0,0,8,0.7,8,6.8c0,6.2-8,6.8-8,6.8c64.5,8.3,99.2,91.6,102.8,177.2h22.8C422.3,370.8,375.3,297.8,316.6,283.8z" opacity="0.1"></path>
    <!--Анимация отблеска справа-->
    <animate id="rightS" href="#rightShine" attributeName="opacity" calcMode="linear" from="0.1" to="0.28" dur="1s" begin="rotate.end-1s" fill="freeze" repeatCount="1"/>
    <animate id="rightS_rot" href="#rightShine" attributeName="opacity" calcMode="linear" from="0.28" to="0.1" dur="0.0001s" begin="rotate.end+0.0001s" fill="freeze" repeatCount="1"/>
    
    <!--Отблеск слева-->
    <path id="leftShine" fill="#FFFFFF" d="M297,283.8c5.2-1.2,8-6.1,8-8.8c0-2.7-2.8-7.5-8-8.8c-58.6-14-105.6-87-106.5-175.2h22.8c3.6,85.6,38.3,168.8,102.8,177.2c0,0-8,0.7-8,6.8c0,6.2,8,6.8,8,6.8c-64.5,8.3-99.2,91.6-102.8,177.2h-22.8C191.4,370.8,238.4,297.8,297,283.8z" opacity="0.28"></path>
    <!--Анимация отблеска слева-->
    <animate id="leftS" href="#leftShine" attributeName="opacity" calcMode="linear" from="0.28" to="0.1" dur="1s" begin="rotate.end-1s" fill="freeze" repeatCount="1"/>
    <animate id="leftS_rot" href="#leftShine" attributeName="opacity" calcMode="linear" from="0.1" to="0.28" dur="0.0001s" begin="rotate.end+0.0001s" fill="freeze" repeatCount="1"/>
    
    <rect class="bottom" x="175" y="459" fill="#F1AF31" width="263" height="21"></rect>
    
    </g>
    
    </svg>

    计划在时间上尽可能地完全改变逻辑,并额外使用 CSS 来实现任务。但仅在计划中,因为问题中未指定此类要求。

    更新/

    修复了小错误。也:

    沙子飞溅,像codepen脚本的作者,我什至不尝试做。

    可以使用属性transform和属性播放“沙子飞溅”动画translate。下面是一个仅用于演示目的的快速示例。对于这个实现,只使用了上述属性之一,没有变得更复杂,主要目标是传达这个想法。

    body {
     width: 100%; min-height: 100vh; margin: 0; background: #4873a9;
     display: flex; flex-direction: column; justify-content: center; align-items: center;
    }
    <svg viewBox="0 0 600 600" width="600" height="600" xml:space="preserve">
    
    <defs>
    <circle id="grain" cx="0" cy="0" r="1" fill="#F7E0B7"></circle>
    
    <clipPath id="topMask">
    <path class="topMask" fill="#6D00BF" d="M316.7,266.3c-0.2,0.1-3.7,1.5-4.8,2.5c0,0,0,0,0,0.1c-1.8,1.5-3.2,4.5-3.2,7.1l-1.6,0l-1.4,0c0-2.6-1.4-5.6-3.2-7.1c0,0,0-0.1,0-0.1c-1.1-1-4.6-2.5-4.8-2.5C237.1,249.5,195,174,188,91h119h119.3C419.3,174,377.2,249.5,316.7,266.3z"></path>
    </clipPath>
    
    <clipPath id="botMask">
    <path class="botMask" fill="#6D00BF" d="M316.7,283.7c-0.2-0.1-3.7-1.5-4.8-2.5c0,0,0,0,0-0.1c-1.8-1.5-3.2-4.5-3.2-7.1l-1.6,0l-1.4,0c0,2.6-1.4,5.6-3.2,7.1c0,0,0,0.1,0,0.1c-1.1,1-4.6,2.5-4.8,2.5C237.1,300.5,195,376,188,459h119h119.3C419.3,376,377.2,300.5,316.7,283.7z"></path>
    </clipPath>
    
    </defs>
    
    <g id="allGrouped" transform-origin="306px 275px">
    
    <!--Трансформация часов-->
    <animateTransform id="rotate" href="#allGrouped" attributeType="xml" attributeName="transform" type="rotate" additive="replace" calcMode="linear" values="0; 180;" dur="1s" begin="drip1.end+1s" fill="freeze" repeatCount="1"/>
    <animateTransform id="rotate__revers" href="#allGrouped" attributeType="xml" attributeName="transform" type="rotate" additive="replace" values="180; 0;" dur="0.0001s" begin="rotate.end" fill="freeze" repeatCount="1"/>
    
    <!--Верхний сосуд-->
    <g clip-path="url(#topMask)">
    <rect id="topSand" x="0" y="90" fill="#F7E0B7" width="600" height="185"></rect>
    </g>
    <!--Анимация песка в верхнем сосуде-->
    <animate id="topS" href="#topSand" attributeName="y" calcMode="linear" from="90" to="280" dur="8s" begin="rotate__revers.end+1s;1.5s" fill="freeze" repeatCount="1"/>
    <animate id="topS_rev" href="#topSand" attributeName="y" calcMode="linear" values="80;90" dur="1s" begin="rotate.end" fill="freeze" repeatCount="1"/>
    
    <!--Нижний сосуд-->
    <g clip-path="url(#botMask)">
    <ellipse id="botSand" fill="#F7E0B7" cx="307.5" cy="580" rx="47.5" ry="120"></ellipse>
    <!--Анимация песка в нижнем сосуде-->
    <animate id="botS1" href="#botSand" attributeName="cy" calcMode="linear" from="580" to="415" dur="7.4s" begin="rotate__revers.end+1.5s;2s" fill="freeze" repeatCount="1"/>
    <animate id="botS2" href="#botSand" attributeName="rx" calcMode="linear" from="47.5" to="247.5" dur="7.4s" begin="rotate__revers.end+1.5s;2s" fill="freeze" repeatCount="1"/>
    <animate id="botS1_rev" href="#botSand" attributeName="cy" calcMode="linear" from="415" to="580" dur="0.0001s" begin="rotate.end" fill="freeze" repeatCount="1"/>
    <animate id="botS2_rev" href="#botSand" attributeName="rx" calcMode="linear" from="247.5" to="47.5" dur="0.0001s" begin="rotate.end" fill="freeze" repeatCount="1"/>
    </g>
    
    <rect class="top" x="175" y="70" fill="#F1AF31" width="263" height="21"></rect>
    
    <!--Песок пересыпается через горловину-->
    <line id="drip" fill="none" stroke="#F7E0B7" stroke-dashoffset="-186" stroke-dasharray="1, 1" stroke-width="2" stroke-miterlimit="10" x1="307" y1="275" x2="307" y2="275"></line>
    <!--start Меняем координаты в начале-->
    <animate id="drip02" href="#drip" attributeName="y2" calcMode="linear" values="275; 460;" dur="0.5s" begin="rotate__revers.end+1s;1.5s" fill="freeze" repeatCount="1"/>
    <animate id="drip02_rev" href="#drip" attributeName="y2" calcMode="linear" values="460; 275;" dur="0.0001s" begin="drip02.end+9.5s" fill="freeze" repeatCount="1"/>
    <!--end Меняем координаты в конце-->
    <animate id="drip01" href="#drip" attributeName="y1" calcMode="linear" values="275; 459;" dur="1s" begin="rotate__revers.end+8.8s;9.3s" fill="freeze" repeatCount="1"/>
    <animate id="drip01_rev" href="#drip" attributeName="y1" calcMode="linear" values="459; 275;" dur="0.0001s" begin="drip01.end+2s" fill="freeze" repeatCount="1"/>
    <!--Анимация песка, который пересыпается через горловину-->
    <animate id="drip1" href="#drip" attributeName="stroke-dashoffset" calcMode="linear" values="-186px; 186px; 0; 0; 0; 0; 0; 0; 0; -186px;" dur="10s" begin="rotate__revers.end;1s" fill="freeze" repeatCount="1"/>
    <animate id="drip2" href="#drip" attributeName="stroke-dasharray" calcMode="linear" values="1,86; 1,2; 1,1; 1,0; 1,0; 1,0; 1,0; 1,0; 1,0; 1,0; 1,0; 1,0; 1,86;" dur="10s" begin="rotate__revers.end;1s" fill="freeze" repeatCount="1"/>
    
    <path class="body" opacity="0.23" fill="#FFFFFF" d="M432.2,459H180.8c4.3-90,49.8-165,108.7-175.2c6.1-1,10.3-5.2,10.3-8.8c0-3-4.2-7.8-10.3-8.8C230.6,256,185.2,180.5,180.8,91h251.3c-4.3,89.6-49.7,166.3-108.8,175.2c-6,0.9-10.2,6.1-10.2,8.8c0,2.7,4.3,7.9,10.2,8.8C382.5,292.7,427.8,369,432.2,459z"></path>
    
    <!--Полоска верх-->
    <path id="topShadow" fill="#121212" d="M432.5,91h-252c0.3,4.1,0.8,8.8,1.4,14h249.3C432,98.3,432.2,95,432.5,91z" opacity="0.12"></path>
    <!--Анимация верхней полоски-->
    <animate id="topS" href="#topShadow" attributeName="opacity" calcMode="linear" from="0.12" to="0" dur="0.5s" begin="rotate.end-0.5s" fill="freeze" repeatCount="1"/>
    <animate id="topS_rot" href="#topShadow" attributeName="opacity" calcMode="linear" from="0" to="0.12" dur="0.001s" begin="rotate.end" fill="freeze" repeatCount="1"/>
    
    <!--Полоска низ-->
    <path id="botShadow" fill="#121212" d="M432.5,459h-252c0.3-4.1,0.8-8.8,1.4-14h249.3C432,451.7,432.2,455,432.5,459z" opacity="0"></path>
    <!--Анимация нижней полоски-->
    <animate id="botS" href="#botShadow" attributeName="opacity" calcMode="linear" from="0" to="0.12" dur="1s" begin="rotate.end-1s" fill="freeze" repeatCount="1"/>
    <animate id="botS_rot" href="#botShadow" attributeName="opacity" calcMode="linear" from="0.12" to="0" dur="0.0001s" begin="rotate.end+0.0001s" fill="freeze" repeatCount="1"/>
    
    <!--Отблеск справа-->
    <path id="rightShine" fill="#FFFFFF" d="M316.6,283.8c-5.2-1.2-8-6.1-8-8.8c0-2.7,2.8-7.5,8-8.8c58.6-14,105.6-87,106.5-175.2h-22.8c-3.6,85.6-38.3,168.8-102.8,177.2c0,0,8,0.7,8,6.8c0,6.2-8,6.8-8,6.8c64.5,8.3,99.2,91.6,102.8,177.2h22.8C422.3,370.8,375.3,297.8,316.6,283.8z" opacity="0.1"></path>
    <!--Анимация отблеска справа-->
    <animate id="rightS" href="#rightShine" attributeName="opacity" calcMode="linear" from="0.1" to="0.28" dur="1s" begin="rotate.end-1s" fill="freeze" repeatCount="1"/>
    <animate id="rightS_rot" href="#rightShine" attributeName="opacity" calcMode="linear" from="0.28" to="0.1" dur="0.0001s" begin="rotate.end+0.0001s" fill="freeze" repeatCount="1"/>
    
    <!--Отблеск слева-->
    <path id="leftShine" fill="#FFFFFF" d="M297,283.8c5.2-1.2,8-6.1,8-8.8c0-2.7-2.8-7.5-8-8.8c-58.6-14-105.6-87-106.5-175.2h22.8c3.6,85.6,38.3,168.8,102.8,177.2c0,0-8,0.7-8,6.8c0,6.2,8,6.8,8,6.8c-64.5,8.3-99.2,91.6-102.8,177.2h-22.8C191.4,370.8,238.4,297.8,297,283.8z" opacity="0.28"></path>
    <!--Анимация отблеска слева-->
    <animate id="leftS" href="#leftShine" attributeName="opacity" calcMode="linear" from="0.28" to="0.1" dur="1s" begin="rotate.end-1s" fill="freeze" repeatCount="1"/>
    <animate id="leftS_rot" href="#leftShine" attributeName="opacity" calcMode="linear" from="0.1" to="0.28" dur="0.0001s" begin="rotate.end+0.0001s" fill="freeze" repeatCount="1"/>
    
    <!--Брызги песка-->
    <g clip-path="url(#botMask)"> 
    <g id="grainGroup" transform="translate(307,0)" opacity="0">
    
    <use id="gr1" xlink:href="#grain" fill="#F7E0B7" width="1" height="1" x="0" y="0" transform="translate(0,0)"/>
    <use id="gr2" xlink:href="#grain" fill="#F7E0B7" width="1" height="1" x="0" y="0" transform="translate(0,0)"/>
    <use id="gr3" xlink:href="#grain" fill="#F7E0B7" width="1" height="1" x="0" y="0" transform="translate(0,0)"/>
    <use id="gr4" xlink:href="#grain" fill="#F7E0B7" width="1" height="1" x="0" y="0" transform="translate(0,0)"/>
    <use id="gr5" xlink:href="#grain" fill="#F7E0B7" width="1" height="1" x="0" y="0" transform="translate(0,0)"/>
    <use id="gr6" xlink:href="#grain" fill="#F7E0B7" width="1" height="1" x="0" y="0" transform="translate(0,0)"/>
    <use id="gr7" xlink:href="#grain" fill="#F7E0B7" width="1" height="1" x="0" y="0" transform="translate(0,0)"/>
    <use id="gr8" xlink:href="#grain" fill="#F7E0B7" width="1" height="1" x="0" y="0" transform="translate(0,0)"/>
    
    <animateTransform id="grG" href="#grainGroup" attributeType="xml" attributeName="transform" type="translate" additive="replace" values="307,460; 307,295" dur="7.4s" begin="rotate__revers.end+1.5s;2s" fill="freeze" repeatCount="1"/>
    <animate id="grG_op1" href="#grainGroup" attributeName="opacity" calcMode="linear" from="0" to="1" dur="0.0001s" begin="rotate__revers.end+1.6s;2.1s" fill="freeze" repeatCount="1"/>
    <animate id="grG_op0" href="#grainGroup" attributeName="opacity" calcMode="linear" from="1" to="0" dur="0.0001s" begin="rotate__revers.end+8.9s;9.4s" fill="freeze" repeatCount="1"/>
    
    <animateTransform id="grG1" href="#gr1" attributeType="xml" attributeName="transform" type="translate" additive="replace" values="0,0; 30,-12" dur="0.4s" begin="rotate__revers.end+1.5s;2s" fill="freeze" repeatCount="indefinite"/>
    
    <animateTransform id="grG2" href="#gr2" attributeType="xml" attributeName="transform" type="translate" additive="replace" values="0,0; -20,-10" dur="0.4s" begin="rotate__revers.end+1.6s;2.1s" fill="freeze" repeatCount="indefinite"/>
    
    <animateTransform id="grG3" href="#gr3" attributeType="xml" attributeName="transform" type="translate" additive="replace" values="0,0; 18,-15" dur="0.4s" begin="rotate__revers.end+1.7s;2.2s" fill="freeze" repeatCount="indefinite"/>
    
    <animateTransform id="grG4" href="#gr4" attributeType="xml" attributeName="transform" type="translate" additive="replace" values="0,0; -16,-12" dur="0.4s" begin="rotate__revers.end+1.8s;2.3s" fill="freeze" repeatCount="indefinite"/>
    
    <animateTransform id="grG5" href="#gr5" attributeType="xml" attributeName="transform" type="translate" additive="replace" values="0,0; -23,-5" dur="0.4s" begin="rotate__revers.end+1.9s;2.4s" fill="freeze" repeatCount="indefinite"/>
    
    <animateTransform id="grG6" href="#gr6" attributeType="xml" attributeName="transform" type="translate" additive="replace" values="0,0; 19,-11" dur="0.4s" begin="rotate__revers.end+2s;2.5s" fill="freeze" repeatCount="indefinite"/>
    
    <animateTransform id="grG7" href="#gr7" attributeType="xml" attributeName="transform" type="translate" additive="replace" values="0,0; -28,-8" dur="0.4s" begin="rotate__revers.end+2.1s;2.6s" fill="freeze" repeatCount="indefinite"/>
    
    <animateTransform id="grG8" href="#gr8" attributeType="xml" attributeName="transform" type="translate" additive="replace" values="0,0; 28,-12" dur="0.4s" begin="rotate__revers.end+2.2s;2.7s" fill="freeze" repeatCount="indefinite"/>
    
    </g>
    </g>
    
    <rect class="bottom" x="175" y="459" fill="#F1AF31" width="263" height="21"></rect>
    
    </g>
    
    </svg>

    • 6

相关问题

  • 具有非均匀背景的块内的渐变边框

  • 离开页脚

  • 如何将三个字段的数据收集到一封电子邮件中?

  • Html 元素刚从父元素中出来

  • 如何在css中制作这个背景?

  • 如何制作带有斜条纹的背景?

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    表格填充不起作用

    • 2 个回答
  • Marko Smith

    提示 50/50,有两个,其中一个是正确的

    • 1 个回答
  • Marko Smith

    在 PyQt5 中停止进程

    • 1 个回答
  • Marko Smith

    我的脚本不工作

    • 1 个回答
  • Marko Smith

    在文本文件中写入和读取列表

    • 2 个回答
  • Marko Smith

    如何像屏幕截图中那样并排排列这些块?

    • 1 个回答
  • Marko Smith

    确定文本文件中每一行的字符数

    • 2 个回答
  • Marko Smith

    将接口对象传递给 JAVA 构造函数

    • 1 个回答
  • Marko Smith

    正确更新数据库中的数据

    • 1 个回答
  • Marko Smith

    Python解析不是css

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5