# redpacket **Repository Path**: github-29727412/redpacket ## Basic Information - **Project Name**: redpacket - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2021-11-08 - **Last Updated**: 2024-02-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 红包雨插件 > 一个基于 canvas 红包雨插件 ## Usage ``` import Stage,{Loader} from 'xxx' const canvas: any = document.getElementById('canvas') const stage = new Stage({ width: window.innerWidth,// 画布宽 height: window.innerHeight, // 画布高 target: canvas, // canvas 标签 images: [img,img], //红包图片 ---图片随机,位置随机,速度随机 gameTime: 30,// 游戏时间 }) // 开始游戏 stage.startGame() // 事件监听 'clickBox' | 'coundownTime' | 'gameOver' stage.on('clickBox',()=>{ }) // 销毁--vue,react等框架要销毁掉,否则会造成内存泄漏 stage.destory() stage = null ```