New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

overlay-morph

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

overlay-morph

Multi-layered SVG shape overlays that are dynamically generated with adjustable properties are used in creating transitions in SPA or for designing drawer menus

latest
Source
npmnpm
Version
1.6.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

overlay-morph

overlay-morph is a lightweight library for creating multi-layered SVG overlays with animated transitions. It is ideal for dynamic scene transitions in SPAs or animated menu effects. The animation is fully customizable, allowing you to adjust timing, easing, and shape behavior.

npm GitHub package version NPM Downloads

2kB gzipped

Demo


Install

yarn add gsap
yarn add overlay-morph

Import

import { gsap } from 'gsap';
import OverlayMorph from 'overlay-morph';

Usage

const overlayMorph = new OverlayMorph({
  svgEl: '.svg',
  pathEl: '.svg path',
  ease: 'power1.inOut',
  isOpened: false,
  numberPoints: 6,
  delayPoints: 0.3,
  delayPaths: 0.25,
  duration: 1.5,
  mobilePointsCap: 3,

  // Performance/quality tuning (optional)
  precision: 0.1,
  lutSamples: 64,
  useLUT: true,
  renderStride: 1,
});

overlayMorph.init();

// later
await overlayMorph.entry();
await overlayMorph.leave();
await overlayMorph.toggle();

Options

OptionTypeDefaultDescription
svgElstring | SVGElementrequiredRequired. SVG container selector or element node.
pathElstringrequiredRequired. Selector for the <path> elements inside the SVG container.
numberPointsnumberDesktop: 4, Mobile: 3Number of animation points on each path (min 2). On small screens (max-width: 991px) the requested value is clamped by mobilePointsCap.
delayPointsnumber0.3Max random delay per point (quantized to frame).
delayPathsnumber0.25Delay between animation of each path.
durationnumber1Duration of point animation segment.
easestring'none'Timing function. See GSAP easing.
isOpenedbooleanfalseInitial state. Use toggle(), entry(), leave() to change it at runtime.
mobilePointsCapnumber3Maximum allowed value for numberPoints on small screens.
precisionnumberiOS: 0.2, others: 0.1Y rounding step in percent; internally snapped to tenths of percent (0.1%). Values below 0.1 behave like 0.1.
lutSamplesnumber64Samples for the ease LUT, when useLUT is enabled.
useLUTbooleaniOS: true, others: falseEnables LUT-based easing evaluation (reduces per-frame cost on mobile Safari).
renderStridenumber1Render every Nth update (integer ≥ 1). Use 2 to halve update frequency (approx. 30fps).

API

MethodDescription
init()Initializes the overlay with the given options. Idempotent.
toggle()Toggles between opened/closed. Returns a Promise<void> resolved on animation complete.
entry()Opens the overlay. Returns a Promise<void> resolved on animation complete.
leave()Closes the overlay. Returns a Promise<void> resolved on animation complete.
totalDuration()Returns the total duration of the current timeline in milliseconds.
stopTimelineIfActive()Stops the current animation timeline if active. Useful for cancelling or resetting animations.
destroy()Cleans up all setters, callbacks, and the timeline.

License

overlay-morph is released under MIT license.

Keywords

shape

FAQs

Package last updated on 27 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts