Skip to main content
Home

@ns/ha@0.2.1
Built and signed on GitHub Actions

You can use wave effects on WebSites

This package works with Browsers
This package works with Browsers
JSR Score
100%
Published
9 months ago (0.2.1)

@ns/ha | Hajs

Ha (波, means wave) is a JavaScript library to make wave.

Demo: https://nakasyou.github.io/ha

Usage

You can use JSR.

deno add @ns/ha
bunx jsr add @ns/ha
pnpx jsr add @ns/ha
yarn dlx jsr add @ns/ha
npx jsr add @ns/ha

You can do like this:

const closeWave = ha({}).do({
  target: document.getElementById('button') as HTMLButtonElement,
  waveDuration: 100, // milliseconds, wave speed
  gooutDuration: 100, // milliseconds, speed for going out
  color: '#aaa', // gray
  opacity: 0.5, // Opacity of wave
  pos: {
    clientX: 0
    clientY: 0
  }, // Position
})
setTimeout(() => closeWave(), 100) // You have to close wave manually.

Or, you can save settings when wave init:

const btnWave = wave({
  target: document.getElementById('button') as HTMLButtonElement,
  duration: 100, // milliseconds, speed
  color: '#aaa' // gray
})

btnWave.do({
  pos: ...
})

Extend it:

const redWave = btnWave.extend({
  color: 'red',
})

If you want to use it for buttons, you can use @ns/ha/events.

import { waveAsPointerDown } from '@ns/ha/events'

const mywave = ha({...})
document.getElementById('my-button')
  .addEventListener('pointerdown', waveAsPointerDown(mywave))

Examples

Example 1

import { ha } from '@ns/ha'

const close = ha({
  // ...
}).do({})
setTimeout(() => close(), 500)
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.