From 517e33e2cb63f728e4d945701ae18b57ed37b8ce Mon Sep 17 00:00:00 2001 From: Alisa Mylnikova Date: Tue, 2 Jun 2020 15:49:17 +0700 Subject: [PATCH 1/4] Add path animation --- Example/Example.xcodeproj/project.pbxproj | 12 +++ Example/Example/Base.lproj/Main.storyboard | 66 ++++++++++---- .../PathAnimation/PathAnimationView.swift | 88 +++++++++++++++++++ Example/Example/MenuViewController.swift | 3 +- Macaw.xcodeproj/project.pbxproj | 12 ++- Source/animation/AnimationImpl.swift | 1 + Source/animation/AnimationProducer.swift | 6 ++ Source/animation/types/PathAnimation.swift | 69 +++++++++++++++ .../MorphingGenerator.swift | 22 +---- .../PathAnimationGenerator.swift | 73 +++++++++++++++ .../ShapeAnimationGenerator.swift | 26 +----- Source/views/ShapeLayer.swift | 32 +++++++ 12 files changed, 342 insertions(+), 68 deletions(-) create mode 100644 Example/Example/Examples/PathAnimation/PathAnimationView.swift create mode 100644 Source/animation/types/PathAnimation.swift create mode 100644 Source/animation/types/animation_generators/PathAnimationGenerator.swift diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index 02ca1de2..1315fb84 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 57AF398C1E67E9DB00F0BFE2 /* EventsExampleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57AF398B1E67E9DB00F0BFE2 /* EventsExampleController.swift */; }; 58E4D50C1D841C6E00EC8815 /* TransformExampleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58E4D50B1D841C6E00EC8815 /* TransformExampleView.swift */; }; 5B195EAD2276D5C40008AE8B /* AnimationsHierarchyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B195EAB2276D5C40008AE8B /* AnimationsHierarchyViewController.swift */; }; + 5B5B393B2481094200753058 /* PathAnimationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B5B393A2481094200753058 /* PathAnimationView.swift */; }; 5BAE3CB120C54E3D006BEF51 /* FiltersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BAE3CB020C54E3D006BEF51 /* FiltersViewController.swift */; }; 66AE19DB1CC8CB3C00B78B5E /* tiger.svg in Resources */ = {isa = PBXBuildFile; fileRef = 66AE19DA1CC8CB3C00B78B5E /* tiger.svg */; }; B02E75F11C16104900D1971D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B02E75F01C16104900D1971D /* AppDelegate.swift */; }; @@ -52,6 +53,7 @@ 57AF398B1E67E9DB00F0BFE2 /* EventsExampleController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventsExampleController.swift; sourceTree = ""; }; 58E4D50B1D841C6E00EC8815 /* TransformExampleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransformExampleView.swift; sourceTree = ""; }; 5B195EAB2276D5C40008AE8B /* AnimationsHierarchyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimationsHierarchyViewController.swift; sourceTree = ""; }; + 5B5B393A2481094200753058 /* PathAnimationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PathAnimationView.swift; sourceTree = ""; }; 5BAE3CB020C54E3D006BEF51 /* FiltersViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FiltersViewController.swift; sourceTree = ""; }; 66AE19DA1CC8CB3C00B78B5E /* tiger.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = tiger.svg; path = Example/Assets/SVG/tiger.svg; sourceTree = ""; }; B02E75ED1C16104900D1971D /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -105,6 +107,7 @@ 574EC4271CB7DE7F0063F317 /* Examples */ = { isa = PBXGroup; children = ( + 5B5B39392481092A00753058 /* PathAnimation */, 49265C7E2227B1B200923A66 /* Text */, 574EC4331CB7DE7F0063F317 /* Shapes */, 6699B7CE1DFFE8B90072585E /* Transform */, @@ -153,6 +156,14 @@ path = Easing; sourceTree = ""; }; + 5B5B39392481092A00753058 /* PathAnimation */ = { + isa = PBXGroup; + children = ( + 5B5B393A2481094200753058 /* PathAnimationView.swift */, + ); + path = PathAnimation; + sourceTree = ""; + }; 5BAE3CAF20C54DA5006BEF51 /* Filters */ = { isa = PBXGroup; children = ( @@ -374,6 +385,7 @@ 5B195EAD2276D5C40008AE8B /* AnimationsHierarchyViewController.swift in Sources */, 58E4D50C1D841C6E00EC8815 /* TransformExampleView.swift in Sources */, B02E75F11C16104900D1971D /* AppDelegate.swift in Sources */, + 5B5B393B2481094200753058 /* PathAnimationView.swift in Sources */, 5BAE3CB120C54E3D006BEF51 /* FiltersViewController.swift in Sources */, 57AF398C1E67E9DB00F0BFE2 /* EventsExampleController.swift in Sources */, B04416FA1E041A420016BC50 /* EasingView.swift in Sources */, diff --git a/Example/Example/Base.lproj/Main.storyboard b/Example/Example/Base.lproj/Main.storyboard index 7c03ebd3..c7fcf934 100644 --- a/Example/Example/Base.lproj/Main.storyboard +++ b/Example/Example/Base.lproj/Main.storyboard @@ -1,11 +1,9 @@ - - - - + + - + @@ -14,7 +12,7 @@ - + @@ -38,10 +36,10 @@ - + - + @@ -50,7 +48,7 @@ - + @@ -91,7 +89,7 @@ - +