<!DOCTYPE html>
<html>
<head>
<style>
#frameDiv {
width: 400px;
height: 200px;
margin: 20px;
position: relative;
border: solid black 1px;
background-color: rgb(205, 242, 205);
}
img {
position: absolute;
z-index: 1;
width: 70px;
offset-path: path('M 50 100 L 350 100');
offset-rotate: 0.25turn;
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>使用“圈(turn)”单位的 offset-rotate 属性</h1>
<div id="frameDiv">
<img id="fish1" src="/i/css/fish.svg" alt="fish">
<svg fill="none" stroke="gray" stroke-width="2" stroke-dasharray="5,5">
<path d="M 50 100 L 350 100" />
</svg>
</div>
<p>鱼旋转了 0.25 圈,这相当于四分之一圈或 90 度。</p>
</body>
</html>