]> git.ardis.lu - css-loaders/commitdiff
Add SVG animations
authorArdis Lu <ardisglu@gmail.com>
Thu, 10 Mar 2022 07:51:23 +0000 (23:51 -0800)
committerArdis Lu <ardisglu@gmail.com>
Thu, 10 Mar 2022 07:51:23 +0000 (23:51 -0800)
index.html

index 582cc260363864825b53a9dca62c929bcb4e7f1d..10dbe5eded94917a08fd7deb361d33f453811d53 100644 (file)
       animation: spin 0.2s linear 1;
     }
 
+    /* SVG animations */
+
+    .squiggly-line {
+      display: block;
+      block-size: 24px;
+      inline-size: 100%;
+    }
+
+    .bricks {
+      display: block;
+      block-size: 155px;
+      inline-size: 100%;
+    }
+
     /* Dividers */
 
     @keyframes shiftRight {
       </p>
     </section>
 
+    <section>
+      <h1>SVG animations</h1>
+
+      <p>Squiggly line:</p>
+      <svg class="squiggly-line">
+        <defs>
+          <pattern id="squiggle" width="24" height="24" patternUnits="userSpaceOnUse">
+            <path d="M0,12 Q6,0 12,12 Q18,24 24,12" fill="none" stroke="#000" />
+          </pattern>
+        </defs>
+        <rect width="100%" height="100%" fill="url(#squiggle)">
+          <animateTransform attributeName="transform" type="translateX" from="0" to="24" dur="1s"
+            repeatCount="indefinite" />
+        </rect>
+        <rect width="24" height="100%" fill="url(#squiggle)">
+          <animateTransform attributeName="transform" type="translateX" from="-24" to="0" dur="1s"
+            repeatCount="indefinite" />
+        </rect>
+      </svg>
+
+      <p>Bricks:</p>
+      <svg class="bricks">
+        <defs>
+          <pattern id="brick" width="42" height="44" patternUnits="userSpaceOnUse">
+            <path d="M0,0 H42V44H0V0 M42,1 H1V22H42 M0,23 H21V44H0 M42,23 H22V44H42" fill="#000" fill-rule="evenodd" />
+          </pattern>
+        </defs>
+        <rect width="100%" height="100%" fill="url(#brick)">
+          <animateTransform attributeName="transform" type="translateX" from="0" to="42" dur="1s"
+            repeatCount="indefinite" />
+        </rect>
+        <rect width="42" height="100%" fill="url(#brick)">
+          <animateTransform attributeName="transform" type="translateX" from="-42" to="0" dur="1s"
+            repeatCount="indefinite" />
+        </rect>
+      </svg>
+    </section>
+
     <section>
       <h1>Dividers</h1>
 
This page took 0.036564 seconds and 4 git commands to generate.