cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <svg viewBox="0 0 100 100" width="100%" height="100%">
  <defs>
    <marker id="start" viewBox="-5 -5 10 10"
            markerWidth="5" markerHeight="5">
      <circle r="4" fill="none" stroke="darkgray"/>
      <text font-size="8" dy="0.4em" 
            text-anchor="middle">S</text>
    </marker>
  </defs>
  <path id="p" d="M50 20
           Q80 0 70 30 T 70 70 T 30 70 T30 30Z"
        fill="none" stroke="gray" 
        marker-start="url(#start)"/>
  <circle r="4" fill="red" fill-opacity="0.7">
    <animateMotion id="forward" 
                   dur="10s" begin="0s"  fill="freeze"
                   keyPoints="0.3;1;0;0.3"
                   keyTimes="0;0.7;0.7;1"
                   calcMode="linear" >
      <mpath xlink:href="#p"/>
    </animateMotion>
    <animateMotion id="backward" 
                   begin="forward.end + 1s"
                   dur="10s" fill="freeze"
                   keyPoints="0.3;0;1;0.3"
                   keyTimes="0;0.3;0.3;1"
                   calcMode="linear" >
      <mpath xlink:href="#p"/>
    </animateMotion>
  </circle>
  <text font-size="5"><textPath xlink:href="#p" startOffset="30%" method="stretch" spacing="auto"><tspan dy="-2">Движение по замкнутому пути, начиная с произвольной его точки .</tspan></textPath>
  
</svg>
<p>В SVG1.1 нет специального способа задать смещение для  <code>&lt;animateMotion&gt;</code>. Однако, вы можете имитировать это поведение с помощью ключевых точек и моментов времени, мгновенно перескакивая с конечного значения на начальное.
</p>
<p>Математика для расчета <code>keyPoints</code> и <code>keyTimes</code> для движения вперед такова:
<code><dl>
  <dt>keyPoints</dt> 
    <dd>(startPosition)</dd>
    <dd>1</dd>
    <dd>0</dd>
    <dd>(startPosition)</dd>
  <dt>keyTimes</dt> 
    <dd>0</dd>
    <dd>(1 - startPosition)</dd>
    <dd>(1 - startPosition)</dd>
    <dd>1</dd>
</dl></code>
Для движения назад она такова:
<code><dl>
  <dt>keyPoints</dt> 
    <dd>(startPosition)</dd>
    <dd>0</dd>
    <dd>1</dd>
    <dd>(startPosition)</dd>
  <dt>keyTimes</dt> 
    <dd>0</dd>
    <dd>(startPosition)</dd>
    <dd>(startPosition)</dd>
    <dd>1</dd>
</dl></code>
  В обоих случаях <code>startPosition</code> &mdash; десятичная дробь от 0 до 1, представляющая собой относительную часть длины пути.  Вам также нужно явно задать <code>calcMode="linear"</code> для ключевых значений, чтобы эффект получился.
  </p>
  <p>Вот если бы еще текст мог переноситься с конца замкнутой траектории в её начало&hellip;</p>
            
          
!
            
              body, html {
  height: 100%;
}

@media (orientation: landscape) {
  svg {
    height: 100%;
    width: 70%;
    float: right;
    display: block;
  }
}
@media (orientation: portrait) {
  svg {
    height: 70%;
    width: 100%;
    display: block;
  }
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console