0.1.8 • Published 11 months ago

roulette-image v0.1.8

Weekly downloads
-
License
BSD-2-Clause
Repository
-
Last release
11 months ago

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.

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!');

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.

0.1.8

11 months ago

0.1.7

11 months ago

0.1.6

11 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago