1.0.1 • Published 2 years ago

scss-loading-animations v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

SCSS-Loading-Animations

A set of SCSS mixins for single element loaders and spinners

View examples

Getting started

npm install scss-loading-animations

OR

  1. Download the latest release.
  2. Copy src folder to your project.
  3. Import loaders.scss.
@import "./src/loaders";

Usage

Create a div with a class name of your choosing.

<div class="your-loader"></div>

In the SCSS for your class, include a mixin for a given loader. All loader examples are numbered. These numbers map to the mixin class name. For example, if you want to use loader01 from the examples page:

.your-loader {
    @include loader01;
}

Defaults

Default values for the loaders are in _variables.scss.

$loader-color: #0052ec;
$loader-size: 56px;
$loader-height: 20px;
$loader-border-size: 8px;
$loader-gap: 12px;
$loader-animation-duration: 1s;

You can override these default values in the mixin call:

@include loader09($size: 10px, $height: 48px, $gap: 8px, $duration: 1s, $align: middle);

All loaders can be also aligned to center, while including the mixin with parameter $align. $align: center is just for x axis, $align: middle is for both axes.

MIXIN PARAMETERS

ParameterTypeDefault value
$sizeNumber$loader-size
$heightNumber$loader-height
$border-sizeNumber$loader-border-size
$colorColor$loader-color
$durationTime$loader-animation-duration
$gapNumber$loader-gap
$alignKeywordnull

NOTE: Some loaders may not need $height and $gap parameters.

Performance issues

Some loaders which are using box-shadow for animation may be causing high cpu usage and lag, I'll need to look into more details and fix it, if it's possible.

ATTRIBUTION

This project is a continuation from SpinThatShit, which is no longer being maintained according to the author.