getAnimationTween method
MultiTween<AnimationProperty>
getAnimationTween({
- required Map<
AnimationProperty, dynamic> initialValues, - required double parentFontSize,
- required Size screenSize,
Implementation
MultiTween<AnimationProperty> getAnimationTween(
{required Map<AnimationProperty, dynamic> initialValues,
required double parentFontSize,
required Size screenSize}) {
MultiTween<AnimationProperty> multiTween = MultiTween<AnimationProperty>();
sequences.forEach((property, animationSequence) {
var animations = animationSequence.data;
dynamic begin, end;
begin =
initialValues[property] ?? animationPropertyDefaultInitMap[property];
for (int index = 0; index < animations.length; index++) {
Tween delayTween;
Tween tween;
switch (property) {
case AnimationProperty.opacity:
end = animations[index].value;
delayTween = Tween(begin: begin, end: begin);
tween = Tween(begin: begin, end: end);
break;
case AnimationProperty.alignment:
case AnimationProperty.transformAlignment:
case AnimationProperty.childAlignment:
end = animations[index].value;
delayTween = AlignmentTween(begin: begin, end: begin);
tween = AlignmentTween(begin: begin, end: end);
break;
case AnimationProperty.width:
case AnimationProperty.height:
end = (animations[index].value as Dimension);
delayTween = DimensionTween(begin: begin, end: begin);
tween = DimensionTween(begin: begin, end: end);
break;
case AnimationProperty.margin:
case AnimationProperty.padding:
end = (animations[index].value as EdgeInsets);
delayTween = EdgeInsetsTween(begin: begin, end: begin);
tween = EdgeInsetsTween(begin: begin, end: end);
break;
case AnimationProperty.backgroundDecoration:
case AnimationProperty.foregroundDecoration:
end = animations[index].value;
delayTween = DecorationTween(begin: begin, end: begin);
tween = DecorationTween(begin: begin, end: end);
break;
case AnimationProperty.shadows:
case AnimationProperty.insetShadows:
end = (animations[index].value as List).cast<ShapeShadow>();
delayTween = ListShapeShadowTween(begin: begin, end: begin);
tween = ListShapeShadowTween(begin: begin, end: end);
break;
case AnimationProperty.shapeBorder:
end = animations[index].value;
delayTween = MorphableShapeBorderTween(begin: begin, end: begin);
tween = MorphableShapeBorderTween(begin: begin, end: end);
break;
case AnimationProperty.transform:
end = animations[index].value.toMatrix4(screenSize: screenSize);
delayTween = Matrix4Tween(begin: begin, end: begin);
tween = Matrix4Tween(begin: begin, end: end);
break;
case AnimationProperty.textStyle:
end = (animations[index].value as DynamicTextStyle).toTextStyle(
parentFontSize: parentFontSize, screenSize: screenSize);
delayTween = TextStyleTween(begin: begin, end: begin);
tween = TextStyleTween(begin: begin, end: end);
break;
}
if (animations[index].delay.inMilliseconds > 0) {
multiTween.add(property, delayTween, animations[index].delay);
}
multiTween.add(property, tween, animations[index].duration,
animations[index].curve);
begin = end;
}
});
return multiTween;
}