class MyApp extends StatelessWidget {

@override

Widget build(BuildContext context) {

return MaterialApp(

home: HomePage(),

);

}

}

class HomePage extends StatefulWidget {

@override

_HomePageState createState() => _HomePageState();

}

class _HomePageState extends State

with SingleTickerProviderStateMixin {

Tween _tween;

AnimationController _animationController;

@override

void initState() {

super.initState();

_animationController =

AnimationController(vsync: this, duration: Duration(seconds: 5))

…repeat();

_tween = Tween(begin: 0.0, end: 1.0);

}

Animation get animOne => _tween.animate(

CurvedAnimation(

parent: _animationController,

curve: Interval(

0.0,

0.125,

curve: Curves.linear,

),

),

);

Animation get animTwo => _tween.animate(

CurvedAnimation(

parent: _animationController,

curve: Interval(

0.125,

0.25,

curve: Curves.linear,

),

),

);

Animation get animThree => _tween.animate(

CurvedAnimation(

parent: _animationController,

curve: Interval(

0.25,

0.375,

curve: Curves.linear,

),

),

);

Animation get animFour => _tween.animate(

CurvedAnimation(

parent: _animationController,

curve: Interval(

0.375,

0.5,

curve: Curves.linear,

),

),

);

Animation get animFive => _tween.

《一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义》

【docs.qq.com/doc/DSmxTbFJ1cmN1R2dB】 完整内容开源分享

animate(

CurvedAnimation(

parent: _animationController,

curve: Interval(

0.5,

0.625,

curve: Curves.linear,

),

),

);

Animation get animSix => _tween.animate(

CurvedAnimation(

parent: _animationController,

curve: Interval(

0.625,

0.75,

curve: Curves.linear,

),

),

);

Animation get animSeven => _tween.animate(

CurvedAnimation(

parent: _animationController,

curve: Interval(

0.75,

0.875,

curve: Curves.linear,

),

),

);

Animation get animEight => _tween.animate(

CurvedAnimation(

parent: _animationController,

curve: Interval(

0.875,

1.0,

curve: Curves.linear,

),

),

);

@override

void dispose() {

super.dispose();

_animationController.dispose();

}

@override

Widget build(BuildContext context) {

final screenWidth = MediaQuery.of(context).size.width;

return Scaffold(

body: Center(

child: Row(

mainAxisAlignment: MainAxisAlignment.center,

children: [

new AnimatedBrick(

animations: [animOne, animTwo],

controller: _animationController,

marginLeft: 0.0,

alignment: Alignment.centerLeft,

isClockWise: true,

),

new AnimatedBrick(

animations: [animThree, animEight],

controller: _animationController,

marginLeft: 0.0,

isClockWise: false,

),

new AnimatedBrick(

animations: [animFour, animSeven],

controller: _animationController,

marginLeft: 30.0,

isClockWise: true,

),

new AnimatedBrick(

animations: [animFive, animSix],

controller: _animationController,

marginLeft: 30.0,

isClockWise: false,

),

],

),

),

);

}

}

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