Skip to content

Commit ef209cc

Browse files
author
xuyingjun
committed
ReadMe
1 parent 733fc3c commit ef209cc

File tree

4 files changed

+256
-184
lines changed

4 files changed

+256
-184
lines changed

.idea/workspace.xml

Lines changed: 70 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 121 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,10 @@ about support widget
233233

234234
Widget|Description
235235
:--|:--:|
236-
Delay(timeDelay)|延长时间线,进入等待阶段
237-
Serial(Combine)|通过组合动画,达到通知播放的效果
236+
Delay|延长时间线,进入等待阶段
237+
Serial|通过组合动画,达到通知播放的效果
238238

239-
## For Example
239+
## For Example
240240

241241
**1、create timeLine**
242242

@@ -261,8 +261,8 @@ Widget makeWave(int before, int after) {
261261
),
262262
animatorSet: [
263263
Delay(duration: before),
264-
SY(from: 0.8, to: 1.6, duration: 200, delay: 0),
265-
SY(from: 1.6, to: 0.8, duration: 200, delay: 0),
264+
SY(from: 0.8, to: 1.6, duration: 200, delay: 0, curve: Curves.linear),
265+
SY(from: 1.6, to: 0.8, duration: 200, delay: 0, curve: Curves.linear),
266266
Delay(duration: after),
267267
],
268268
);
@@ -273,6 +273,7 @@ Widget makeWave(int before, int after) {
273273
* to:动画结束值
274274
* duration:动画时间
275275
* delay:真正执行动画的延时
276+
* curve:动画插值器
276277

277278
**3、convert to code**
278279

@@ -302,16 +303,130 @@ class YYWave extends StatelessWidget {
302303
**4、done**
303304

304305
<img src="./image/gif/1.gif" width="90px">
305-
<br />
306306

307307
## More
308308

309309
**1、组合动画**
310310

311+
> 缩放效果需要同时缩放X、Y轴
311312
313+
```dart
314+
animatorSet: [
315+
Serial(
316+
duration: 2000,
317+
serialList: [
318+
SX(from: 0.0, to: 1.0, curve: Curves.easeInOut),
319+
SY(from: 0.0, to: 1.0, curve: Curves.easeInOut),
320+
],
321+
),
322+
],
323+
```
312324

313325
**2、延时动画**
314326

327+
对真正做动画的时候处理delay属性
328+
329+
```dart
330+
class YYThreeLine extends StatelessWidget {
331+
@override
332+
Widget build(BuildContext context) {
333+
return Container(
334+
width: 40,
335+
height: 40,
336+
child: Row(
337+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
338+
children: <Widget>[
339+
makeLine(0),
340+
makeLine(50),
341+
makeLine(100),
342+
],
343+
),
344+
);
345+
}
346+
}
347+
348+
Widget makeLine(int delay) {
349+
return AnimatorSet(
350+
child: Container(
351+
color: Colors.white,
352+
width: 10,
353+
height: 5,
354+
),
355+
animatorSet: [
356+
TY(
357+
from: 0.0,
358+
to: 5.0,
359+
duration: 400,
360+
delay: delay,
361+
curve: Curves.fastOutSlowIn,
362+
),
363+
TY(
364+
from: 5.0,
365+
to: 0.0,
366+
duration: 400,
367+
curve: Curves.fastOutSlowIn,
368+
),
369+
],
370+
);
371+
}
372+
```
373+
374+
done
375+
376+
<img src="./image/gif/9.gif" width="90px">
377+
378+
**3、倒退动画**
379+
380+
动画可以播放完成后,通过animationType属性设置`AnimationType.reverse`,让动画接着倒退播放
381+
382+
```dart
383+
class YYFoldMenu extends StatelessWidget {
384+
@override
385+
Widget build(BuildContext context) {
386+
return Container(
387+
width: 40,
388+
height: 40,
389+
child: Column(
390+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
391+
children: <Widget>[
392+
makeFoldMenu(0, 40),
393+
makeFoldMenu(100, 26.0),
394+
makeFoldMenu(200, 12.0),
395+
],
396+
),
397+
);
398+
}
399+
}
400+
401+
Widget makeFoldMenu(int delay, double toY) {
402+
return AnimatorSet(
403+
animationType: AnimationType.reverse,
404+
child: Container(
405+
decoration: BoxDecoration(
406+
color: Colors.white,
407+
),
408+
width: 30,
409+
height: 10,
410+
),
411+
animatorSet: [
412+
Serial(
413+
duration: 2000,
414+
delay: delay,
415+
serialList: [
416+
TY(from: 0.0, to: toY, curve: Curves.elasticInOut),
417+
SX(from: 1.0, to: 0.1, curve: Curves.elasticInOut),
418+
SY(from: 1.0, to: 0.1, curve: Curves.elasticInOut),
419+
],
420+
),
421+
],
422+
);
423+
}
424+
```
425+
426+
done
427+
428+
<img src="./image/gif/20.gif" width="90px">
429+
315430
## Bugs/Requests
316431

317432
* If your application has problems, please submit your code and effect to Issue.

0 commit comments

Comments
 (0)