<!DOCTYPE html>
<html>
<head>
<style>
#frameDiv {
width: 430px;
height: 180px;
margin: 20px;
position: relative;
border: solid black 1px;
background-color: rgb(205, 242, 205);
}
#circleDiv {
border: solid darkred 3px;
height: 10px;
width: 10px;
border-radius: 50%;
position: absolute;
z-index: 2;
box-sizing: border-box;
offset-path: path('M 50 80 C 150 -20 250 180 350 80');
animation: moveImg 5s 3;
}
img {
position: absolute;
width: 70px;
z-index: 1;
opacity: 0.5;
offset-path: path('M 50 80 C 150 -20 250 180 350 80');
offset-anchor: right center;
animation: moveImg 5s 3;
}
svg {
position: absolute;
height: 100%;
width: 100%;
left: 0;
top: 0;
}
@keyframes moveImg {
100% { offset-distance: 100%; }
}
</style>
</head>
<body>
<h1>The offset-anchor property</h1>
<div id="frameDiv">
<img src="/i/css/fish.svg" alt="fish">
<div id="circleDiv"></div>
<svg>
<path d="M 50 80 C 150 -20 250 180 350 80" fill="none" stroke="gray" stroke-width="2" stroke-dasharray="5,5"/>
</svg>
</div>
<p>这条鱼在图像元素的右中心点处被“锚定”到路径上。</p>
</body>
</html>