Updated readme. Scaling handle made to inflate like a balloon.

This commit is contained in:
Jonathan Cardasis 2019-04-19 18:47:06 -04:00
parent 5de59e1092
commit d6c49a9d47
2 changed files with 24 additions and 4 deletions

View File

@ -30,24 +30,39 @@ colorPicker.connect(brightnessSlider) // or `brightnessSlider.connect(to: colorP
```
## Installation
### Carthage
```
```bash
github "joncardasis/ChromaColorPicker"
```
### Cocoapods
```
```bash
pod 'ChromaColorPicker'
```
### Manually
Add all files from the `Source` folder to your project.
## Components
## Usage
### Multiple Handles
```Swift
// Add handles
{TODO}
// Add a custom handle
{TODO}
// Remove handles
{TODO}
```
## Components
### ChromaColorPicker
An HSB color picker with support for adding multiple color selection handles.
### ChromaBrightnessSlider
[ChromaBrightnessSlider]() is a slider UIControl which can be attached to any `ChromaColorPicker` via the `connect(to:)` method. ChromaBrightnessSlider can also function as a stand-alone UIControl.
### Supported UIControlEvents
| Event | Description |

View File

@ -221,8 +221,13 @@ public class ChromaColorPicker: UIControl, ChromaControlStylable {
internal func animateHandleScale(_ handle: ChromaColorHandle, shouldGrow: Bool) {
if shouldGrow && handle.transform.d > 1 { return } // Already grown
let scalar: CGFloat = 1.25
let transform = shouldGrow ? CGAffineTransform(scaleX: 1.25, y: 1.25) : CGAffineTransform(scaleX: 1, y: 1)
var transform: CGAffineTransform = .identity
if shouldGrow {
let translateY = -handle.bounds.height * (scalar - 1) / 2
transform = CGAffineTransform(scaleX: scalar, y: scalar).translatedBy(x: 0, y: translateY)
}
UIView.animate(withDuration: 0.15, delay: 0, usingSpringWithDamping: 1.0, initialSpringVelocity: 0.6, options: .curveEaseInOut, animations: {
handle.transform = transform