git.iko.soy/metal-metaballs
on master help sign in
Encapsulated a few interpolation functions.
4516e09vinivendra
PixelImage.xcodeproj/project.pbxproj+4
@@ -12,6 +12,7 @@
12 2426868D1C63B72A00D62456 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2426868B1C63B72A00D62456 /* Main.storyboard */; };
12 2426868D1C63B72A00D62456 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2426868B1C63B72A00D62456 /* Main.storyboard */; };
13 2426868F1C63B72A00D62456 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2426868E1C63B72A00D62456 /* Assets.xcassets */; };
13 2426868F1C63B72A00D62456 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2426868E1C63B72A00D62456 /* Assets.xcassets */; };
14 242686921C63B72A00D62456 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 242686901C63B72A00D62456 /* LaunchScreen.storyboard */; };
14 242686921C63B72A00D62456 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 242686901C63B72A00D62456 /* LaunchScreen.storyboard */; };
15+ 2461651B1C6DA4F400A913C8 /* Interpolation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2461651A1C6DA4F400A913C8 /* Interpolation.swift */; };
15 249CF84C1C6D113C008B0C78 /* Matrix.swift in Sources */ = {isa = PBXBuildFile; fileRef = 249CF84B1C6D113C008B0C78 /* Matrix.swift */; };
16 249CF84C1C6D113C008B0C78 /* Matrix.swift in Sources */ = {isa = PBXBuildFile; fileRef = 249CF84B1C6D113C008B0C78 /* Matrix.swift */; };
16 24E1E7D71C67C8B200ECF1C4 /* UIKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24E1E7D61C67C8B200ECF1C4 /* UIKit.swift */; };
17 24E1E7D71C67C8B200ECF1C4 /* UIKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24E1E7D61C67C8B200ECF1C4 /* UIKit.swift */; };
17 24E1E7E21C67D37F00ECF1C4 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 24E1E7E11C67D37F00ECF1C4 /* Metal.framework */; };
18 24E1E7E21C67D37F00ECF1C4 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 24E1E7E11C67D37F00ECF1C4 /* Metal.framework */; };
@@ -58,6 +59,7 @@
58 2426868E1C63B72A00D62456 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
59 2426868E1C63B72A00D62456 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
59 242686911C63B72A00D62456 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
60 242686911C63B72A00D62456 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
60 242686931C63B72A00D62456 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
61 242686931C63B72A00D62456 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
62+ 2461651A1C6DA4F400A913C8 /* Interpolation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Interpolation.swift; path = PixelImage/Interpolation.swift; sourceTree = SOURCE_ROOT; };
61 249CF84B1C6D113C008B0C78 /* Matrix.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Matrix.swift; sourceTree = "<group>"; };
63 249CF84B1C6D113C008B0C78 /* Matrix.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Matrix.swift; sourceTree = "<group>"; };
62 24E1E7D61C67C8B200ECF1C4 /* UIKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIKit.swift; sourceTree = "<group>"; };
64 24E1E7D61C67C8B200ECF1C4 /* UIKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIKit.swift; sourceTree = "<group>"; };
63 24E1E7E11C67D37F00ECF1C4 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
65 24E1E7E11C67D37F00ECF1C4 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
@@ -151,6 +153,7 @@
151 isa = PBXGroup;
153 isa = PBXGroup;
152 children = (
154 children = (
153 24FFA84C1C6BA038005ACD60 /* ApproximationOperator.swift */,
155 24FFA84C1C6BA038005ACD60 /* ApproximationOperator.swift */,
156+ 2461651A1C6DA4F400A913C8 /* Interpolation.swift */,
154 24FFA84D1C6BA038005ACD60 /* Collections.swift */,
157 24FFA84D1C6BA038005ACD60 /* Collections.swift */,
155 24FFA84E1C6BA038005ACD60 /* ComparatorChains.swift */,
158 24FFA84E1C6BA038005ACD60 /* ComparatorChains.swift */,
156 24FFA84F1C6BA038005ACD60 /* Dictionary.swift */,
159 24FFA84F1C6BA038005ACD60 /* Dictionary.swift */,
@@ -286,6 +289,7 @@
286 24FFA8841C6BA038005ACD60 /* TakeDrop.swift in Sources */,
289 24FFA8841C6BA038005ACD60 /* TakeDrop.swift in Sources */,
287 24FFA8771C6BA038005ACD60 /* ChunkWindowSplit.swift in Sources */,
290 24FFA8771C6BA038005ACD60 /* ChunkWindowSplit.swift in Sources */,
288 24FFA86F1C6BA038005ACD60 /* NSNumber.swift in Sources */,
291 24FFA86F1C6BA038005ACD60 /* NSNumber.swift in Sources */,
292+ 2461651B1C6DA4F400A913C8 /* Interpolation.swift in Sources */,
289 24FFA8861C6BA038005ACD60 /* TestCommons.swift in Sources */,
293 24FFA8861C6BA038005ACD60 /* TestCommons.swift in Sources */,
290 24FFA8741C6BA038005ACD60 /* SignOperator.swift in Sources */,
294 24FFA8741C6BA038005ACD60 /* SignOperator.swift in Sources */,
291 24FFA8821C6BA038005ACD60 /* ScanReduce.swift in Sources */,
295 24FFA8821C6BA038005ACD60 /* ScanReduce.swift in Sources */,
PixelImage/Interpolation.swiftnew file+17
@@ -0,0 +1,17 @@
1+
2+func interpolateCubeEaseIn<T: Numeric>(linear: T) -> T {
3+ return linear ^ 3
4+}
5+
6+func interpolateSquareEaseIn<T: Numeric>(linear: T) -> T {
7+ return linear ^ 2
8+}
9+
10+func interpolateSquareEaseOut<T: Numeric>(linear: T) -> T {
11+ return 1 - (1 - linear) * (1 - linear)
12+}
13+
14+func interpolateSmooth<T: Numeric>(linear: T) -> T {
15+ return ((linear) * (linear) * (linear) * ((linear) * ((linear) * 6 - 15) + 10))
16+}
17+