自定义动画

    • 按需引用需要的动画执行函数。
    • 帮助用户自定义动画执行函数。
    1. // Step 1: 定义动画执行函数
    2. function fadeIn(
    3. shape: IShape | IGroup,
    4. animateCfg: AnimateCfg,
    5. cfg: AnimateExtraCfg,
    6. ) {
    7. fillOpacity: isNil(shape.attr('fillOpacity'))
    8. ? 1
    9. strokeOpacity: isNil(shape.attr('strokeOpacity'))
    10. ? 1
    11. : shape.attr('strokeOpacity'),
    12. opacity: isNil(shape.attr('opacity')) ? 1 : shape.attr('opacity'),
    13. };
    14. shape.attr({
    15. fillOpacity: 0,
    16. strokeOpacity: 0,
    17. });
    18. }
    19. // Step 2: 注册动画执行函数
    20. registerAnimation('fadeIn', fadeIn);
    21. // Step 3: 使用
    22. chart.interval().animate({
    23. appear: {
    24. animation: 'fadeIn',

    API 链接