animationController.forward() 中的 'from' 参数在 flutter 中究竟做了什么?

What exactly does the 'from' parameter in animationController.forward() do in flutter?

我很难理解 Tween class 的 begin 参数与 AnimationController lowerBound 参数之间到底有什么区别 class,以及代码片段中在 animationController 对象上调用的 forward() 函数的 from 参数。 哪个参数控制动画的哪个方面?提前致谢。

  Animation animation;
  AnimationController animationController;

  HomeScreenState();


  @override
  void initState() {
    super.initState();
    animationController = AnimationController(vsync: this,duration: Duration(seconds: 1),/*lowerBound,upperBound*/);
    animationController.addListener((){

      if(animationController.isCompleted){
        animationController.reverse();
      } else if(animationController.isDismissed){
        animationController.forward();
      }
      setState(() {

      });
    });
    animationController.forward(/*from:*/);
  }

  @override
  Widget build(BuildContext context) {

    animation = CurvedAnimation(parent: animationController, curve: Curves.easeInOut);
    animation = Tween(begin: -0.5,end: 0.5).animate(animation);
    //other code

AnimationController.forward的参数from用于想从当前位置以外的点播放动画

您可以将它与 youtube 视频的 ?t=timestamp 参数进行比较,后者允许在非常特定的时间开始播放视频。

不要与 Tween.begin 混淆,这对应于动画在动画开始时的样子