Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
maustinstar committed Aug 18, 2020
1 parent 58e187f commit 2397c2b
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 1 deletion.
30 changes: 30 additions & 0 deletions Docs/Examples.md
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)
}
}
}
```
51 changes: 51 additions & 0 deletions Docs/Reference.md
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).**
2 changes: 1 addition & 1 deletion Sources/Liquid/PublicViews/Liquid.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public struct Liquid: View {

/// A blob resembling a custom path
/// - Parameters:
/// - path: path to generat blob
/// - path: the source path to construct anchor points
/// - interpolate: number of points along the path to up-sample
/// - samples: the number of samples to select at each animation
/// - period: length of animation
Expand Down

0 comments on commit 2397c2b

Please sign in to comment.