gpt4 book ai didi

html - 在 svg 行的路径上对文本进行对 Angular 线切割

转载 作者:太空宇宙 更新时间:2023-11-04 10:07:01 26 4
gpt4 key购买 nike

我需要对文本进行对 Angular 线切割。每当 svg 行移动到文本上方时,文本应该被对 Angular 切割。是否有可能实现这种场景。 ?下面是代码。以及我要实现的目标的图像。

<!DOCTYPE html>
<html>
<head><title></title>
<style type="text/css">
h1{
position: absolute;
top:0;
left: 10px;
}
</style>
</head>
<body>
<svg height="210" width="500">
<line x1="0" y1="0" x2="200" y2="200" style="stroke:rgb(255,0,0);stroke-width:2" />
<line x1="150" y1="150" x2="200" y2="200" style="stroke:rgb(0, 0, 153);stroke-width:2">
<animateTransform attributeName="transform"
type="translate"
values="200 200;-150 -150;200 200"
begin="0s"
dur="5s"
repeatCount="indefinite"
/>
</line>
</svg>
<h1>OUR<br>WORK</h1>


</body>
</html>

enter image description here

最佳答案

这是一个完全使用 SVG 的版本。

<html>
<head><title></title>
<style type="text/css">
h1{
position: absolute;
top:0;
left: 10px;
}
</style>
</head>
<body>
<svg height="210" width="500">
<line x1="0" y1="0" x2="200" y2="200" style="stroke:rgb(255,0,0);stroke-width:2" />
<line x1="150" y1="150" x2="200" y2="200" style="stroke:rgb(0, 0, 153);stroke-width:2">
<animateTransform attributeName="transform"
type="translate"
values="200 200;-150 -150;200 200"
begin="0s"
dur="5s"
repeatCount="indefinite"
/>
</line>
<defs>
<clipPath id="clip1">
<polygon points="0, 0 200, 200, 0, 200"/>
</clipPath>
<clipPath id="clip2">
<polygon points="0, 0 200, 0, 200, 200"/>
</clipPath>
</defs>
<text x="0" y="42" font-size="33px" font-weight="bold" clip-path="url(#clip1)">OUR<tspan x="0" dy="36">WORK</text>
<text x="4" y="38" font-size="33px" font-weight="bold" clip-path="url(#clip2)">OUR<tspan x="4" dy="36">WORK</text>
</svg>
</body>
</html>

关于html - 在 svg 行的路径上对文本进行对 Angular 线切割,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37915136/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com