MCPcopy Index your code
hub / github.com/apache/echarts / morphOneBatch

Function morphOneBatch

src/animation/morphTransitionHelper.ts:154–212  ·  view source on GitHub ↗
(
        batch: MorphingBatch,
        fromIsMany: boolean,
        animateIndex: number,
        animateCount: number,
        forceManyOne?: boolean
    )

Source from the content-addressed store, hash-verified

152 }
153
154 function morphOneBatch(
155 batch: MorphingBatch,
156 fromIsMany: boolean,
157 animateIndex: number,
158 animateCount: number,
159 forceManyOne?: boolean
160 ) {
161 const batchMany = batch.many;
162 const batchOne = batch.one;
163 if (batchMany.length === 1 && !forceManyOne) {
164 // Is one to one
165 const batchFrom: Path = fromIsMany ? batchMany[0] : batchOne;
166 const batchTo: Path = fromIsMany ? batchOne : batchMany[0];
167
168 if (isCombineMorphing(batchFrom as Path)) {
169 // Keep doing combine animation.
170 morphOneBatch({
171 many: [batchFrom as Path],
172 one: batchTo as Path
173 }, true, animateIndex, animateCount, true);
174 }
175 else {
176 const individualAnimationCfg = animationDelay ? defaults({
177 delay: animationDelay(animateIndex, animateCount)
178 } as ElementAnimateConfig, animationCfg) : animationCfg;
179 morphPath(batchFrom, batchTo, individualAnimationCfg);
180 animateOtherProps(batchFrom, batchTo, batchFrom, batchTo, individualAnimationCfg);
181 }
182 }
183 else {
184 const separateAnimationCfg = defaults({
185 dividePath: pathDividers[divideShape],
186 individualDelay: animationDelay && function (idx, count, fromPath, toPath) {
187 return animationDelay(idx + animateIndex, animateCount);
188 }
189 } as SeparateConfig, animationCfg);
190
191 const {
192 fromIndividuals,
193 toIndividuals
194 } = fromIsMany
195 ? combineMorph(batchMany, batchOne, separateAnimationCfg)
196 : separateMorph(batchOne, batchMany, separateAnimationCfg);
197
198 const count = fromIndividuals.length;
199 for (let k = 0; k < count; k++) {
200 const individualAnimationCfg = animationDelay ? defaults({
201 delay: animationDelay(k, count)
202 } as ElementAnimateConfig, animationCfg) : animationCfg;
203 animateOtherProps(
204 fromIndividuals[k],
205 toIndividuals[k],
206 fromIsMany ? batchMany[k] : batch.one,
207 fromIsMany ? batch.one : batchMany[k],
208 individualAnimationCfg
209 );
210 }
211 }

Callers 1

applyMorphAnimationFunction · 0.85

Calls 1

animationDelayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…