JSPM

  • Created
  • Published
  • Downloads 72
  • Score
    100M100P100Q76741F
  • License MIT

🌈 Multicolor gradient wallpaper created algorithmically and shimmers smoothly.

Package Exports

  • twallpaper
  • twallpaper/dist/twallpaper.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (twallpaper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme



TWallpaper

🌈 Multicolor gradient wallpaper created algorithmically and shimmers smoothly.

GitHub Workflow Status npm npm npm bundle size

Features

Browsers support

IE / Edge
Edge / IE
Firefox
Firefox
Chrome
Chrome
Safari
Safari
iOS Safari
iOS Safari
Opera
Opera
Yandex
Yandex
✔ , IE11 (partial)

Installation

# with npm:
npm install twallpaper

# or yarn:
yarn add twallpaper

Demo

You can play with twallpaper on twallpaper.js.org

Edit twallpaper-typescript-example Edit twallpaper-react-example

Usage

import { TWallpaper } from 'twallpaper'

const container = document.querySelector('.tw-wrap')
const wallpaper = new TWallpaper(container, { /* options */ })

Using CDN

<!-- JSDelivr  -->
<script src="https://cdn.jsdelivr.net/npm/twallpaper@latest/dist/twallpaper.js"></script>

<!-- UNPKG -->
<script src="https://unpkg.com/twallpaper@latest/dist/twallpaper.js"></script>

API

.init(options)

Re/initilize animation (before reinitializing, calls the dispose() method).

options

Type: TWallpaperOptions and Container

.animate(start?)

Start/stop animation.

start

Type: boolean
Default: true

.scrollAnimate(start?)

Start/stop mouse scroll animation.

start

Type: boolean
Default: false

.toNextPosition(callback?)

Next animation position (animation turns off after use).

callback

Execution toNextPosition is finished.
Type: function

.updateColors(colors)

Force update colors.

colors

Type: string[]

.updateFrametime(fps?)

Force update frametime.

fps

Type: number
Default: 30

.updatePattern(pattern)

Force update pattern options.

pattern

Type: PatternOptions

.updateTails(tails?)

Force update tails speed.

tails

Type: number
Default 90

.dispose()

Destroy the instance wallpaper.

Options

KeyTypeDefaultDescription
colorsstring[]Colors for gradient, use 1-4 full hex codes. This parameter is enough to make the fantastic gradient work.
fpsnumber30Frame time is just the time between frames.
tailsnumber90Tail speed animation.
animatebooleantrueThe main parameter responsible for the operation of the animation.
scrollAnimatebooleanfalseThe animation is tied to scrolling with the mouse wheel.
patternPatternOptionsPattern options.
pattern.imagestringWallpaper image. Use standard pattern or create your own.
pattern.maskbooleanfalseOption enables a mask for the background image using the mask-image css-property.
pattern.backgroundstring#000Specify the mask color in hex format. Background does not work when mask is enabled.
pattern.sizestringautoImage background size.
pattern.blurnumber0Applies to the pattern image. Blur does not work when mask is enabled.
pattern.opacitynumber0.5Applies to the pattern image.