# buuing/lucky-canvas

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/buuing-lucky-canvas).**

8,728 stars · 1,028 forks · TypeScript · Apache-2.0

## Links

- GitHub: https://github.com/buuing/lucky-canvas
- Homepage: https://100px.net
- awesome-repositories: https://awesome-repositories.com/repository/buuing-lucky-canvas.md

## Topics

`canvas` `javascript` `lucky-draw` `react` `taro` `uni-app` `vue`

## Description

Lucky Canvas is a canvas-based lottery component library that enables developers to build interactive prize wheels, grid-based lottery games, and slot machines for web and mobile applications. The project provides a rendering engine that draws directly on HTML Canvas elements, with automatic device pixel ratio scaling to ensure crisp displays on high-DPI mobile screens.

The library packages each lottery type as a self-contained plugin with its own configuration and rendering logic, and wraps the core canvas functionality in framework-specific bindings for Vue, React, Taro, and UniApp without duplicating game logic. Developers can assign configurable probability weights to each prize, control spin speed and acceleration through animation physics parameters, and attach callback functions that fire before a draw starts and after a prize is awarded.

The project supports creating configurable prize wheels with customizable segments, grid-based lottery games with custom cell positions and appearances, and slot machine games with configurable reels and spin direction. Each widget type offers programmatic draw triggers, prize odds configuration, and styling options for text and images within prize segments. The library can be installed via package managers and embedded into projects built with Vue, React, or Taro-based mobile apps.

## Tags

### User Interface & Experience

