所以,如果你检查小提琴,(https://jsfiddle.net/xXnikosXx/6jx2rpsf/3/)我有一个 SVG 图像,有几个对象和一个面具。它掩盖了隐藏在其下方的文本(彩色线条),并计划对其顶部位置进行动画处理,使下方的文本出现,顶部的文本消失,以产生文本滚动效果。没有蒙版的文本如下图所示,以防万一。 在这里 我认为当动画发生时文本会出现,但它没有(如果你移除蒙版,文本会正确显示和动画,但它们的图层是错误的,所以文本出现在其他所有内容之上)
我想不出一种使用蒙版使文本正确动画的方法,有没有什么我可以使用而不是蒙版来获得相同的结果,但没有文本问题?
相关代码:
<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="354" y="174" width="733" height="344">
<rect id="laptop-screen-front" x="354" y="174" width="733" height="344" fill="white" />
</mask>
<g mask="url(#mask0)">
<!-- some of the lines that represent text: -->
<g id="text-lines">
<line id="Line 3" x1="408" y1="194.5" x2="433" y2="194.5" stroke="#E06C60" stroke-width="5" />
<line id="Line 23" x1="438" y1="194.5" x2="463" y2="194.5" stroke="#D18C4C" stroke-width="5" />
<line id="Line 35" x1="469" y1="194.5" x2="542" y2="194.5" stroke="#7BC379" stroke-width="5" />
<line id="Line 36" x1="469" y1="209.5" x2="525" y2="209.5" stroke="#7BC379" stroke-width="5" />
</g>