Skip to content

Commit

Permalink
Minor adjustments to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mahal committed Apr 10, 2024
1 parent cf7cfc6 commit fffd995
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions Sources/AudioKitUI/Controls/ADSRView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import AVFoundation
import UIKit

/// A click and draggable view of an ADSR Envelope (Atttack, Decay, Sustain, Release)
///
/// All values are normalised 0->1, so scale them how you would like in your callback

@IBDesignable public class ADSRView: UIView {
Expand Down
7 changes: 3 additions & 4 deletions Sources/AudioKitUI/Helpers/MorphableShape.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,16 @@ struct MorphableShape: Shape {
}
}

// MARK: Path extension

/// Return points at a given offset and create AnimatableVector for control points
extension Path {
// return point at the curve
/// return point at the curve
func point(at offset: CGFloat) -> CGPoint {
let limitedOffset = min(max(offset, 0), 1)
guard limitedOffset > 0 else { return cgPath.currentPoint }
return trimmedPath(from: 0, to: limitedOffset).cgPath.currentPoint
}

// return control points along the path
/// return control points along the path
func controlPoints(count: Int) -> AnimatableVector {
var retPoints = [Double]()
for index in 0 ..< count {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
import Foundation
import UIKit

/// usage You can use it to get an intermediate color between two or more colors:
/// let color = [.green, .yellow, .red].intermediate(0.7)
/// inspired by
/// https://stackoverflow.com/questions/15032562/ios-find-color-at-point-between-two-colors/59996029#59996029
/// Get an intermediate color between two or more colors
///
/// Example: `let color = [.green, .yellow, .red].intermediate(0.7)`
///
/// inspired by [stackoverflow 15032562 answer Nikaaner](https://stackoverflow.com/questions/15032562/ios-find-color-at-point-between-two-colors/59996029#59996029)
extension Array where Element: UIColor {
/// Get an intermediate color between two or more colors
///
/// Example: `let color = [.green, .yellow, .red].intermediate(0.7)`
public func intermediate(_ percentage: CGFloat) -> UIColor {
let percentage = Swift.max(Swift.min(percentage, 1), 0)
switch percentage {
Expand Down

0 comments on commit fffd995

Please sign in to comment.