Coder Social home page Coder Social logo

svg-spinners's Introduction

Wishlist now on Steam!

svg-spinners's People

Contributors

claviering avatar ephraimduncan avatar n3r4zzurr0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

svg-spinners's Issues

Use transform instead of height and y to improve performance

For those that are using height and y for animation, for ex bars-scale.svg, it can cause the browser to repaint, which is not good for performance.
The same animation effect can be achieved using the transform property instead.

<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
  <style>
    .spinner_jCIR {
      animation: spinner_B8Vq .9s linear infinite;
      animation-delay: -.9s;
      transform-origin: center;
      animation-timing-function: cubic-bezier(0.36, .61, .3, .98);
    }

    .spinner_upm8 {
      animation-delay: -.8s
    }

    .spinner_2eL5 {
      animation-delay: -.7s
    }

    .spinner_Rp9l {
      animation-delay: -.6s
    }

    .spinner_dy3W {
      animation-delay: -.5s
    }

    @keyframes spinner_B8Vq {

      0%,
      66.66% {
        transform: scaleY(1);
      }

      33.33% {
        transform: scaleY(1.8);
      }
    }
  </style>
  <rect class="spinner_jCIR" x="1" y="6" width="2.8" height="12" />
  <rect class="spinner_jCIR spinner_upm8" x="5.8" y="6" width="2.8" height="12" />
  <rect class="spinner_jCIR spinner_2eL5" x="10.6" y="6" width="2.8" height="12" />
  <rect class="spinner_jCIR spinner_Rp9l" x="15.4" y="6" width="2.8" height="12" />
  <rect class="spinner_jCIR spinner_dy3W" x="20.2" y="6" width="2.8" height="12" />
</svg>

Floating point parsing error in Firefox

Most of the animations don't work on Firefox (102 beta 6).
The error in the log for this example is:

Unexpected value .75s parsing dur attribute.

Apparently Firefox does not support decimal numbers without a leading digit, which might be standard-conforming and not a bug in Firefox. Fixing the number to read 0.75 immediately restores the animation for the example above.
I looked for a bit into the SVG specification and I found a statement related to the "dur" attribute format in this particular case:

Timecount-val ::= Timecount ("." Fraction)? (Metric)?

In other words, the decimal point, the fractional part and the metric are optional, but the first digit must always be present.

Licensing

what is the license of svg-spinners library?

would be good to know and also create a LICENSE file for everyone interested because this looks amazing

Spinner is off-center at zoom levels other than 100% in Safari

Here's a minimal reproduction. I tested this on the latest Safari (17.2) and confirmed that it's still an issue.

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Off-center spinner</title>
  <style>
    body {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      margin: 0;
    }

    .spinner_aj0A {
      transform-origin: center;
      animation: spinner_KYSC 0.75s infinite linear;
      fill: hsl(var(--muted-foreground));
    }

    @keyframes spinner_KYSC {
      100% {
        transform: rotate(360deg);
      }
    }
  </style>
</head>

<body>
  <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
    <path d="M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z" class="spinner_aj0A" />
  </svg>
</body>

</html>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.