Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Demo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

wave = WaveAnimationView(frame: CGRect(origin: .zero, size: lapView.bounds.size), color: UIColor.blue.withAlphaComponent(0.5))
wave = WaveAnimationView(frame: CGRect(origin: .zero, size: CGSize(width: 64, height: 64)), color: UIColor.orange.withAlphaComponent(0.5))
wave.waveHeight = 7
wave.waveDelay = 300
wave.zoom = 0.15
lapView.addSubview(wave)
//superView.addSubView(WaveAnimationView)
wave.startAnimation()
Expand Down
3 changes: 2 additions & 1 deletion WaveAnimationView/WaveAnimationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class WaveAnimationView: UIView {

open var waveHeight: CGFloat = 15.0 //3.0 .. about 50.0 are standard.
open var waveDelay: CGFloat = 300.0 //0.0 .. about 500.0 are standard.
open var zoom: CGFloat = 1.0

open var frontColor: UIColor!
open var backColor: UIColor!
Expand Down Expand Up @@ -134,7 +135,7 @@ public class WaveAnimationView: UIView {
private func drawSin(path: UIBezierPath, time: CGFloat, delay: CGFloat) {

let unit:CGFloat = 100.0
let zoom:CGFloat = 1.0
let zoom:CGFloat = self.zoom
var x = time
var y = sin(x)/zoom
let start = CGPoint(x: yAxis, y: unit*y+xAxis)
Expand Down