npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

spin-wheel-game

v1.0.3-alpha.3

Published

Spin Wheel Game

Downloads

387

Readme

spin-wheel-game

A React component for a customizable and interactive spinning wheel game. This npm package provides a visually appealing and interactive spin wheel game that can be easily integrated into your React applications.

Demo

Check out the live demo to see the spin wheel game in action!

Installation

npm install spin-wheel-game

Usage

import React from 'react';
import { SpinWheel, ISpinWheelProps } from 'spin-wheel-game';

const segments = [
  { segmentText: 'Option 1', segColor: 'red' },
  { segmentText: 'Option 2', segColor: 'blue' },
  { segmentText: 'Option 3', segColor: 'green' },
  // Add more segments as needed
];

const MySpinWheel: React.FC = () => {
  const handleSpinFinish = (result: string) => {
    console.log(`Spun to: ${result}`);
    // Handle the result as needed
  };

  const spinWheelProps: ISpinWheelProps = {
    segments,
    onFinished: handleSpinFinish,
    primaryColor: 'black',
    contrastColor: 'white',
    buttonText: 'Spin',
    isOnlyOnce: false,
    size: 290,
    upDuration: 100,
    downDuration: 600,
    fontFamily: 'Arial',
    arrowLocation: 'top',
    showTextOnSpin: true,
    isSpinSound: true,
  };

  return <SpinWheel {...spinWheelProps} />;
};

export default MySpinWheel;

Props

  • segments: An array of objects representing the segments of the wheel. Each object should have a segmentText property, and optionally a segColor property for specifying the segment color.

  • onFinished: A callback function that will be called when the wheel stops spinning. It receives the result as a string.

  • primaryColor (optional): The primary color of the wheel. Default is 'black'.

  • contrastColor (optional): The contrast color used for text and needle. Default is 'white'.

  • buttonText (optional): The text displayed in the center button of the wheel. Default is 'Spin'.

  • isOnlyOnce (optional): A boolean indicating whether the wheel can be spun only once. Default is false.

  • size (optional): The size of the wheel in pixels. Default is 290.

  • upDuration (optional): The duration of the spin-up animation in milliseconds. Default is 100.

  • downDuration (optional): The duration of the spin-down animation in milliseconds. Default is 600.

  • fontFamily (optional): The font family used for text. Default is 'Arial'.

  • arrowLocation (optional): The location of the arrow on the needle, either 'center' or 'top'. Default is 'top'.

  • showTextOnSpin (optional): A boolean indicating whether to show the spun result text after spinning. Default is true.

  • isSpinSound (optional): A boolean indicating whether to play the spinning audio or not. Default is true.

Contributing

We welcome contributions to improve this project! Please check out our CONTRIBUTING.md file for guidelines on how to get started.

If you have any questions or need help, feel free to open an issue or reach out to the maintainers.

Thank you for your contributions!

License

This project is licensed under the MIT License - see the LICENSE file for details.