private CAAnimation AppearAnimation(nfloat duration, ISpotlightType spotlightp) { var beginPath = MaskPath(spotlightp.InfinitesmalPath); var endPath = MaskPath(spotlightp.Path); return(PathAnimation(duration, beginPath, endPath)); }
public void MoveDisappear(ISpotlightType toSpotlight, nfloat duration) { CATransaction.Begin(); CATransaction.CompletionBlock = () => { Appear(toSpotlight, duration: duration); Spotlight = toSpotlight; }; Disappear(duration); CATransaction.Commit(); }
public void Move(ISpotlightType toSpotlight, nfloat duration, SpotlightMoveType moveType = SpotlightMoveType.Direct) { switch (moveType) { case SpotlightMoveType.Direct: MoveDirect(toSpotlight, duration: duration); break; case SpotlightMoveType.Disappear: MoveDisappear(toSpotlight, duration: duration); break; default: throw new ArgumentOutOfRangeException(nameof(moveType), moveType, null); } }
public void MoveDirect(ISpotlightType toSpotlight, nfloat duration) { _maskLayer.AddAnimation(MoveAnimation(duration, toSpotlight: toSpotlight), null); Spotlight = toSpotlight; }
public void Appear(ISpotlightType spotlightp, nfloat duration) { _maskLayer.AddAnimation(AppearAnimation(duration, spotlightp), null); Spotlight = spotlightp; }
private CAAnimation MoveAnimation(nfloat duration, ISpotlightType toSpotlight) { var endPath = MaskPath(toSpotlight.Path); return(PathAnimation(duration, beginPath: null, endPath: endPath)); }
public static CGPoint Center(this ISpotlightType spot) { return(new CGPoint(x: spot.Frame.GetMidX(), y: spot.Frame.GetMidY())); }
public static UIBezierPath InfinitesmalPath(this ISpotlightType spot) { return(UIBezierPath.FromRoundedRect(new CGRect(spot.Center, CGSize.Empty), cornerRadius: 0)); }