MCPcopy Index your code
hub / github.com/crashmax-dev/twallpaper

github.com/crashmax-dev/twallpaper @2.1.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.1.2 ↗ · + Follow
70 symbols 184 edges 32 files 10 documented · 14%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

<h1 align="center">TWallpaper</h1>

🌈 Multicolor gradient wallpaper created algorithmically and shimmers smoothly.

GitHub Workflow Status npm npm npm bundle size

Features

Installation

npm install twallpaper
yarn add twallpaper
pnpm add twallpaper

Demo

You can play with twallpaper on twallpaper.js.org

Usage (vanilla)

import { TWallpaper } from 'twallpaper'
import 'twallpaper/css'

const container = document.querySelector('.tw-wrap')
const wallpaper = new TWallpaper(container, {
  colors: [
    '#dbddbb',
    '#6ba587',
    '#d5d88d',
    '#88b884'
  ]
})
wallpaper.init()

Edit twallpaper-typescript-example

React

npm install @twallpaper/react
yarn add @twallpaper/react
pnpm add @twallpaper/react
import { TWallpaper } from '@twallpaper/react'
import '@twallpaper/react/css'

export function App() {
  return (
    <TWallpaper
      options={{
        colors: [
          '#dbddbb',
          '#6ba587',
          '#d5d88d',
          '#88b884'
        ]
      }}
    />
  )
}

Edit twallpaper-react-example

Vue

npm install @twallpaper/vue
yarn add @twallpaper/vue
pnpm add @twallpaper/vue

Edit @twallpaper/vue

Using CDN


<script src="https://cdn.jsdelivr.net/npm/twallpaper@latest/dist/index.umd.js"></script>


<script src="https://unpkg.com/twallpaper@latest/dist/index.umd.js"></script>

API

.init(options?, container?)

Initialize animation (before reinitializing, calls the dispose() method).

options

Type: TWallpaperOptions

container

Type: Element

.animate(start?)

Start or stop animation.

start

Type: boolean\ Default: true

.dispose()

Destroy the instance wallpaper.

.scrollAnimate(start?)

Start or stop mouse scroll animation.

start

Type: boolean\ Default: false

.toNextPosition(onNext?)

Next animation position (animation turns off after use).

onNext

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

Options

KeyTypeDefaultDescription
colorsstring[]Array of colors in hex format. Allowed maximum of 4 colors.
fpsnumber30Animation speed.
tailsnumber90Tail speed animation.
animatebooleantrueAnimation is enabled.
scrollAnimatebooleanfalseAnimation is enabled when scrolling.
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#000Background color for the pattern image. Background does not work when pattern.mask is enabled.
pattern.sizestringautoSize of the pattern image.
pattern.blurnumber0Blur of the pattern image. Blur does not work when pattern.mask is enabled.
pattern.opacitynumber0.5Opacity of the pattern image.

Extension points exported contracts — how you extend this code

TWallpaperHandlers (Interface)
(no doc) [1 implementers]
packages/react/src/index.tsx
Rgb (Interface)
(no doc)
packages/twallpaper/src/colors.ts
Element (Interface)
(no doc)
website/src/index.ts
TWallpaperProps (Interface)
(no doc)
packages/react/src/index.tsx
Position (Interface)
(no doc)
packages/twallpaper/src/types.ts
RgbColor (Interface)
(no doc)
packages/twallpaper/src/types.ts
PatternOptions (Interface)
(no doc)
packages/twallpaper/src/types.ts
TWallpaperOptions (Interface)
(no doc)
packages/twallpaper/src/types.ts

Core symbols most depended-on inside this repo

updatePattern
called by 9
packages/react/src/index.tsx
init
called by 6
packages/twallpaper/src/twallpaper.ts
getPositions
called by 4
packages/twallpaper/src/twallpaper.ts
getPositions
called by 4
website/public/twallpaper-original.js
animate
called by 3
packages/react/src/index.tsx
updateColors
called by 3
packages/react/src/index.tsx
drawGradient
called by 3
packages/twallpaper/src/twallpaper.ts
dispose
called by 3
packages/twallpaper/src/twallpaper.ts

Shape

Method 31
Function 29
Interface 8
Class 2

Languages

TypeScript100%

Modules by API surface

packages/twallpaper/src/twallpaper.ts23 symbols
packages/react/src/index.tsx16 symbols
website/public/twallpaper-original.js11 symbols
website/src/index.ts7 symbols
packages/twallpaper/src/types.ts4 symbols
packages/twallpaper/src/colors.ts3 symbols
website/src/colors.ts2 symbols
packages/twallpaper/vite.config.ts1 symbols
examples/with-react/src/App.tsx1 symbols
examples/prefers-mask/src/index.ts1 symbols
examples/export-as-image/src/index.ts1 symbols

For agents

$ claude mcp add twallpaper \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact