@@ -261,31 +261,14 @@ public void testNodeValueListenerIfListening() {
261
261
verifyNoMoreInteractions (valueListener );
262
262
}
263
263
264
- @ Test
265
- public void testSpringAnimation () {
264
+ public void performSpringAnimationTestWithConfig (JavaOnlyMap config ) {
266
265
createSimpleAnimatedViewWithOpacity (1000 , 0d );
267
266
268
267
Callback animationCallback = mock (Callback .class );
269
268
mNativeAnimatedNodesManager .startAnimatingNode (
270
269
1 ,
271
270
1 ,
272
- JavaOnlyMap .of (
273
- "type" ,
274
- "spring" ,
275
- "friction" ,
276
- 7d ,
277
- "tension" ,
278
- 40.0d ,
279
- "initialVelocity" ,
280
- 0d ,
281
- "toValue" ,
282
- 1d ,
283
- "restSpeedThreshold" ,
284
- 0.001d ,
285
- "restDisplacementThreshold" ,
286
- 0.001d ,
287
- "overshootClamping" ,
288
- false ),
271
+ config ,
289
272
animationCallback );
290
273
291
274
ArgumentCaptor <ReactStylesDiffMap > stylesCaptor =
@@ -322,13 +305,8 @@ public void testSpringAnimation() {
322
305
}
323
306
324
307
@ Test
325
- public void testSpringAnimationLoopsFiveTimes () {
326
- createSimpleAnimatedViewWithOpacity (1000 , 0d );
327
-
328
- Callback animationCallback = mock (Callback .class );
329
- mNativeAnimatedNodesManager .startAnimatingNode (
330
- 1 ,
331
- 1 ,
308
+ public void testRK4SpringAnimation () {
309
+ performSpringAnimationTestWithConfig (
332
310
JavaOnlyMap .of (
333
311
"type" ,
334
312
"spring" ,
@@ -345,9 +323,45 @@ public void testSpringAnimationLoopsFiveTimes() {
345
323
"restDisplacementThreshold" ,
346
324
0.001d ,
347
325
"overshootClamping" ,
348
- false ,
349
- "iterations" ,
350
- 5 ),
326
+ false
327
+ )
328
+ );
329
+ }
330
+
331
+ @ Test
332
+ public void testDHOSpringAnimation () {
333
+ performSpringAnimationTestWithConfig (
334
+ JavaOnlyMap .of (
335
+ "type" ,
336
+ "spring" ,
337
+ "stiffness" ,
338
+ 100d ,
339
+ "damping" ,
340
+ 10.0d ,
341
+ "mass" ,
342
+ 1.0d ,
343
+ "initialVelocity" ,
344
+ 0d ,
345
+ "toValue" ,
346
+ 1d ,
347
+ "restSpeedThreshold" ,
348
+ 0.001d ,
349
+ "restDisplacementThreshold" ,
350
+ 0.001d ,
351
+ "overshootClamping" ,
352
+ false
353
+ )
354
+ );
355
+ }
356
+
357
+ public void performSpringAnimationLoopsFiveTimesTest (JavaOnlyMap config ) {
358
+ createSimpleAnimatedViewWithOpacity (1000 , 0d );
359
+
360
+ Callback animationCallback = mock (Callback .class );
361
+ mNativeAnimatedNodesManager .startAnimatingNode (
362
+ 1 ,
363
+ 1 ,
364
+ config ,
351
365
animationCallback );
352
366
353
367
ArgumentCaptor <ReactStylesDiffMap > stylesCaptor =
@@ -399,6 +413,60 @@ public void testSpringAnimationLoopsFiveTimes() {
399
413
verifyNoMoreInteractions (mUIImplementationMock );
400
414
}
401
415
416
+ @ Test
417
+ public void testRK4SpringAnimationLoopsFiveTimes () {
418
+ performSpringAnimationLoopsFiveTimesTest (
419
+ JavaOnlyMap .of (
420
+ "type" ,
421
+ "spring" ,
422
+ "friction" ,
423
+ 7d ,
424
+ "tension" ,
425
+ 40.0d ,
426
+ "initialVelocity" ,
427
+ 0d ,
428
+ "toValue" ,
429
+ 1d ,
430
+ "restSpeedThreshold" ,
431
+ 0.001d ,
432
+ "restDisplacementThreshold" ,
433
+ 0.001d ,
434
+ "overshootClamping" ,
435
+ false ,
436
+ "iterations" ,
437
+ 5
438
+ )
439
+ );
440
+ }
441
+
442
+ @ Test
443
+ public void testDHOSpringAnimationLoopsFiveTimes () {
444
+ performSpringAnimationLoopsFiveTimesTest (
445
+ JavaOnlyMap .of (
446
+ "type" ,
447
+ "spring" ,
448
+ "stiffness" ,
449
+ 100d ,
450
+ "damping" ,
451
+ 10.0d ,
452
+ "mass" ,
453
+ 1.0d ,
454
+ "initialVelocity" ,
455
+ 0d ,
456
+ "toValue" ,
457
+ 1d ,
458
+ "restSpeedThreshold" ,
459
+ 0.001d ,
460
+ "restDisplacementThreshold" ,
461
+ 0.001d ,
462
+ "overshootClamping" ,
463
+ false ,
464
+ "iterations" ,
465
+ 5
466
+ )
467
+ );
468
+ }
469
+
402
470
@ Test
403
471
public void testDecayAnimation () {
404
472
createSimpleAnimatedViewWithOpacity (1000 , 0d );
0 commit comments