MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / animateOrSetProps

Function animateOrSetProps

libs/echarts/echarts-en.simple.js:17897–17933  ·  view source on GitHub ↗
(isUpdate, el, props, animatableModel, dataIndex, cb)

Source from the content-addressed store, hash-verified

17895}
17896
17897function animateOrSetProps(isUpdate, el, props, animatableModel, dataIndex, cb) {
17898 if (typeof dataIndex === 'function') {
17899 cb = dataIndex;
17900 dataIndex = null;
17901 }
17902 // Do not check 'animation' property directly here. Consider this case:
17903 // animation model is an `itemModel`, whose does not have `isAnimationEnabled`
17904 // but its parent model (`seriesModel`) does.
17905 var animationEnabled = animatableModel && animatableModel.isAnimationEnabled();
17906
17907 if (animationEnabled) {
17908 var postfix = isUpdate ? 'Update' : '';
17909 var duration = animatableModel.getShallow('animationDuration' + postfix);
17910 var animationEasing = animatableModel.getShallow('animationEasing' + postfix);
17911 var animationDelay = animatableModel.getShallow('animationDelay' + postfix);
17912 if (typeof animationDelay === 'function') {
17913 animationDelay = animationDelay(
17914 dataIndex,
17915 animatableModel.getAnimationDelayParams
17916 ? animatableModel.getAnimationDelayParams(el, dataIndex)
17917 : null
17918 );
17919 }
17920 if (typeof duration === 'function') {
17921 duration = duration(dataIndex);
17922 }
17923
17924 duration > 0
17925 ? el.animateTo(props, duration, animationDelay || 0, animationEasing, cb, !!cb)
17926 : (el.stopAnimation(), el.attr(props), cb && cb());
17927 }
17928 else {
17929 el.stopAnimation();
17930 el.attr(props);
17931 cb && cb();
17932 }
17933}
17934
17935/**
17936 * Update graphic element properties with or without animation according to the

Callers 2

updatePropsFunction · 0.70
initPropsFunction · 0.70

Calls 1

cbFunction · 0.70

Tested by

no test coverage detected