1.1.5 • Published 5 months ago

roulette-gif v1.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

roulette-gif Logo

roulette-gif

This is a node.js package that allows you to make a roulette gif image as easy as possible

Installation

$ npm install roulette-gif
$ yarn add roulette-gif

Features

  • Simple & easy to use
  • You can edit everything in the wheel

Support

Join our support server for any question HL Services

Getting Started

At first you need to install the package

const { Wheel } = require('roulette-gif')
const wheel = new Wheel()

let slots = [
  {
    username: "Zaid",
    number: 1,
    image: 'Some avatar url'  // Must be png or any supported image by canvas
  },
  {
    username: "Ahmed",
    number: 2,
    image: 'Some avatar url'
  },
]

let { 
  buffer, 
  winner, 
  lastFrame 
} = await wheel.createGif({
  slots,
  stream: false, // Set it to true if you want to return stream insted of buffer
  wheelStroke: {
    color: '#fff',
    width: 5
  },
  slotStroke: {
    color: '#fff',
    width: 5
  },
  imageStroke: {
    color: '#fff',
    width: 5
  },
  winnerSlotColor: 'Gold'
})

You can use the buffer to send the roulette gif or save it and if you want to get a stream insted of buffer you can use stream: true The lastFrame variable is a buffer of the last image in the gif The winner variable returns the winner slot

Options

VariableRequiredDefaultDescriptionType
streamfalsefalseChoice to return a buffer or streamBoolean
slotstruenullThe slots array of the usersArray
wheelStrokefalse{ width: 0, color: '#fff' }The stroke object of the wheelObject
slotStrokefalse{ width: 0, color: '#fff' }The stroke object of the slotObject
imageStrokefalse{ width: 0, color: '#fff' }The stroke object of the center imageObject
winnerSlotColorfalseSlot ColorChange the winner slot colorColor
textfalse{ color: '#fff', size: 14 }The text optionsObject
arrowfalseSimple arrowUse url image to change the wheel arrowURL Image

Examples

  • Send the wheel in discord
let { buffer, winner } wheel.createGif({ 
  slots
})

<Interaction | Channel>.send({ 
  files: [{ attachment: buffer, name: "roulette.png" }],
  content: `Congratulations ${winner.username} 🎉 you won`
})
  • Custom arrow
wheel.createGif({
  slots,
  arrow: 'https://example.com/arrow.png'
})
  • Custom wheel stroke
wheel.createGif({
  slots,
  wheelStroke: {
    color: 'red', // You can use hexCodes here
    width: 5
  }
})
  • Custom slot stroke
wheel.createGif({
  slots,
  slotStroke: {
    color: 'purple', // You can use hexCodes here
    width: 5
  }
})
  • Custom image stroke
wheel.createGif({
  slots,
  imageStroke: {
    color: 'green', // You can use hexCodes here
    width: 5
  }
})
  • Custom text
wheel.createGif({
  slots,
  text: {
    color: 'blue', // You can use hexCodes here
    size: 10
  }
})

Developer

1.1.1

5 months ago

1.1.5

5 months ago

1.1.4

5 months ago

1.1.3

5 months ago

1.1.2

5 months ago

1.1.0

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago