Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support non-integer animation widths/heights #1694

Merged
merged 2 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Sources/Private/Model/Animation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public final class Animation: Codable, DictionaryInitializable {
startFrame = try container.decode(AnimationFrameTime.self, forKey: .startFrame)
endFrame = try container.decode(AnimationFrameTime.self, forKey: .endFrame)
framerate = try container.decode(Double.self, forKey: .framerate)
width = try container.decode(Int.self, forKey: .width)
height = try container.decode(Int.self, forKey: .height)
width = try container.decode(Double.self, forKey: .width)
height = try container.decode(Double.self, forKey: .height)
layers = try container.decode([LayerModel].self, ofFamily: LayerType.self, forKey: .layers)
glyphs = try container.decodeIfPresent([Glyph].self, forKey: .glyphs)
fonts = try container.decodeIfPresent(FontList.self, forKey: .fonts)
Expand Down Expand Up @@ -137,10 +137,10 @@ public final class Animation: Codable, DictionaryInitializable {
let type: CoordinateSpace

/// The height of the composition in points.
let width: Int
let width: Double

/// The width of the composition in points.
let height: Int
let height: Double

/// The list of animation layers
let layers: [LayerModel]
Expand Down
1 change: 1 addition & 0 deletions Tests/Samples/Issues/issue_1460.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"v":"5.6.6","ip":0,"op":1,"fr":60,"w":100,"h":58.84,"layers":[{"ind":97,"ao":0,"ip":0,"op":1,"st":0,"ty":4,"ks":{"ty":"tr","o":{"k":100},"r":{"k":0},"p":{"k":[0,0]},"a":{"k":[0,0]},"s":{"k":[100,100]},"sk":{"k":0},"sa":{"k":0}},"shapes":[{"ty":"sh","ks":{"k":{"i":[[0,0],[2.09,-0.82],[0,0],[2.02,3.77],[-0.52,1.34],[0,2.58],[0,0],[5.49,0],[0,-0.64],[-0.52,-0.15],[-2.42,-0.59],[0.63,-1.53],[10.69,0],[-0.11,0.41],[0,0.75],[1.46,0.82],[0,0],[0,0.18],[-0.3,0],[-0.37,0],[-1.94,0],[0,1.57],[2.13,0],[0.6,0],[0,-2.58],[-1.76,-0.75],[0,0],[0,-0.26],[0,-0.04],[0,0],[1.5,-4.97],[0.04,0],[2.77,0],[0,-9.75],[-9.75,0],[0,9.71],[4.37,3.4],[0,0.04],[-0.19,0.6],[-6.69,-4.59],[0,0],[0,-0.71],[-3.89,0],[-1.01,0.34],[-0.49,-0.9],[0.74,0],[0,-0.79],[-0.82,0],[-0.52,0],[-0.34,0.37],[-0.64,0],[0,0.74],[0.94,0],[0.56,1.2],[-0.45,1.72],[0,0],[-0.67,0],[-9.08,0],[0,9.71],[9.71,0]],"o":[[-2.24,0],[-0.03,0.04],[-2.02,-3.77],[0.56,-1.38],[2.58,0],[0,-0.04],[-5.49,0],[-0.6,0],[0,0.52],[2.43,0.63],[-0.67,1.57],[-10.72,0],[0,0],[0.19,-0.71],[0,-1.68],[-0.04,-0.04],[-0.15,-0.11],[0,-0.3],[0.41,0],[1.98,0],[0,-1.57],[-2.17,0],[-0.6,0],[-2.57,0.04],[0,1.91],[0.04,0],[0.22,0.11],[0,0.04],[0,0.04],[-1.5,5.01],[-0.04,-0.04],[-2.58,-1.01],[-9.75,0],[0,9.71],[9.71,0],[0,-5.56],[-0.04,-0.07],[0.22,-0.63],[6.72,4.63],[0,0.03],[-0.19,0.71],[0,3.88],[1.08,0],[0.48,0.93],[-0.78,0],[0,0.79],[0.82,0],[0.38,0.37],[0.49,0],[0.67,0],[0,-0.79],[-0.98,0],[-0.6,-1.19],[1.46,-0.97],[0.04,0],[0.7,0],[0.9,9.04],[9.71,0],[0,-9.75],[0,0]],"v":[[82.37,23.54],[75.75,24.81],[75.72,24.84],[69.67,13.53],[71.31,9.45],[75.99,4.75],[75.99,4.71],[59.51,4.71],[58.35,5.91],[59.21,7.03],[66.49,8.89],[64.55,13.53],[32.42,13.53],[33.13,11.13],[33.43,9.41],[30.93,5.87],[30.86,5.79],[30.59,5.31],[31.19,4.71],[32.35,4.71],[38.25,4.71],[38.25,0],[31.79,0],[29.99,0],[25.33,4.74],[28.24,9.11],[28.31,9.11],[28.65,9.68],[28.65,9.79],[28.65,9.82],[24.17,24.8],[24.06,24.73],[17.67,23.54],[0,41.21],[17.66,58.84],[35.3,41.21],[28.46,27.23],[28.39,27.08],[28.99,25.22],[49.12,39.04],[49.12,39.11],[48.82,41.21],[55.88,48.27],[58.2,47.86],[59.66,50.62],[57.38,50.62],[57.38,52.97],[59.84,52.97],[61.19,53.53],[62.49,52.94],[64.44,52.94],[64.44,50.62],[61.59,50.62],[59.84,47.03],[62.72,42.96],[62.76,42.96],[64.81,42.96],[82.37,58.84],[100,41.21],[82.37,23.54]],"c":true}}},{"ty":"sh","ks":{"k":{"i":[[0,0],[6.8,0],[0,6.8],[-6.83,0],[-1.53,-0.67],[0,0],[0.49,-1.57],[2.02,-1.38],[0.08,-0.04],[0,-0.6],[-0.97,0],[-0.08,0.03],[-1.04,3.29],[-0.3,1.01],[0,0],[0,-3.21]],"o":[[0,6.8],[-6.83,0],[0,-6.84],[1.75,0],[0.03,0.04],[-0.49,1.57],[-0.67,2.02],[-0.11,0.07],[-0.45,0.34],[0,0.93],[0.08,0],[3.36,-0.94],[0.34,-1.04],[0.03,0.04],[2.02,2.2],[0,0]],"v":[[29.98,41.21],[17.65,53.53],[5.29,41.21],[17.65,28.84],[22.62,29.89],[22.7,29.93],[21.24,34.63],[16.87,39.57],[16.61,39.75],[15.86,41.21],[17.65,42.96],[17.99,42.93],[25.79,35.94],[26.73,32.84],[26.76,32.88],[29.98,41.21]],"c":true}}},{"ty":"sh","ks":{"k":{"i":[[0,0],[0,0],[-1.38,-2.61],[2.84,0],[0,0],[-2.46,2.02]],"o":[[0.04,-0.04],[1.42,2.65],[-2.88,0],[0,-0.03],[0.45,-3.14],[0,0]],"v":[[74.51,31.65],[74.55,31.57],[78.73,39.45],[70.14,39.45],[70.14,39.37],[74.51,31.65]],"c":true}}},{"ty":"sh","ks":{"k":{"i":[[0,0],[-0.3,1.12],[-10.57,0],[2.2,-5.49],[0,0],[0.08,0],[0.67,-0.23],[0.04,0],[0.45,0.89],[-0.71,0],[0,0.79],[0.83,0],[0,0],[0.48,0],[0.34,-0.37],[0,0],[0.63,0],[0,-0.78],[-0.94,0],[-0.56,-1.16],[0.15,-0.11],[7.06,4.85]],"o":[[0.34,-1.12],[10.61,0],[-2.23,5.49],[-0.04,0],[-0.11,0],[-0.71,0],[-0.07,0.03],[-0.48,-0.93],[0.75,0],[0,-0.78],[-0.82,0],[-0.03,-0.04],[-0.34,-0.37],[-0.49,0],[-0.03,0.04],[-0.67,0],[0,0.79],[0.97,0],[0.6,1.2],[-0.19,0.11],[-7.09,-4.89],[0,0]],"v":[[30.2,21.04],[31.17,17.67],[62.92,17.67],[56.24,34.14],[56.16,34.14],[55.87,34.14],[53.7,34.49],[53.55,34.52],[52.17,31.79],[54.37,31.79],[54.37,29.43],[51.91,29.43],[51.87,29.4],[50.56,28.84],[49.29,29.4],[49.26,29.43],[47.31,29.43],[47.31,31.79],[50.19,31.79],[51.95,35.34],[51.46,35.67],[30.2,21.04]],"c":true}}},{"ty":"sh","ks":{"k":{"i":[[0,0],[0,2.57],[-2.58,0],[0,-2.62],[2.58,0]],"o":[[-2.58,0],[0,-2.62],[2.58,0],[0,2.57],[0,0]],"v":[[55.87,45.92],[51.16,41.21],[55.87,36.5],[60.57,41.21],[55.87,45.92]],"c":true}}},{"ty":"sh","ks":{"k":{"i":[[0,0],[0,-0.04],[0.7,0],[1.05,1.01],[0.04,0.03],[-2.36,5.83],[-1.5,-2.8],[0.04,-0.04],[0.53,-5.08]],"o":[[0,0],[-0.67,0],[-0.37,-1.39],[0,0],[2.32,-5.79],[1.46,2.8],[0,0],[-4.14,3.03],[0,0]],"v":[[64.79,39.37],[64.79,39.41],[62.71,39.41],[60.65,35.97],[60.57,35.9],[67.59,18.46],[72.05,26.86],[71.96,26.9],[64.79,39.37]],"c":true}}},{"ty":"sh","ks":{"k":{"i":[[0,0],[0.9,6.05],[0,0],[-4.07,0],[0,0.93],[0.07,0.22],[1.91,3.62],[-1.38,0],[0,-6.84],[6.8,0]],"o":[[-6.12,0],[0,-0.04],[4.07,0],[0.94,0],[0,-0.26],[-1.94,-3.66],[1.27,-0.45],[6.8,0],[0,6.8],[0,0]],"v":[[82.35,53.53],[70.14,43.04],[70.14,42.96],[82.35,42.96],[84.11,41.21],[84,40.46],[78.2,29.55],[82.35,28.84],[94.72,41.21],[82.35,53.53]],"c":true}}},{"ty":"fl","o":{"k":100},"c":{"k":[0,0,0,1]}}]}],"meta":{"g":"LF SVG to Lottie"}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Supports Core Animation engine
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.