1.0.9 • Published 6 years ago

react-pulser v1.0.9

Weekly downloads
5
License
ISC
Repository
github
Last release
6 years ago

React-Pulser

Description

React component which displays an animated frequency graph. Adds a nice touch to audio playback UI's.

  • npm install --save react-pulser
import React, { Component } from 'react';
import Pulser from "react-pulser";
import "./index.css";

export default class App extends Component {
    constructor(props) {
        super(props);
        this.state = {
            playing: false
        }
        this.handleClick = this.handleClick.bind(this);
    }
    handleClick(e) {
        this.setState(prevState => {
            return {
                playing: !prevState.playing
            }
        })
    }
    render() {
        let { playing } = this.state
        return (
            <div className="app-wrapper">
                <button onClick={this.handleClick} >Play/Pause</button>
                <Pulser animate={playing} ></Pulser>
            </div>
        )
    }
}

react-pulser demo

  • NOTE: The <Pulser> component fills its parent container by default. Make sure it has a specified height and has position set to relative or it may not display. See the Props section below for more information on how to use custom styling.

Props:

NameTypeDefaultDescription
animatebooleanfalseToggles bar graph animation.
pulserStylesobject{}Style object for the outer container. Use this if you want to override the default CSS styling. You can also refer to the selector .pulser-wrapper in CSS.
barStylesobject{}Style object for individual bars. Use this if you want to override the default CSS styling. You can also refer to the selector .bar in CSS.
optionsobject{}The options prop is an object which contains several extra configuration settings. See below.
Options prop
let options = {
    barQuant: 7,
    minHeight: 15,
    changeRate: 5
}
<Pulser animate options={options}>
NameTypeDefaultDescription
barQuantnumber5Specifies number of bars to display.
minHeightnumber30Specifies the minimum initial height of each bar in terms of the percentage of its parent container. Must be between 0 and 30.
changeRatenumber15Specifies the number in milliseconds for how fast to animate.
1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

1.0.0

7 years ago