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

Function applyMorphAnimation

src/animation/morphTransitionHelper.ts:110–234  ·  view source on GitHub ↗
(
    from: DescendentPaths | DescendentPaths[],
    to: DescendentPaths | DescendentPaths[],
    divideShape: UniversalTransitionOption['divideShape'],
    seriesModel: SeriesModel,
    dataIndex: number,
    animateOtherProps: (
        fromIndividual: Path,
        toIndividual: Path,
        rawFrom: Path,
        rawTo: Path,
        animationCfg: ElementAnimateConfig
    ) => void
)

Source from the content-addressed store, hash-verified

108};
109
110export function applyMorphAnimation(
111 from: DescendentPaths | DescendentPaths[],
112 to: DescendentPaths | DescendentPaths[],
113 divideShape: UniversalTransitionOption['divideShape'],
114 seriesModel: SeriesModel,
115 dataIndex: number,
116 animateOtherProps: (
117 fromIndividual: Path,
118 toIndividual: Path,
119 rawFrom: Path,
120 rawTo: Path,
121 animationCfg: ElementAnimateConfig
122 ) => void
123) {
124 if (!from.length || !to.length) {
125 return;
126 }
127
128 const updateAnimationCfg = getAnimationConfig('update', seriesModel, dataIndex);
129 if (!(updateAnimationCfg && updateAnimationCfg.duration > 0)) {
130 return;
131 }
132 const animationDelay = (seriesModel.getModel('universalTransition') as Model<UniversalTransitionOption>)
133 .get('delay');
134
135
136 const animationCfg = extend({
137 // Need to setToFinal so the further calculation based on the style can be correct.
138 // Like emphasis color.
139 setToFinal: true
140 } as SeparateConfig, updateAnimationCfg);
141
142
143 let many: DescendentPaths[];
144 let one: DescendentPaths;
145 if (isMultiple(from)) { // manyToOne
146 many = from;
147 one = to as DescendentPaths;
148 }
149 if (isMultiple(to)) { // oneToMany
150 many = to;
151 one = from as DescendentPaths;
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

Callers 2

updateOneToOneFunction · 0.90
transitionBetweenFunction · 0.90

Calls 7

getAnimationConfigFunction · 0.90
extendFunction · 0.85
isMultipleFunction · 0.85
prepareMorphBatchesFunction · 0.85
morphOneBatchFunction · 0.85
getMethod · 0.45
getModelMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…