1.1.1 • Published 6 years ago

svg-loader-es6 v1.1.1

Weekly downloads
3
License
GPL-3.0
Repository
github
Last release
6 years ago

SVG Loader ES6

A class to create customizable SVG loader with Vanilla ES6.

NPM GitHub package version npm Npm downloadsMaintenance GitHub last commit Open issuesBuild Status Sonar quality gate Code ClimateGreenkeeper badge Dependencies Status DevDependencies Status

| Complexity Cognitive Complexity | Open issues Code smells | Bugs Vulnerabilities | | :--- | :--- | :---- |


Installation

# Yarn
yarn add --exact svg-loader-es6

# NPM
npm install --save --save-exact svg-loader-es6

Usage

Somewhere in your document:

<div id="your-container-id" />

Then in your javascript :

  • Import:
import { SVGLoader } from 'svg-loader-es6';
  • Instantiate:
new SVGLoader( {
  containerId: 'your-container-id'
} )

Settings

The constructor can accept more keys in the object as parameters.

OptionTypeDefaultDescription
containerIdString"loader-container"Required - The id of the element that will contain the SVG element
svgIdString"loader"The id given to the created SVG element
nbRectsint3Number of rectangle shapes in the SVG
marginint2Margin between the shapes (in px)
fillString (Hex, RGB, RGBA)"#000000"Color of the shapes in the SVG
sizeint15Height and width of each shape (rectangle) of the SVG (in px)
radiusint2Value of the border radius of each rectangle shape of the SVG (in px)
minOpacityNumber0.25Opacity to give to each shapes at the begin of the animation
maxOpacityNumber0.75Opacity to give to each shapes at the end of the animation
durationint1000Duration of the animation of each shape from minOpacity to maxOpacity (in ms)

Properties of an instance

PropertyTypeDescription
settingsObjectThe current options of the SVGLoader instance (read-only)
defaultOptionsObjectThe default options for settings if there's no settings given to the constructor. This is a static method, so call it as follows: SVGLoader.defaultProperties

Methods

PropertyParametersDefaultDescription
toggle--Hide or show the SVG Element
show--Show the SVG Element
hide--Hide the SVG Element
destroy--Remove the SVG element from DOM and delete all properties or listeners

Demo

A complete demo is available here

The source code of the demo is here

Use the settings generator here

Contributing

The dashboard with CI and code quality indicators

1.1.1

6 years ago

1.1.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.3

6 years ago

0.0.1

6 years ago