jdchi / flutter-grid-lottery Goto Github PK
View Code? Open in Web Editor NEW用Flutter实现一个九宫格抽奖 A simple grid lottery widget on Flutter
用Flutter实现一个九宫格抽奖 A simple grid lottery widget on Flutter
你好,我现在有新的需求。我现在抽奖界面是7x8的方格,现在是想让抽奖的动画是从上次中奖的位置开始,然后根据移动的步数计算新的中奖位置
` Animation _initSelectIndexTween(
{int begin = 0, int end = 0, Curve curve = Curves.linear}) =>
StepTween(begin: StorageManager.getDiceTarget(), end: end).animate(
CurvedAnimation(parent: _startAnimateController, curve: curve));
_startActualAnimation() {
// _selectedIndexTween = _initSelectIndexTween(
// end: widget.controller.value.repeatRound * _totalIndex +
// widget.controller.value.target,
// curve: Curves.easeOutCubic);
int end = widget.controller.value.target % _totalIndex;
print('真的抽奖动画目标=='+ end.toString());
_selectedIndexTween = _initSelectIndexTween(end: end,curve: Curves.easeOutCubic);
_startAnimateController
..reset()
..duration = widget.controller.value.duration
..forward();
}`
其中_totalIndex = 26;repeatRound = 0;
StepTween(begin: StorageManager.getDiceTarget(), end: end),begin 是本地存储上次中奖的位置。end 是计算的新的中奖位置。从0 到25的动画是正常顺时针转的,但是从25到1的动画却是逆时针转的。就是在转满一圈的时候不知道要怎么处理。
https://github.com/cw0925/Flutter-Grid-Lottery.git,可以看下这个
你好,想问下重置奖项要怎么做。就是抽完奖后,抽奖界面九宫格的内容要改变。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.