Skip to content

Commit

Permalink
Updated to latest revision. Now partially supporting text.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Zollinger Chohfi committed Jun 27, 2017
1 parent e7b54d7 commit 038222b
Show file tree
Hide file tree
Showing 22 changed files with 609 additions and 46 deletions.
1 change: 1 addition & 0 deletions LottieUWP.Sample/Assets/Hello World.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"v":"4.7.0","fr":29.9700012207031,"ip":0,"op":61.0000024845809,"w":300,"h":100,"nm":"Tracking","ddd":0,"assets":[],"fonts":{"list":[{"fName":"ComicSansMS","fFamily":"Comic Sans MS","fStyle":"Regular","ascent":85.8546752929688},{"fName":"CircularAirProCondensedBook","fFamily":"Circular Air Pro","fStyle":"Condensed Book","ascent":74.2991943359375}]},"layers":[{"ddd":0,"ind":1,"ty":5,"nm":"World","ks":{"o":{"a":0,"k":100},"r":{"a":0,"k":0},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[168.5,50.5,0],"e":[265,94.5,0],"to":[16.0833339691162,7.33333349227905,0],"ti":[-16.0833339691162,-7.33333349227905,0]},{"t":60.0000024438501}]},"a":{"a":0,"k":[0,0,0]},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"n":["0p833_0p833_0p167_0p167","0p833_0p833_0p167_0p167","0p833_0p833_0p167_0p167"],"t":0,"s":[100,100,100],"e":[162,162,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"n":["0p833_0p833_0p167_0p167","0p833_0p833_0p167_0p167","0p833_0p833_0p167_0p167"],"t":30,"s":[162,162,100],"e":[76,76,100]},{"t":60.0000024438501}]}},"ao":0,"t":{"d":{"k":[{"s":{"s":16,"f":"CircularAirProCondensedBook","t":"World","j":0,"tr":0,"lh":19.2,"ls":0,"fc":[0.92,0,0],"sc":[0.38,1,0],"sw":2,"of":false},"t":0}]},"p":{},"m":{"g":1,"a":{"a":0,"k":[0,0]}},"a":[]},"ip":0,"op":61.0000024845809,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":2,"ty":5,"nm":"Hello","ks":{"o":{"a":0,"k":100},"r":{"a":0,"k":0},"p":{"a":0,"k":[8.5,24,0]},"a":{"a":0,"k":[0,0,0]},"s":{"a":0,"k":[100,100,100]}},"ao":0,"t":{"d":{"k":[{"s":{"s":16,"f":"ComicSansMS","t":"Hello","j":0,"tr":0,"lh":19.2,"ls":0,"fc":[0,0,1]},"t":0}]},"p":{},"m":{"g":1,"a":{"a":0,"k":[0,0]}},"a":[{"s":{"t":0,"xe":{"a":0,"k":0},"ne":{"a":0,"k":0},"a":{"a":0,"k":100},"b":1,"rn":0,"sh":1,"r":1},"a":{"fc":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[1,0,0,1],"e":[0.0351563,1,0,1]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":30,"s":[0.0351563,1,0,1],"e":[0.0351563,0,1,1]},{"t":60.0000024438501}]},"t":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[-1],"e":[22.5]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":30,"s":[22.5],"e":[-1]},{"t":60.0000024438501}]}}}]},"ip":0,"op":61.0000024845809,"st":0,"bm":0,"sr":1}],"chars":[{"ch":"H","size":16,"style":"Regular","w":76.81,"data":{"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0.488],[0.977,0.896],[1.237,0],[1.074,-3.483],[0,-2.473],[0.358,-4.655],[8.366,-1.562],[0,0],[0,0],[-0.342,5.193],[0,2.605],[0.895,0.912],[1.334,0],[0.895,-0.911],[0,-1.367],[0.325,-5.159],[0,-2.571],[-0.13,-3.613],[0,-1.79],[0.569,-6.852],[0,-3.45],[-0.896,-0.928],[-1.335,0],[-0.896,0.928],[0,1.334],[-0.586,5.388],[0,2.93],[0,0],[-5.566,0.098],[0,-2.376],[-0.359,-4.948],[0,-2.506],[-0.912,-0.911],[-1.302,0],[-0.896,0.911],[0,1.335],[0.358,4.948],[0,2.474],[-0.57,6.445],[0,3.255],[0.065,1.921],[0,0.977],[-0.488,1.367]],"o":[[0,-1.367],[-0.977,-0.895],[-1.953,0],[-0.814,2.539],[0,9.375],[-5.73,0.066],[0,0],[0,0],[0,-2.604],[0.342,-5.192],[0,-1.367],[-0.896,-0.911],[-1.335,0],[-0.896,0.912],[0,2.572],[-0.326,5.16],[0,1.823],[0.13,3.613],[0,3.451],[-0.57,6.853],[0,1.334],[0.895,0.928],[1.334,0],[0.895,-0.928],[0,-2.962],[0.586,-5.387],[0,0],[8.203,-1.562],[-0.163,2.441],[0,2.474],[0.358,4.948],[0,1.335],[0.911,0.911],[1.334,0],[0.895,-0.911],[0,-2.506],[-0.359,-4.948],[0,-3.255],[0.569,-6.445],[0,-0.977],[-0.066,-1.92],[0,-2.637],[0.293,-0.846]],"v":[[71.533,-70.801],[70.068,-74.194],[66.748,-75.537],[62.207,-70.312],[60.986,-62.793],[60.449,-41.748],[39.307,-39.307],[18.359,-35.352],[18.066,-47.705],[18.579,-59.399],[19.092,-71.094],[17.749,-74.512],[14.404,-75.879],[11.06,-74.512],[9.717,-71.094],[9.229,-59.497],[8.74,-47.9],[8.936,-39.746],[9.131,-31.641],[8.276,-16.187],[7.422,-0.732],[8.765,2.661],[12.109,4.053],[15.454,2.661],[16.797,-0.732],[17.676,-13.257],[18.555,-25.732],[39.062,-29.736],[59.717,-32.227],[59.473,-25],[60.01,-13.867],[60.547,-2.686],[61.914,0.684],[65.234,2.051],[68.579,0.684],[69.922,-2.686],[69.385,-13.867],[68.848,-25],[69.702,-39.551],[70.557,-54.102],[70.459,-58.447],[70.361,-62.793],[71.094,-68.799]],"c":true}},"nm":"H","mn":"ADBE Vector Shape - Group"}],"nm":"H","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group"}]},"fFamily":"Comic Sans MS"},{"ch":"e","size":16,"style":"Regular","w":54.79,"data":{"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-4.98,2.213],[0,3.613],[0.895,0.863],[1.139,0],[1.106,-1.741],[3.841,-1.074],[2.246,0],[2.718,1.367],[1.823,2.702],[0,0],[-1.628,1.172],[0,3.255],[4.199,2.246],[5.403,0],[4.459,-6.25],[0,-8.463],[-4.98,-4.069],[-7.357,0]],"o":[[5.827,-2.604],[0,-1.139],[-0.896,-0.862],[-1.27,0],[-1.107,1.742],[-3.027,0.847],[-3.613,0],[-2.718,-1.367],[0,0],[5.273,-2.473],[3.678,-2.669],[0,-4.655],[-3.418,-1.823],[-7.455,0],[-4.102,5.73],[0,7.324],[4.557,3.678],[4.72,0]],"v":[[44.141,-1.074],[52.881,-10.4],[51.538,-13.403],[48.486,-14.697],[44.922,-12.085],[37.5,-7.861],[29.59,-6.592],[20.093,-8.643],[13.281,-14.746],[31.934,-23.584],[42.285,-29.053],[47.803,-37.939],[41.504,-48.291],[28.271,-51.025],[10.4,-41.65],[4.248,-20.361],[11.719,-3.271],[29.59,2.246]],"c":true}},"nm":"e","mn":"ADBE Vector Shape - Group"},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[-2.8,-2.604],[5.891,-2.864],[0,0],[-2.637,3.076],[-3.972,0]],"o":[[-2.507,2.116],[0,0],[1.302,-6.184],[2.637,-3.076],[5.045,0]],"v":[[40.039,-38.33],[27.441,-30.859],[12.451,-23.73],[18.359,-37.622],[28.271,-42.236]],"c":true}},"nm":"e","mn":"ADBE Vector Shape - Group"}],"nm":"e","np":5,"cix":2,"ix":1,"mn":"ADBE Vector Group"}]},"fFamily":"Comic Sans MS"},{"ch":"l","size":16,"style":"Regular","w":27.39,"data":{"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-0.163,6.625],[0,5.144],[3.223,0],[0,-3.255],[0.163,-6.624],[0,-5.143],[0.358,-7.893],[0,-3.938],[-3.191,0],[-0.326,3.255],[0,2.572],[0,0]],"o":[[0.163,-6.624],[0,-3.255],[-3.191,0],[0,5.144],[-0.163,6.625],[0,3.939],[-0.359,7.894],[0,3.32],[2.864,0],[0.26,-4.98],[0,0],[0,-5.143]],"v":[[19.434,-56.03],[19.678,-73.682],[14.844,-78.564],[10.059,-73.682],[9.814,-56.03],[9.57,-38.379],[9.033,-20.63],[8.496,-2.881],[13.281,2.1],[18.066,-2.783],[18.457,-14.111],[19.189,-38.379]],"c":true}},"nm":"l","mn":"ADBE Vector Shape - Group"}],"nm":"l","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group"}]},"fFamily":"Comic Sans MS"},{"ch":"o","size":16,"style":"Regular","w":52.59,"data":{"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[-4.167,5.795],[-0.098,7.227],[2.669,4.818],[6.51,0],[4.557,-6.608],[-0.195,-7.356],[-4.395,-4.492],[-5.469,0]],"o":[[3.678,-5.11],[0.098,-6.77],[-3.353,-5.957],[-8.138,0],[-3.906,5.599],[0.227,7.585],[3.938,4.036],[6.868,0]],"v":[[41.65,-5.811],[47.314,-24.316],[43.457,-41.699],[28.662,-50.635],[9.619,-40.723],[4.053,-21.289],[10.986,-3.174],[25.098,2.881]],"c":true}},"nm":"o","mn":"ADBE Vector Shape - Group"},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0.455,-12.598],[2.766,-2.734],[3.385,0],[2.148,2.181],[0,4.72],[-2.116,3.679],[-4.785,-0.032]],"o":[[-0.163,4.655],[-2.441,2.474],[-2.898,0],[-2.572,-2.637],[0,-4.72],[2.669,-4.59],[7.259,0.033]],"v":[[38.232,-21.777],[33.838,-10.693],[25.098,-6.982],[17.529,-10.254],[13.672,-21.289],[16.846,-33.887],[28.027,-40.723]],"c":true}},"nm":"o","mn":"ADBE Vector Shape - Group"}],"nm":"o","np":5,"cix":2,"ix":1,"mn":"ADBE Vector Group"}]},"fFamily":"Comic Sans MS"},{"ch":"W","size":16,"style":"Condensed Book","w":81.3,"data":{"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[3.021,-71.402],[17.02,0],[28.5,0],[40.887,-56.296],[53.476,0],[64.957,0],[78.351,-71.402],[68.683,-71.402],[58.914,-14.301],[46.124,-71.402],[35.852,-71.402],[23.264,-14.401],[12.891,-71.402]],"c":true}},"nm":"W","mn":"ADBE Vector Shape - Group"}],"nm":"W","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group"}]},"fFamily":"Circular Air Pro"},{"ch":"o","size":16,"style":"Condensed Book","w":48.6,"data":{"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[6.546,0],[0,12.085],[-6.848,0],[0,-12.286]],"o":[[-6.546,0],[0,-12.286],[6.848,0],[0,12.085]],"v":[[24.472,-6.848],[13.394,-24.875],[24.472,-43.002],[35.55,-24.875]],"c":true}},"nm":"o","mn":"ADBE Vector Shape - Group"},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[11.984,0],[0,-16.214],[-12.589,0],[0,16.013]],"o":[[-11.984,0],[0,16.013],[12.589,0],[0,-16.214]],"v":[[24.472,-51.059],[4.33,-24.875],[24.472,1.41],[44.614,-24.875]],"c":true}},"nm":"o","mn":"ADBE Vector Shape - Group"}],"nm":"o","np":5,"cix":2,"ix":1,"mn":"ADBE Vector Group"}]},"fFamily":"Circular Air Pro"},{"ch":"r","size":16,"style":"Condensed Book","w":33.2,"data":{"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0.906,0],[1.41,-5.237],[0,0],[0,0],[0,0],[0,0],[0,0],[-6.143,0],[-0.705,-0.201]],"o":[[-0.504,-0.201],[-5.438,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,-9.366],[1.108,0],[0,0]],"v":[[30.615,-49.951],[28.098,-50.253],[16.718,-41.492],[16.718,-49.75],[8.057,-49.75],[8.057,0],[17.12,0],[17.12,-27.292],[27.997,-40.686],[30.615,-40.384]],"c":true}},"nm":"r","mn":"ADBE Vector Shape - Group"}],"nm":"r","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group"}]},"fFamily":"Circular Air Pro"},{"ch":"l","size":16,"style":"Condensed Book","w":25.1,"data":{"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[17.221,0],[17.221,-72.812],[8.057,-72.812],[8.057,0]],"c":true}},"nm":"l","mn":"ADBE Vector Shape - Group"}],"nm":"l","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group"}]},"fFamily":"Circular Air Pro"},{"ch":"d","size":16,"style":"Condensed Book","w":52,"data":{"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,-17.926],[-9.869,0],[-1.813,4.33],[-0.201,-1.309],[0,0],[0,5.035],[0,0],[0,0],[0,0],[5.74,0]],"o":[[0,17.523],[6.747,0],[0,2.618],[0,0],[-0.302,-1.712],[0,0],[0,0],[0,0],[-1.611,-4.33],[-10.071,0]],"v":[[4.532,-24.875],[23.163,1.108],[35.751,-6.949],[36.255,0],[45.016,0],[44.312,-10.373],[44.312,-72.812],[35.349,-72.812],[35.349,-43.506],[23.364,-50.958]],"c":true}},"nm":"d","mn":"ADBE Vector Shape - Group"},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[6.546,0],[0,11.984],[-6.546,0],[0,-11.984]],"o":[[-6.546,0],[0,-11.984],[6.546,0],[0,11.984]],"v":[[24.371,-6.747],[13.495,-24.875],[24.371,-43.002],[35.248,-24.875]],"c":true}},"nm":"d","mn":"ADBE Vector Shape - Group"}],"nm":"d","np":5,"cix":2,"ix":1,"mn":"ADBE Vector Group"}]},"fFamily":"Circular Air Pro"}]}
1 change: 1 addition & 0 deletions LottieUWP.Sample/LottieUWP.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
<Content Include="Assets\lottiefiles.com - VR Sickness.json" />
<Content Include="Assets\lottiefiles.com - VR.json" />
<Content Include="Assets\lottifiles.com - QR Scan.json" />
<Content Include="Assets\Hello World.json" />
<None Include="LottieUWP.Sample_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion LottieUWP/AnimatableFloatValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal static AnimatableFloatValue NewInstance()
internal static AnimatableFloatValue NewInstance(JsonObject json, LottieComposition composition, bool isDp = true)
{
var scale = isDp ? composition.DpScale : 1f;
if (json.ContainsKey("x"))
if (json != null && json.ContainsKey("x"))
{
composition.AddWarning("Lottie doesn't support expressions.");
}
Expand Down
2 changes: 1 addition & 1 deletion LottieUWP/AnimatableIntegerValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal static AnimatableIntegerValue NewInstance()

internal static AnimatableIntegerValue NewInstance(JsonObject json, LottieComposition composition)
{
if (json.ContainsKey("x"))
if (json != null && json.ContainsKey("x"))
{
composition.AddWarning("Lottie doesn't support expressions.");
}
Expand Down
45 changes: 45 additions & 0 deletions LottieUWP/AnimatableTextFrame.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System.Collections.Generic;
using Windows.Data.Json;

namespace LottieUWP
{
internal class AnimatableTextFrame : BaseAnimatableValue<DocumentData, DocumentData>
{
internal AnimatableTextFrame(IList<IKeyframe<DocumentData>> keyframes, DocumentData initialValue) : base(keyframes, initialValue)
{
}

protected override DocumentData ConvertType(DocumentData value)
{
return value;
}

public override IBaseKeyframeAnimation<DocumentData> CreateAnimation()
{
return new TextKeyframeAnimation(Keyframes);
}

internal static class Factory
{
internal static AnimatableTextFrame NewInstance(JsonObject json, LottieComposition composition)
{
if (json != null && json.ContainsKey("x"))
{
composition.AddWarning("Lottie doesn't support expressions.");
}
AnimatableValueParser<DocumentData>.Result result = AnimatableValueParser<DocumentData>.NewInstance(json, 1, composition, ValueFactory.Instance).ParseJson();
return new AnimatableTextFrame(result.Keyframes, result.InitialValue);
}
}

private class ValueFactory : IAnimatableValueFactory<DocumentData>
{
internal static readonly ValueFactory Instance = new ValueFactory();

public DocumentData ValueFromObject(IJsonValue @object, float scale)
{
return DocumentData.Factory.NewInstance(@object.GetObject());
}
}
}
}
63 changes: 63 additions & 0 deletions LottieUWP/AnimatableTextProperties.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using Windows.Data.Json;

namespace LottieUWP
{
internal class AnimatableTextProperties
{
internal readonly AnimatableColorValue _color;
internal readonly AnimatableColorValue _stroke;
internal readonly AnimatableFloatValue _strokeWidth;
internal readonly AnimatableFloatValue _tracking;

internal AnimatableTextProperties(AnimatableColorValue color, AnimatableColorValue stroke, AnimatableFloatValue strokeWidth, AnimatableFloatValue tracking)
{
_color = color;
_stroke = stroke;
_strokeWidth = strokeWidth;
_tracking = tracking;
}

internal static class Factory
{
internal static AnimatableTextProperties NewInstance(JsonObject json, LottieComposition composition)
{
if (json == null || !json.ContainsKey("a"))
{
return new AnimatableTextProperties(null, null, null, null);
}

var animatablePropertiesJson = json.GetNamedObject("a");

var colorJson = animatablePropertiesJson.GetNamedObject("fc", null);
AnimatableColorValue color = null;
if (colorJson != null)
{
color = AnimatableColorValue.Factory.NewInstance(colorJson, composition);
}

var strokeJson = animatablePropertiesJson.GetNamedObject("sc", null);
AnimatableColorValue stroke = null;
if (colorJson != null)
{
stroke = AnimatableColorValue.Factory.NewInstance(strokeJson, composition);
}

var strokeWidthJson = animatablePropertiesJson.GetNamedObject("sw", null);
AnimatableFloatValue strokeWidth = null;
if (strokeWidthJson != null)
{
strokeWidth = AnimatableFloatValue.Factory.NewInstance(strokeWidthJson, composition);
}

var trackingJson = animatablePropertiesJson.GetNamedObject("t", null);
AnimatableFloatValue tracking = null;
if (trackingJson != null)
{
tracking = AnimatableFloatValue.Factory.NewInstance(trackingJson, composition);
}

return new AnimatableTextProperties(color, stroke, strokeWidth, tracking);
}
}
}
}
11 changes: 9 additions & 2 deletions LottieUWP/BaseKeyframeAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public abstract class BaseKeyframeAnimation<TK, TA> : IBaseKeyframeAnimation<TA>
{
public virtual event EventHandler ValueChanged;
private bool _isDiscrete;
private TA _previousValue;

private readonly IList<IKeyframe<TK>> _keyframes;
private float _progress;
Expand Down Expand Up @@ -68,7 +69,13 @@ public virtual float Progress

protected virtual void OnValueChanged()
{
ValueChanged?.Invoke(this, EventArgs.Empty);
TA value = Value;
// Removed temporarily
//if (_previousValue == null || !_previousValue.Equals(value))
{
_previousValue = value;
ValueChanged?.Invoke(this, EventArgs.Empty);
}
}

private IKeyframe<TK> CurrentKeyframe
Expand All @@ -77,7 +84,7 @@ private IKeyframe<TK> CurrentKeyframe
{
if (_keyframes.Count == 0)
{
throw new System.InvalidOperationException("There are no keyframes");
throw new InvalidOperationException("There are no keyframes");
}

if (_cachedKeyframe != null && _cachedKeyframe.ContainsProgress(_progress))
Expand Down
1 change: 1 addition & 0 deletions LottieUWP/BaseLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ internal static BaseLayer ForModel(Layer layerModel, LottieDrawable drawable, Lo
case Layer.LayerType.Null:
return new NullLayer(drawable, layerModel);
case Layer.LayerType.Text:
return new TextLayer(drawable, layerModel);
case Layer.LayerType.Unknown:
default:
// Do nothing
Expand Down
19 changes: 14 additions & 5 deletions LottieUWP/BitmapCanvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public void DrawRect(double x1, double y1, double x2, double y2, Paint paint)
Width = x2 - x1,
Height = y2 - y1,
RenderTransform = GetCurrentRenderTransform(),
Fill = new SolidColorBrush(paint.Color),

Fill = new SolidColorBrush(paint.Color)
};
paint.PathEffect?.Apply(rectangle, paint);
SetLeft(rectangle, x1);
Expand All @@ -56,7 +55,7 @@ internal void DrawRect(Rect rect, Paint paint)
Width = rect.Width,
Height = rect.Height,
RenderTransform = GetCurrentRenderTransform(),
Fill = brush,
Fill = brush
};
paint.PathEffect?.Apply(rectangle, paint);
SetLeft(rectangle, rect.Left);
Expand Down Expand Up @@ -169,12 +168,16 @@ public void Concat(DenseMatrix parentMatrix)
// concat or clipRect
public void Save()
{
_matrixSaves.Push(_matrix);
var copy = new DenseMatrix(3);
_matrix.CopyTo(copy);
_matrixSaves.Push(copy);
}

public void SaveLayer(Rect rect, Paint contentPaint, object allSaveFlag)
{
_matrixSaves.Push(_matrix);
var copy = new DenseMatrix(3);
_matrix.CopyTo(copy);
_matrixSaves.Push(copy);
}

public void Restore()
Expand Down Expand Up @@ -209,6 +212,7 @@ public void GetClipBounds(out Rect originalClipRect)
public void Clear(Color color)
{
Children.Clear();
_matrixSaves.Clear();
Background = new SolidColorBrush(color);
}

Expand All @@ -221,6 +225,11 @@ public Viewbox GetImage()
StretchDirection = StretchDirection.DownOnly
};
}

public void Translate(float dx, float dy)
{
MatrixExt.PreTranslate(_matrix, dx, dy);
}
}

public class Region
Expand Down
Loading

0 comments on commit 038222b

Please sign in to comment.