MCPcopy
hub / github.com/apache/echarts / animateOrSetProps

Function animateOrSetProps

src/animation/basicTransition.ts:127–199  ·  view source on GitHub ↗
(
    animationType: 'enter' | 'update' | 'leave',
    el: Element<Props>,
    props: Props,
    animatableModel?: Model<AnimationOptionMixin> & {
        getAnimationDelayParams?: (el: Element<Props>, dataIndex: number) => AnimationDelayCallbackParam
    },
    dataIndex?: AnimateOrSetPropsOption['dataIndex'] | AnimateOrSetPropsOption['cb'] | AnimateOrSetPropsOption,
    cb?: AnimateOrSetPropsOption['cb'] | AnimateOrSetPropsOption['during'],
    during?: AnimateOrSetPropsOption['during']
)

Source from the content-addressed store, hash-verified

125}
126
127function animateOrSetProps<Props>(
128 animationType: 'enter' | 'update' | 'leave',
129 el: Element<Props>,
130 props: Props,
131 animatableModel?: Model<AnimationOptionMixin> & {
132 getAnimationDelayParams?: (el: Element<Props>, dataIndex: number) => AnimationDelayCallbackParam
133 },
134 dataIndex?: AnimateOrSetPropsOption['dataIndex'] | AnimateOrSetPropsOption['cb'] | AnimateOrSetPropsOption,
135 cb?: AnimateOrSetPropsOption['cb'] | AnimateOrSetPropsOption['during'],
136 during?: AnimateOrSetPropsOption['during']
137) {
138 let isFrom = false;
139 let removeOpt: AnimationOption;
140 if (isFunction(dataIndex)) {
141 during = cb;
142 cb = dataIndex;
143 dataIndex = null;
144 }
145 else if (isObject(dataIndex)) {
146 cb = dataIndex.cb;
147 during = dataIndex.during;
148 isFrom = dataIndex.isFrom;
149 removeOpt = dataIndex.removeOpt;
150 dataIndex = dataIndex.dataIndex;
151 }
152
153 const isRemove = (animationType === 'leave');
154
155 if (!isRemove) {
156 // Must stop the remove animation.
157 el.stopAnimation('leave');
158 }
159
160 const animationConfig = getAnimationConfig(
161 animationType,
162 animatableModel,
163 dataIndex as number,
164 isRemove ? (removeOpt || {}) : null,
165 (animatableModel && animatableModel.getAnimationDelayParams)
166 ? animatableModel.getAnimationDelayParams(el, dataIndex as number)
167 : null
168 );
169 if (animationConfig && animationConfig.duration > 0) {
170 const duration = animationConfig.duration;
171 const animationDelay = animationConfig.delay;
172 const animationEasing = animationConfig.easing;
173
174 const animateConfig: ElementAnimateConfig = {
175 duration: duration as number,
176 delay: animationDelay as number || 0,
177 easing: animationEasing,
178 done: cb,
179 force: !!cb || !!during,
180 // Set to final state in update/init animation.
181 // So the post processing based on the path shape can be done correctly.
182 setToFinal: !isRemove,
183 scope: animationType,
184 during: during

Callers 3

updatePropsFunction · 0.85
initPropsFunction · 0.85
removeElementFunction · 0.85

Calls 4

getAnimationConfigFunction · 0.85
duringFunction · 0.85
isFunctionFunction · 0.50
isObjectFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…