@@ -402,16 +402,27 @@ void StartAnimations(Wd.CompositionObject source, Wc.CompositionObject target)
402402 foreach ( var animator in source . Animators )
403403 {
404404 var animation = GetCompositionAnimation ( animator . Animation ) ;
405- target . StartAnimation ( animator . AnimatedProperty , animation ) ;
406- var controller = animator . Controller ;
407- if ( controller is not null )
405+ if ( animator . Controller is null || ! animator . Controller . IsCustom )
408406 {
409- var animationController = GetAnimationController ( controller ) ;
410- if ( controller . IsPaused )
407+ target . StartAnimation ( animator . AnimatedProperty , animation ) ;
408+ var controller = animator . Controller ;
409+ if ( controller is not null )
411410 {
412- animationController . Pause ( ) ;
411+ var animationController = GetAnimationController ( controller ) ;
412+ if ( controller . IsPaused )
413+ {
414+ animationController . Pause ( ) ;
415+ }
413416 }
414417 }
418+ else
419+ {
420+ throw new InvalidOperationException ( "LottieViewer and Instantiator does not support custom AnimationControllers yet" ) ;
421+ /*
422+ We should retarget to SDK 22621 to support this
423+ target.StartAnimation(animator.AnimatedProperty, animation, GetAnimationController(animator.Controller));
424+ */
425+ }
415426 }
416427 }
417428
@@ -422,9 +433,25 @@ Wc.AnimationController GetAnimationController(Wd.AnimationController obj)
422433 return result ;
423434 }
424435
425- var targetObject = GetCompositionObject ( obj . TargetObject ) ;
436+ if ( obj . IsCustom )
437+ {
438+ throw new InvalidOperationException ( "LottieViewer and Instantiator does not support custom AnimationControllers yet" ) ;
439+ /*
440+ We should retarget to SDK 22621 to support this
441+ result = CacheAndInitializeCompositionObject(obj, _c.CreateAnimationController());
442+
443+ if (obj.IsPaused)
444+ {
445+ result.Pause();
446+ }
447+ */
448+ }
449+ else
450+ {
451+ var targetObject = GetCompositionObject ( obj . TargetObject ! ) ;
452+ result = CacheAndInitializeCompositionObject ( obj , targetObject . TryGetAnimationController ( obj . TargetProperty ) ) ;
453+ }
426454
427- result = CacheAndInitializeCompositionObject ( obj , targetObject . TryGetAnimationController ( obj . TargetProperty ) ) ;
428455 StartAnimations ( obj , result ) ;
429456 return result ;
430457 }
0 commit comments