Giter Club home page Giter Club logo

three-dots's Introduction

Three Dots

Build Status npm license Financial Contributors on Open Collective

Three Dots is a set of CSS loading animations made with just single element. I think the project can not only enhance your CSS skills but also improve your imagination.

Installation

npm install three-dots --save

Usage

  1. Import the styles in your Sass file:
@use 'three-dots';
  1. Add just one div tag:
<div class="dot-elastic"></div>

Here’s the list of three-dots classes you can choose from:

dot-elastic
dot-pulse
dot-flashing
dot-collision
dot-revolution
dot-carousel
dot-typing
dot-windmill
dot-bricks
dot-floating
dot-fire
dot-spin
dot-falling
dot-stretching

Customization

Customize the dot's size ( color, spacing, etc. ) with Dart Sass API.

@use 'three-dots' with (
  $dot-width: 20px,
  $dot-height: 20px,
  ...
);

The available variables and their default values.

$dot-width: 10px;
$dot-height: 10px;
$dot-radius: $dot-width/2;

$dot-color: #9880ff;
$dot-bg-color: $dot-color;
$dot-before-color: $dot-color;
$dot-after-color: $dot-color;

$dot-spacing: $dot-width + $dot-width/2;

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

License

MIT

three-dots's People

Contributors

charltonsantana avatar dependabot[bot] avatar ed1nh0 avatar krishnahimself avatar monkeywithacupcake avatar nzbin avatar pszalko 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

three-dots's Issues

Can't have two different `dot-pulse` colors with Sass

My use case is to have two different colors of dot-pulse animation on the same page when extending Sass modules.
For example: I use white dot-pulse on dark background and blue dot-pulse on white.

The following code does not work:

.dot-primary-sm {
    $dot-width: 2px;
    $dot-height: 2px;
    $dot-spacing: 6px;
    $dot-color: $trgl-brand-color;

    @import '~three-dots/sass/three-dots';
}

.dot-white-sm {
    $dot-width: 2px;
    $dot-height: 2px;
    $dot-spacing: 6px;
    $dot-color: $white;

    @import '~three-dots/sass/three-dots';
}

I suppose the issue is caused by box-shadow property that overrides color in keyframe animation.

Color customization with js

It would be nice to implement something like a theme to be able to change the color from js, because it may be being used from vue, react, etc.

Deperacation warning using / for division in Sass

I have updated Sass compiler and now it prints deprecation warnings when compiling three-dots code:

DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($dot-width, 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

  ╷
7 │ $dot-radius: $dot-width/2 !default;
  │              ^^^^^^^^^^^^
  ╵
    node_modules/three-dots/sass/_variables.scss 7:14                       @import
    node_modules/three-dots/sass/three-dots.scss 4:9                        @import
    stdin 2:9                                                               root stylesheet

自定义样式支持 CSS Variables

我想将这个库加入我的vue 插件中,但是我遇到这么一个问题,颜色和大小等只能在编译时的Sass文件中定义好,如果我要在运行时修改样式(插件提供给用户配置),改变已经编译好的CSS就必须找到每种dots的样式依次覆盖它。

如果能加入原生的 CSS Variables ,那么我可以这样写

<div class="dot-elastic" style="--size:10px; --color: #FF0000; --spacing: 30px"></div>

当然,兼容性问题可以在 README 提示使用 css-vars-ponyfill

Color customization

Hi,

Is rebuilding whole project the only way to change dot colors? It tried to overwrite keyframes (in my case, the dot-pulse one) but it seems to change only middle dot color - the one before and after looks to stay violet. I cant see any other property I could change

Best regards

Introduce color+size system

Hi,

Would it be possible to introduce color and size system similar to bootstrap?
I mean the ...-color and ...-size classes for the three-dots component, just like at bootstrap colors page

I think it may be useful to use different colors/sizes of dots depending on the loader context.

I would see it as follow:

<div class="dot-flashing dot-primary dot-sm"></div>

Which would mean:

  • use dot-flashing animation
  • use primary color
  • use sm size

For Sass/Less users (Sass here!) it would be helpful too to introduce variables for each color/size.

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.