Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

addbackground

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

addbackground

Beautiful canvas backgrounds made easy.

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

addbackground

Beautiful canvas backgrounds made easy.

npm npm NPM

Installation

TypeSocket is available on npm, you can install it with either npm or yarn:

npm install addbackground
# or:
yarn install addbackground

Example usage

import { addBackground } from 'addbackground';

const canvas = document.getElementById('backgroundCanvas');
addBackground({ canvas, type: 'bubbles' });

API

addBackground

addBackground is the main function that adds a background to the selected canvas and keeps rendering it.

It accepts one argument of type BackgroundOptions and returns an instance of BackgroundControls.

BackgroundOptions

BackgroundOptions is an object that has the following properties:

PropertyDefault valueDescription
canvasundefinedCanvas element to render to. (required)
typeundefinedBackground type, currently: either 'ripples' or 'bubbles'. (required)
primaryColorrgba(255, 255, 255, 0.2)Primary color, accepts a CSS value..
secondaryColorrgba(0, 0, 0, 0.2)Secondary color, accepts a CSS value..
backgroundColortransparentBackground color, accepts a CSS value..

BackgroundControls

isPlaying: boolean

Returns the playback state of the animation.

setIsPlaying: (value: boolean) => void

Sets the playback state of the animation.

stop: () => void

Disassembles the animation, clears the canvas. Further playback is impossible after this function is called.

Keywords

FAQs

Package last updated on 24 Dec 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc