/// <summary>
 /// Override this to provide your own offset on every frame.
 /// </summary>
 /// <param name="frameInfo"></param>
 /// <returns></returns>
 public Vector2 GetOffset(LottieFrameInfo <Vector2?> frameInfo)
 {
     if (Value == null)
     {
         throw new ArgumentException("You must provide a static value in the constructor " +
                                     ", call setValue, or override getValue.");
     }
     return(Value.Value);
 }
 /// <summary>
 /// Override this if you haven't set a static value in the constructor or with SetValue.
 /// </summary>
 /// <param name="frameInfo"></param>
 /// <returns></returns>
 public virtual T GetValue(LottieFrameInfo <T> frameInfo)
 {
     if (Value == null)
     {
         throw new ArgumentException("You must provide a static value in the constructor " +
                                     ", call SetValue, or override GetValue.");
     }
     return(Value);
 }
        public override int?GetValue(LottieFrameInfo <int?> frameInfo)
        {
            int originalValue = MiscUtils.Lerp(
                frameInfo.StartValue.Value,
                frameInfo.EndValue.Value,
                frameInfo.InterpolatedKeyframeProgress
                );
            int newValue = GetOffset(frameInfo);

            return(originalValue + newValue);
        }
        public override float?GetValue(LottieFrameInfo <float?> frameInfo)
        {
            float originalValue = MiscUtils.Lerp(
                frameInfo.StartValue.Value,
                frameInfo.EndValue.Value,
                frameInfo.InterpolatedKeyframeProgress
                );
            float offset = GetOffset(frameInfo);

            return(originalValue + offset);
        }
        public override Vector2?GetValue(LottieFrameInfo <Vector2?> frameInfo)
        {
            var point = new Vector2(
                MiscUtils.Lerp(
                    frameInfo.StartValue.Value.X,
                    frameInfo.EndValue.Value.X,
                    frameInfo.InterpolatedKeyframeProgress),
                MiscUtils.Lerp(
                    frameInfo.StartValue.Value.Y,
                    frameInfo.EndValue.Value.Y,
                    frameInfo.InterpolatedKeyframeProgress)
                );

            var offset = GetOffset(frameInfo);

            point.X += offset.X;
            point.Y += offset.Y;
            return(point);
        }
Beispiel #6
0
 /// <summary>
 /// Override this if you haven't set a static value in the constructor or with SetValue.
 /// </summary>
 /// <param name="frameInfo"></param>
 /// <returns></returns>
 public virtual T GetValue(LottieFrameInfo <T> frameInfo)
 {
     return(Value);
 }