1.2.1 • Published 9 months ago

shape-overlays v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

npm GitHub package version NPM Downloads

800B gzipped

Installation

ShapeOverlays requires GSAP library to work.

$ yarn add gsap
$ yarn add shape-overlays

Import

Import GSAP, ShapeOverlays and initialize it.

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

ShapeOverlays.registerGSAP(gsap)

const overlay = new ShapeOverlays({
	svgClassName: '.svg-overlay',
	pathClassName: '.svg-overlay path'
})

Options

You can configure ShapeOverlays via options.

const overlay = new ShapeOverlays({
	svgClassName: '.svg-overlay',
	pathClassName: '.svg-overlay path',
	numberPoints: 4,
	delayPoints: 0.3,
	delayPaths: 0.25,
	duration: 1,
	ease: 'power2.inOut'
})
OptionTypeDefaultDescription
svgClassNamestring | HTMLElementnullRequired. SVG container selector.
pathClassNamestring | 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
overlay.toggle()Toggles the animation state between human and closed.
overlay.entry()Sets the animation state to open.
overlay.leave()Sets the animation state to closed.
overlay.totalDuration()Returns the total duration of the animation in milliseconds.

License

shape-overlays is released under MIT license.

1.2.1

9 months ago

1.2.0

9 months ago

1.1.0

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago

0.8.0

10 months ago

0.7.0

10 months ago

0.6.0

10 months ago

0.5.0

10 months ago

0.4.0

10 months ago

0.2.0

10 months ago

0.1.0

10 months ago

0.0.1

10 months ago