- [Lottery Widgets](https://awesome-repositories.com/f/user-interface-experience/home-screen-widgets/interactive-app-widgets/lottery-widgets.md) — Provides interactive prize wheels, grids, and slot machines as embeddable canvas components for web and mobile apps.
- [Lottery Game Widgets](https://awesome-repositories.com/f/user-interface-experience/lottery-game-widgets.md) — Provides the core canvas-based lottery game creation for wheels, grids, and slot machines. ([source](https://100px.net/usage/wx.html))
- [Canvas Components](https://awesome-repositories.com/f/user-interface-experience/canvas-components.md) — Provides a Canvas-based component for animated lottery draws with DPR-aware rendering for mobile devices.
- [Draw Lifecycle Hooks](https://awesome-repositories.com/f/user-interface-experience/component-hierarchies/widget-drawing-hierarchies/draw-lifecycle-hooks.md) — Ships callback hooks that fire before and after each lottery draw animation completes. ([source](https://100px.net/docs/wheel.html))
- [Multi-Framework Adapters](https://awesome-repositories.com/f/user-interface-experience/layout-utilities/presentation-engines/cross-platform-rendering-frameworks/multi-framework-adapters.md) — Wraps core Canvas logic in framework-specific bindings for Vue, React, Taro, and UniApp.
- [Lottery Draw Triggers](https://awesome-repositories.com/f/user-interface-experience/programmatic-triggers/lottery-draw-triggers.md) — Starts lottery spins and stops at specified prize indices via scripted method calls. ([source](https://100px.net/docs/grid.html))
- [Slot Machine Widgets](https://awesome-repositories.com/f/user-interface-experience/slot-machine-widgets.md) — Builds configurable slot-machine lottery games with Canvas for animated reel-based prize draws. ([source](https://100px.net/usage/uni.html))
- [Prize Wheel Renderers](https://awesome-repositories.com/f/user-interface-experience/wheel-list-rendering/prize-wheel-renderers.md) — Draws interactive lottery wheels on Canvas and spins them to select random prizes. ([source](https://100px.net/usage/js.html))
- [Prize Wheel Animations](https://awesome-repositories.com/f/user-interface-experience/wheel-pickers/prize-wheel-animations.md) — Provides configurable spin animation physics for lottery wheels, controlling speed and acceleration during draws. ([source](https://100px.net/docs/wheel.html))
- [Prize Wheel Creators](https://awesome-repositories.com/f/user-interface-experience/wheel-pickers/prize-wheel-creators.md) — Creates configurable spinning wheel lotteries with customizable prizes and backgrounds. ([source](https://100px.net/docs/wheel.html))
- [Prize Wheel Drawers](https://awesome-repositories.com/f/user-interface-experience/wheel-pickers/prize-wheel-drawers.md) — Draws configurable spinning wheel lottery games on Canvas for web and mobile. ([source](https://100px.net/usage/uni.html))
- [Prize Wheels](https://awesome-repositories.com/f/user-interface-experience/wheel-pickers/prize-wheels.md) — Provides spinning wheel lotteries with customizable prizes, colors, images, and probability weights.
- [React Prize Wheel Components](https://awesome-repositories.com/f/user-interface-experience/wheel-pickers/react-prize-wheel-components.md) — Ships a React component for configurable spinning-wheel lottery games with spin animations. ([source](https://100px.net/usage/react.html))
- [Vue Prize Wheel Components](https://awesome-repositories.com/f/user-interface-experience/wheel-pickers/vue-prize-wheel-components.md) — Ships a Vue component for configuring prize blocks and buttons on a canvas-based wheel. ([source](https://100px.net/usage/vue.html))
- [Canvas Animations](https://awesome-repositories.com/f/user-interface-experience/animation-and-motion-systems/configuration-utility-helpers/animation-properties/canvas-animations.md) — Manages spin speed, acceleration, and deceleration for wheel and slot machine animations with programmatic control.
- [Animation Physics](https://awesome-repositories.com/f/user-interface-experience/animation-and-motion-systems/physics-motion-dynamics/animation-physics.md) — Controls spin speed, acceleration, and deceleration via parameters for realistic wheel and slot-machine motion.
- [Prize Segment Stylings](https://awesome-repositories.com/f/user-interface-experience/content-rendering-components/image-overlays/text-overlays-on-images/prize-segment-stylings.md) — Sets font properties, colors, and images for each prize segment on the lottery wheel. ([source](https://100px.net/docs/wheel.html))
- [Async Prize Draw Triggers](https://awesome-repositories.com/f/user-interface-experience/file-inputs/programmatic-triggers/async-prize-draw-triggers.md) — Starts wheel animations programmatically and stops at specified prize indices after async results. ([source](https://100px.net/usage/vue.html))
- [Slot Machine Spin Controllers](https://awesome-repositories.com/f/user-interface-experience/slot-machine-spin-controllers.md) — Sets rotation speed, direction, and prize order for each reel in a slot machine. ([source](https://100px.net/docs/slot.html))
- [Slot Spin Triggers](https://awesome-repositories.com/f/user-interface-experience/slot-spin-triggers.md) — Triggers slot machines to begin spinning and stop at specified prize indices. ([source](https://100px.net/docs/slot.html))
- [Slot Machine Layout Configurations](https://awesome-repositories.com/f/user-interface-experience/widget-arrangement-systems/row-and-column-layouts/slot-machine-layout-configurations.md) — Configures global row and column spacing, spin mode, acceleration, and deceleration for slot machine games. ([source](https://100px.net/docs/slot.html))

### Business & Productivity Software

- [Grid Prize Configurations](https://awesome-repositories.com/f/business-productivity-software/prize-management-systems/grid-prize-configurations.md) — Provides configurable grid cells with custom positions, sizes, text, images, and win probabilities. ([source](https://100px.net/docs/grid.html))
- [Prize Odds Configuration](https://awesome-repositories.com/f/business-productivity-software/prize-management-systems/prize-odds-configuration.md) — Sets weighted odds for each prize item to control win likelihood in frontend or backend lottery logic.
- [Prize Odds Configurations](https://awesome-repositories.com/f/business-productivity-software/prize-management-systems/prize-odds-configurations.md) — Assigns configurable probability weights to each prize for controlling win likelihood. ([source](https://100px.net/docs/wheel.html))
- [Weighted Prize Odds](https://awesome-repositories.com/f/business-productivity-software/prize-management-systems/weighted-prize-odds.md) — Assigns configurable probability weights to each prize for controlled random selection during draws.
- [Taro Lottery Widget Embeddings](https://awesome-repositories.com/f/business-productivity-software/survey-feedback-tools/in-app-widget-embedding/taro-lottery-widget-embeddings.md) — Embeds wheel, grid, or slot-machine lottery components into Taro-based mobile apps. ([source](https://100px.net/usage/taro.html))

### Game Development

- [Prize Grids](https://awesome-repositories.com/f/game-development/grid-based-board-games/prize-grids.md) — Provides configurable grid lotteries where prize cells have custom positions, appearances, and win odds.
- [Slot Machine Games](https://awesome-repositories.com/f/game-development/slot-machine-games.md) — Provides slot-machine games with configurable reels, spin speed, direction, and prize order.
- [Slot Machine Prize Configurations](https://awesome-repositories.com/f/game-development/equipment-slot-definitions/slot-machine-prize-configurations.md) — Defines prize items, text, images, and visual styling for each slot in a spinning game. ([source](https://100px.net/docs/slot.html))

### Graphics & Multimedia

- [Prize Grid Renderers](https://awesome-repositories.com/f/graphics-multimedia/canvas-rendering/grid-rendering/prize-grid-renderers.md) — Renders configurable grid lottery games on Canvas for interactive prize selection. ([source](https://100px.net/usage/uni.html))
- [Lottery Game Widgets](https://awesome-repositories.com/f/graphics-multimedia/graphics-and-media/shape-drawing/interactive-canvas-drawing/lottery-game-widgets.md) — Provides interactive lottery games built on Canvas that support wheel, grid, and slot-machine prize draws.
- [Canvas Rendering Engines](https://awesome-repositories.com/f/graphics-multimedia/graphics-engines-rendering/rendering/engines/canvas-vector-graphics/canvas-rendering-engines.md) — Renders lottery games by drawing directly on an HTML Canvas element using TypeScript.
- [Cross-Platform Plugin Implementations](https://awesome-repositories.com/f/graphics-multimedia/audio-music/audio-plugin-architectures/cross-platform-plugin-implementations.md) — Integrates a single lottery canvas component across multiple frameworks including Vue, React, and WeChat Mini Programs.
- [Canvas Rendering](https://awesome-repositories.com/f/graphics-multimedia/canvas-rendering.md) — Automatically adjusts canvas clarity based on device pixel ratio for crisp lottery displays on mobile screens.

### Development Tools & Productivity

- [Device Pixel Ratio Management](https://awesome-repositories.com/f/development-tools-productivity/unit-converters/pixel-to-relative/device-pixel-ratio-management.md) — Automatically adjusts Canvas resolution based on device pixel ratio for crisp rendering on high-DPI screens.

### Software Engineering & Architecture

- [Lifecycle Callbacks](https://awesome-repositories.com/f/software-engineering-architecture/event-driven-callbacks/lifecycle-callbacks.md) — Fires user-defined callbacks at the start and end of each lottery draw lifecycle.
- [Plugin-Based Architectures](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/plugin-module-systems/modular-plugin-architectures/plugin-based-architectures/plugin-based-architectures.md) — Packages each lottery type as a self-contained plugin with its own configuration and rendering logic.
