WEB骇客
<!-- Port of animateMotion example https://www.w3.org/TR/SVG/animate.html#AnimateMotionElement -->
<svg width="5cm" height="3cm"  viewBox="0 0 500 300"
     xmlns="https://www.w3.org/2000/svg" version="1.1"
     xmlns:xlink="https://www.w3.org/1999/xlink" >
  <rect x="1" y="1" width="498" height="298"
        fill="none" stroke="blue" stroke-width="2" />
  <path id="path1" d="M100,250 C 100,50 400,50 400,250"
        fill="none" stroke="blue" stroke-width="7.06"  />
  <circle cx="100" cy="250" r="17.64" fill="blue"  />
  <circle cx="250" cy="100" r="17.64" fill="blue"  />
  <circle cx="400" cy="250" r="17.64" fill="blue"  />
  <!-- Here is a triangle which will be moved about the motion path.
       It is defined with an upright orientation with the base of
       the triangle centered horizontally just above the origin. -->
  <path id="triangle" d="M-25,-12.5 L25,-12.5 L 0,-87.5 z"
        fill="yellow" stroke="red" stroke-width="7.06"  >
     
  </path>
  
</svg>
@keyframes sweep {
  from {
    motion-offset: 0%;
  }
  to { 
    motion-offset: 100%;
  }
}

#triangle {
    motion-path: path('M100,250 C 100,50 400,50 400,250');
    motion-rotation: auto;
    animation-name:             sweep; 
    animation-duration:         6s; 
    animation-iteration-count:  infinite;
    transition-timing-function: linear;
}
返回