Coder Social home page Coder Social logo

sebastienrousseau / sine-wave-generator Goto Github PK

View Code? Open in Web Editor NEW
13.0 1.0 2.0 563 KB

An enhanced sine wave generator tailored for web applications, offering advanced features for creating dynamic, visually captivating sine waves. Ideal for educational tools, music production software, and creative web projects.

Home Page: https://sine-wave-generator.com/

License: Apache License 2.0

JavaScript 71.68% HTML 28.32%
animation canvas javascript js sine-wave sinewave wave waves nodejs npm

sine-wave-generator's Introduction

Sine Wave Generator

sine-wave-generator.js

Banner for the Sine Wave Generator

An enhanced sine wave generator tailored for web applications, offering advanced features for creating dynamic, visually captivating sine waves. Ideal for educational tools, music production software, and creative web projects.

Installation

Install using npm for easy incorporation into your project:

npm install sine-wave-generator

Usage

import {SineWaveGenerator} from 'sine-wave-generator';

const waves = [/* array of Wave configs */];

const generator = new SineWaveGenerator({
  el: '#sineCanvas',
  waves
});

generator.start();

Examples

Check out the examples directory for a complete set of usage examples, including:

  • Basic single wave
  • Multiple waves configuration
  • Interactive mouse movement
  • Dynamic wave management

API

SineWaveGenerator(options)

Initializes the sine wave generator with the provided options.

options

Type: object

el

Type: HTMLElement|string

The canvas element or selector for the canvas.

waves

Type: Wave[]

Array of Wave instances to be animated.

Wave(config)

Represents a single wave configuration.

config

Type: object

Configuration object for the wave.

Instance Methods

.start()

Starts the animation of waves.

.stop()

Stops the animation of waves.

.addWave(config)

Adds a new wave to the animation.

.removeWave(index)

Removes a wave from the animation.

FAQ

What browsers are supported?

All modern browsers, including Chrome, Firefox, Safari, Edge. Falls back to 2D canvas.

How do I change the appearance of the waves?

You can customize the waves by changing their configuration options, such as amplitude, wavelength, speed, and strokeStyle.

Can I add interactivity to the waves?

Yes, the SineWaveGenerator supports mouse interaction to disturb the waves. You can also extend its functionality by adding event listeners to the canvas.

Changelog

Check out the CHANGELOG for the latest updates and changes to the project.

Acknowledgements

I would like to express my appreciation to sine-waves code repository and its creator, Isaac Suttell, for serving as an incredible source of inspiration.

Contributing

Pull requests welcome! Please check out the contribution guidelines.

License

Apache-2.0 © Copyright 2024 Sine Wave Generator. All rights reserved.

sine-wave-generator's People

Contributors

dependabot[bot] avatar sebastienrousseau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

geerlingguy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.