roulette-image
TypeScript icon, indicating that this package has built-in type declarations

0.1.8 • Public • Published

Roulette Image

This package provides functionality to create roulette images and GIFs. It utilizes the @napi-rs/canvas package for creating and manipulating images, and @skyra/gifenc for generating GIFs.

Powered by Shuruhatik

Installation

To install roulette-image, run the following command:

# NPM
npm add roulette-image
# Bun.js
bun add roulette-image
# Yarn
yarn add roulette-image

Usage

Import the required methods from the package:

import { createRouletteGifImage } from 'roulette-image';

Method: createRouletteGifImage

This method generates a GIF image of a rotating roulette wheel with sectors.

async function createRouletteGifImage(sectors: any[], return_stream = false): Promise<any>
  • sectors: An array containing the sectors of the roulette wheel.
  • return_stream (optional): If set to true, the method will return a readable stream of the GIF image. Default is false.
  • Returns: A Promise that resolves to the generated GIF image.

Example usage:

const sectors = [
  { number: 0, username: 'User1', color: '#FF0000', avatarURL: 'https://example.com/avatar1.png' },
  { number: 1, username: 'User2', color: '#00FF00', avatarURL: 'https://example.com/avatar2.png' },
  // Add more sectors...
];

const gifBuffer = await createRouletteGifImage(sectors);

await fs.promises.writeFile("roulette.gif", gifBuffer);
console.log('File saved successfully!');
  • Example of an animated roulette image:

https://imgur.com/uL65Qm5

Sponsors

  • Love what I do? Send me some coffee !?
  • Can't send coffees? Your support will help me to continue working on open-source projects like this. 🙏😇

Help

If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official Discord Server .

License

Refer to the LICENSE file.

Package Sidebar

Install

npm i roulette-image

Weekly Downloads

17

Version

0.1.8

License

BSD-2-Clause

Unpacked Size

8.24 MB

Total Files

13

Last publish

Collaborators

  • shuruhatik