GIfatahTH / animator

A Flutter library that makes animation easer. It allows for separation of animation setup from the User Interface.
BSD 3-Clause "New" or "Revised" License
227 stars 28 forks source link

multiple fadeIn and FractionalTranslation animation #15

Closed pishguy closed 5 years ago

pishguy commented 5 years ago

how can i use multiple fadeIn and FractionalTranslation animation to show and hide widget like with below screen shot:

rect991

my implementation work but its not correct

return Container(
  child: Animator(
    tweenMap: {
      "opacity": Tween<double>(begin: 1, end: 0),
      "translation": Tween<Offset>(begin: Offset.zero, end: Offset(0,1))
    },
    cycles: 0,
    duration: Duration(milliseconds: 300),
    builderMap: (Map<String, Animation> anim) => FadeTransition(
      opacity: anim["opacity"],
      child: FractionalTranslation(
        translation: anim["translation"].value,
        child: child,
      ),
    ),
  ),
);
GIfatahTH commented 5 years ago

What do you mean by work but its not correct?

From what I understand from the picture, I think you are reversing the begin and end of tweens.

try this:

tweenMap: { "opacity": Tween(begin: 0, end: 1), "translation": Tween(begin: Offset(0, 1), end: Offset.zero) },

I see the you put cycles: 0. This means the the animation oscillate back and forth infinitely. Is the the behavior you want.

pishguy commented 5 years ago

@GIfatahTH thanks,

yes i know that