2.0.0 • Published 1 year ago

shape-overlays v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

npm GitHub package version NPM Downloads

1kB gzipped

Demo

Install

$ yarn add gsap
$ yarn add shape-overlays

Import

import gsap from 'gsap';
import ShapeOverlays from 'shape-overlays';

Usage

ShapeOverlays.registerGSAP(gsap);

const shapeOverlays = new ShapeOverlays({
  svgEl: '.svg',
  pathEl: '.path',
  numberPoints: 4,
  delayPoints: 0.3,
  delayPaths: 0.25,
  duration: 1,
  ease: 'power2.inOut',
});

shapeOverlays.init();

Options

OptionTypeDefaultDescription
svgElstring | HTMLElementnullRequired. SVG container selector.
pathElstring | HTMLElementnullRequired. Path selector.
numberPointsnumber4Number of animation points on each path.
delayPointsnumber0.3Delay between animation of each point on path.
delayPathsnumber0.25Delay between animation of each path.
durationnumber1Duration of animation.
easestring'none'Timing function. See gsap easing.

API

MethodDescription
toggle()Toggles the animation state between opened and closed.
entry()Sets the animation state to open.
leave()Sets the animation state to closed.
totalDuration()Returns the total duration of the animation in milliseconds.
init()Initializes the overlay with the given options.
destroy()Destroys the overlay instance, cleaning up any created elements and animations.
reinitialize(options)Reinitializes the overlay with new options.

License shape-overlays is released under MIT license.

2.0.0

1 year ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago