Categories: CSSScriptWeb Design

Generate Random SVG Waves Using JavaScript – wavery

wavery is a simple, lightweight JavaScript library to generate customizable waves using SVG and plain JavaScript.

Based on bezier-spline-js library to draw smooth curves passing through given points.

See also:

How to use it:

Sponsored

Load the core JavaScript wavery.min.js from the dist folder.

<script src="./dist/wavery.min.js"></script>

Create a container in which you’d like to draw the waves.

<div id="svg"></div>

Create a new Wavery instance and pass the configuration options as follows:

Sponsored
var wavery = new Wavery({
    width: 800,
    height: 600,
    segmentCount: 20,
    layerCount: 10,
    variance: 0.75, // Decimal value between 0 and 1
    strokeWidth: 0,
    strokeColor: "none",
    gradientColors: [
      {
        colorValue: "yellow",
        position: 0
      },
      {
        colorValue: "red",
        position: 0.5
      },
      {
        colorValue: "navy",
        position: 1
      }
    ]
});

Draw the waves in the container element you just created.

var svg = wavery.generateSvg();
var element = document.getElementById("svg");
element.appendChild(svg);

Changelog:

v1.0.8 (02/22/2026)

  • Removed DOM dependency.
  • Return svg xml string instead of svg element

The post Generate Random SVG Waves Using JavaScript – wavery appeared first on CSS Script.

rssfeeds-admin

Share
Published by
rssfeeds-admin

Recent Posts

Anthropic gives its retired Claude AI a Substack

In January, Anthropic "retired" Claude 3 Opus, which at one time was the company's most…

7 minutes ago

A Look Back, Feb. 26

50 Years Ago A number of area residents attended a slide presentation by the Northampton…

26 minutes ago

Photos: Steering toward service

Jameson Fournier,11, a member of the Western Mass 4-H Ox teamsters, leads his two steers,…

26 minutes ago

McGovern, Neal slam Trump’s State of the Union address

President Donald Trump addressed the nation in his State of the Union Tuesday night —…

26 minutes ago

Hadley schools face $754K shortfall; potential staff cuts

HADLEY — Significant reductions to teaching staff and education support professionals at the Hadley Elementary…

26 minutes ago

Photo: Snowblower fix

The post Photo: Snowblower fix appeared first on Daily Hampshire Gazette.

27 minutes ago

This website uses cookies.