animationToJson function
Implementation
String animationToJson(HmsAnimation animation) {
switch (animation.type) {
case HmsAnimation.ALPHA:
return json.encode(
alphaAnimationToJson(animation as HmsAlphaAnimation),
);
case HmsAnimation.ROTATE:
return json.encode(
rotateAnimationToJson(animation as HmsRotateAnimation),
);
case HmsAnimation.SCALE:
return json.encode(
scaleAnimationToJson(animation as HmsScaleAnimation),
);
case HmsAnimation.TRANSLATE:
return json.encode(
translateAnimationToJson(animation as HmsTranslateAnimation),
);
}
throw ArgumentError(
'Please provide a valid animation type.',
);
}