@zimi/prize-wheel-helper
v0.17.3
Published
prize wheel helper
Downloads
12
Readme
@zimi/prize-wheel-helper
@zimi/prize-wheel的 react 辅助函数
install
yarn add @zimi/prize-wheel-helper @zimi/prize-wheel
examples
import { PrizeWheel } from '@zimi/prize-wheel'
import { usePrizeWheelState } from '@zimi/prize-wheel-helper'
/**
* PrizeWheel 只负责逻辑部分,
* 渲染转盘由使用者自己负责,
* 因此可用于 react / vue / vanilla / node...
*/
const wheel = new PrizeWheel()
// in react
const { deg, running } = usePrizeWheelState(wheel)
// render your prize wheel with deg
CustomPrizeWheelRenderer(deg)
wheel.run()
wheel.shouldStopAtDeg(any degree)