Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Animation 用另一条路径屏蔽SVG路径_Animation_Svg_Mask - Fatal编程技术网

Animation 用另一条路径屏蔽SVG路径

Animation 用另一条路径屏蔽SVG路径,animation,svg,mask,Animation,Svg,Mask,我有SVG路径实体,我想用其他虚线路径遮罩它。我有这个CSS .dashed{ stroke-dasharray: 5; } .path { stroke-dasharray: 852; stroke-dashoffset: 852; animation: dash 4s 1s linear forwards; } @keyframes

我有SVG路径实体,我想用其他虚线路径遮罩它。我有这个CSS

        .dashed{
          stroke-dasharray: 5;

        }
        .path {
          stroke-dasharray: 852;
          stroke-dashoffset: 852;
          animation: dash 4s 1s linear forwards;
        }
        @keyframes dash {
          to { 
            stroke-dashoffset: 0; 
          } 
        } 
SVG是这样的

<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="612px" height="792px" viewBox="0 0 612 792" enable-background="new 0 0 612 792" xml:space="preserve">
    <g transform="scale(1.7)">
        <path class="path" fill="none" stroke="#e31f1a" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.0" d="m 34.161514,227.15068 c 0,0 5.335031,41.13009 -10.338686,53.31427 -13.8827124,10.79193 -26.8802222,-16.84233 0.681739,-19.39738 52.917804,-4.90561 69.13065,91.87642 69.13065,91.87642"/>
    </g>

    <g transform="scale(1.71)">
        <path class="dashed" fill="none" stroke="black" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.5" d="m 34.161514,227.15068 c 0,0 5.335031,41.13009 -10.338686,53.31427 -13.8827124,10.79193 -26.8802222,-16.84233 0.681739,-19.39738 52.917804,-4.90561 69.13065,91.87642 69.13065,91.87642"/>
    </g>    
</svg>
不适合我。你知道路吗?

你不需要使用遮罩图像。这适用于需要使用掩码屏蔽HTML元素的情况

您应该只使用SVG元素。并在其中设置路径动画

.虚线{ 行程:5; } .路径{ 阵列:226; 行程偏移:226; 动画:短跑4s1s直线前进; } @关键帧破折号{ 到{ 笔划偏移:0; } }
你能检查一下这个问题吗
 mask-image: url(mask.svg);