@@ -239,7 +239,7 @@ class Controller<State extends object = any> {
239
239
if ( is . arr ( props . to ) || is . fun ( props . to ) ) {
240
240
this . _runAsync ( props , onEnd )
241
241
} else if ( this . _diff ( props ) ) {
242
- this . _animate ( this . props ) . _start ( onEnd )
242
+ this . _animate ( this . props , props . config ) . _start ( onEnd )
243
243
} else {
244
244
this . _onEnd ( onEnd )
245
245
}
@@ -292,6 +292,7 @@ class Controller<State extends object = any> {
292
292
}
293
293
294
294
// Merge every fresh prop. Returns true if one or more props changed.
295
+ // The `config` prop is ignored by this method.
295
296
private _diff ( { timestamp, config, ...props } : UpdateProps < State > ) {
296
297
let changed = false
297
298
@@ -323,20 +324,17 @@ class Controller<State extends object = any> {
323
324
}
324
325
}
325
326
326
- // The `config` prop is atomic
327
- if ( config && diffTimestamp ( 'config' ) ) {
328
- changed = true
329
- this . props . config = config
330
- }
331
-
332
327
for ( const key in props ) {
333
328
diffProp ( [ key ] , props [ key ] , this . props )
334
329
}
335
330
return changed
336
331
}
337
332
338
333
// Update the animation configs.
339
- private _animate ( props : UpdateProps < State > ) {
334
+ private _animate (
335
+ props : UpdateProps < State > ,
336
+ configArg : typeof props . config = props . config
337
+ ) {
340
338
let { to = emptyObj , from = emptyObj } = props
341
339
342
340
// Reverse values when requested
@@ -381,15 +379,8 @@ class Controller<State extends object = any> {
381
379
continue
382
380
}
383
381
384
- const config = callProp ( props . config , key ) || emptyObj
385
-
386
- // Animations are only updated when they were reset, they have a new
387
- // goal value, or their spring config was changed.
388
- if (
389
- props . reset ||
390
- ! is . equ ( goalValue , state . goalValue ) ||
391
- ! is . equ ( config , state . config )
392
- ) {
382
+ // Replace an animation when its goal value is changed (or it's been reset)
383
+ if ( props . reset || ! is . equ ( goalValue , state . goalValue ) ) {
393
384
const immediate = callProp ( props . immediate , key )
394
385
if ( ! immediate ) started . push ( key )
395
386
@@ -438,10 +429,11 @@ class Controller<State extends object = any> {
438
429
}
439
430
}
440
431
441
- // Update the array of Animated nodes used by the frameloop
442
- animatedValues = toArray ( animated . getPayload ( ) as any )
432
+ // Only change the "config" of updated animations.
433
+ const config : SpringConfig = callProp ( configArg , key ) || emptyObj
443
434
444
435
changed = true
436
+ animatedValues = toArray ( animated . getPayload ( ) as any )
445
437
this . animations [ key ] = {
446
438
key,
447
439
goalValue,
0 commit comments