-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58e187f
commit 2397c2b
Showing
3 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Examples | ||
|
||
#### Layered Liquid | ||
|
||
<img src=https://raw.githubusercontent.com/maustinstar/liquid/master/Docs/Media/liquid-circle.gif width=250 align="right" /> | ||
|
||
```swift | ||
struct ContentView: View { | ||
var body: some View { | ||
ZStack { | ||
Liquid() | ||
.frame(width: 240, height: 240) | ||
.foregroundColor(.blue) | ||
.opacity(0.3) | ||
|
||
|
||
Liquid() | ||
.frame(width: 220, height: 220) | ||
.foregroundColor(.blue) | ||
.opacity(0.6) | ||
|
||
Liquid(samples: 5) | ||
.frame(width: 200, height: 200) | ||
.foregroundColor(.blue) | ||
|
||
Text("Liquid").font(.largeTitle).foregroundColor(.white) | ||
} | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Reference | ||
|
||
Usage details for `Liquid` | ||
|
||
## Contents | ||
- [Basic Usage](#usage) | ||
- [Circles](#gradients) | ||
- [Custom Paths](#custom-paths) | ||
|
||
|
||
## Usage | ||
|
||
Just import Liquid, and add it to your View to get started. | ||
|
||
```swift | ||
Import Liquid | ||
... | ||
struct ContentView: View { | ||
var body: some View { | ||
Liquid().frame(width: 200, height: 200) | ||
} | ||
} | ||
``` | ||
|
||
## Circles | ||
|
||
#### `Liquid(samples: Int = 8, period: TimeInterval = 6)` | ||
|
||
Renders a circular Liquid view. | ||
|
||
**`samples`** - The number of anchor points along the circle's path, selected each period. Arcs are rendered between anchor points. With more samples, the shape looks more circular. With less samples, the shape looks more abstract. | ||
|
||
**`period`** - The duration between resampling. Longer periods appear to be slower and smooth. | ||
|
||
## Custom Paths | ||
|
||
#### `Liquid(_ path: CGPath, interpolate: Int, samples: Int, period: TimeInterval = 6)` | ||
|
||
Renders a Liquid view from a custom path. | ||
|
||
**`path`** - The source path to construct anchor points. | ||
|
||
**`interpolate`** - Number of points along the path to up-sample. Interpolation is important in adding definition to paths. For paths with low definition (for example, 10 points), should be up-sampled to 100 points. This increases anchor point candidates for each period. | ||
|
||
**`samples`** - The number of anchor points along the path, selected each period. Arcs are rendered between anchor points. With more samples, the shape looks more like the original path. With less samples, the shape looks more abstract. | ||
|
||
**`period`** - The duration between resampling. Longer periods appear to be slower and smooth. | ||
|
||
## Examples | ||
|
||
**See [Examples](https://github.com/maustinstar/liquid/blob/master/Docs/Examples.md).** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters