diff --git a/Comets.podspec b/Comets.podspec
index 9747e27..1ae8cc8 100644
--- a/Comets.podspec
+++ b/Comets.podspec
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = 'Comets'
- s.version = '0.3.0'
+ s.version = '0.3.1'
s.summary = '☄️Comets: Animating Particles in Swift'
# This description is used to generate tags and improve search results.
diff --git a/Comets/Info.plist b/Comets/Info.plist
index 6218651..8e55db8 100644
--- a/Comets/Info.plist
+++ b/Comets/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 0.3.0
+ 0.3.1
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
diff --git a/Comets/Sources/Comet.swift b/Comets/Sources/Comet.swift
index 4ef0262..fb1e19d 100644
--- a/Comets/Sources/Comet.swift
+++ b/Comets/Sources/Comet.swift
@@ -1,12 +1,19 @@
public struct Comet {
- public var startPoint: CGPoint
- public var endPoint: CGPoint
- public var lineColor: UIColor
+ let startPoint: CGPoint
+ let endPoint: CGPoint
+ let lineColor: UIColor
+ let cometColor: UIColor
- public init(startPoint: CGPoint, endPoint: CGPoint, lineColor: UIColor) {
+ public init(
+ startPoint: CGPoint,
+ endPoint: CGPoint,
+ lineColor: UIColor = UIColor.white.withAlphaComponent(0.2),
+ cometColor: UIColor = UIColor.white
+ ) {
self.startPoint = startPoint
self.endPoint = endPoint
self.lineColor = lineColor
+ self.cometColor = cometColor
}
public var linePath: UIBezierPath {
@@ -45,9 +52,9 @@ public struct Comet {
return emitter
}
- public var contents: Any? {
+ private var contents: Any? {
let cometLayer = CAGradientLayer()
- cometLayer.colors = [UIColor.white.withAlphaComponent(0.0).cgColor, UIColor.white.cgColor]
+ cometLayer.colors = [cometColor.withAlphaComponent(0.0).cgColor, cometColor.cgColor]
cometLayer.cornerRadius = 0.25
cometLayer.frame = CGRect(x: 0, y: 0, width: 80, height: 0.5)
cometLayer.locations = [0.0, 1.0]
diff --git a/CometsTests/Info.plist b/CometsTests/Info.plist
index 14f8bbd..b03085a 100644
--- a/CometsTests/Info.plist
+++ b/CometsTests/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
BNDL
CFBundleShortVersionString
- 0.3.0
+ 0.3.1
CFBundleVersion
1
diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift
index a240c04..1518307 100644
--- a/Example/Example/ViewController.swift
+++ b/Example/Example/ViewController.swift
@@ -37,25 +37,32 @@ class ViewController: UIViewController {
let height = view.bounds.height
let comets = [Comet(startPoint: CGPoint(x: 100, y: 0),
endPoint: CGPoint(x: 0, y: 100),
- lineColor: UIColor.white.withAlphaComponent(0.2)),
+ lineColor: UIColor.red.withAlphaComponent(0.2),
+ cometColor: UIColor.red),
Comet(startPoint: CGPoint(x: 0.4 * width, y: 0),
endPoint: CGPoint(x: width, y: 0.8 * width),
- lineColor: UIColor.white.withAlphaComponent(0.2)),
+ lineColor: UIColor.red.withAlphaComponent(0.2),
+ cometColor: UIColor.red),
Comet(startPoint: CGPoint(x: 0.8 * width, y: 0),
endPoint: CGPoint(x: width, y: 0.2 * width),
- lineColor: UIColor.white.withAlphaComponent(0.2)),
+ lineColor: UIColor.red.withAlphaComponent(0.2),
+ cometColor: UIColor.red),
Comet(startPoint: CGPoint(x: width, y: 0.2 * height),
endPoint: CGPoint(x: 0, y: 0.25 * height),
- lineColor: UIColor.white.withAlphaComponent(0.2)),
+ lineColor: UIColor.red.withAlphaComponent(0.2),
+ cometColor: UIColor.red),
Comet(startPoint: CGPoint(x: 0, y: height - 0.8 * width),
endPoint: CGPoint(x: 0.6 * width, y: height),
- lineColor: UIColor.white.withAlphaComponent(0.2)),
+ lineColor: UIColor.red.withAlphaComponent(0.2),
+ cometColor: UIColor.red),
Comet(startPoint: CGPoint(x: width - 100, y: height),
endPoint: CGPoint(x: width, y: height - 100),
- lineColor: UIColor.white.withAlphaComponent(0.2)),
+ lineColor: UIColor.red.withAlphaComponent(0.2),
+ cometColor: UIColor.red),
Comet(startPoint: CGPoint(x: 0, y: 0.8 * height),
endPoint: CGPoint(x: width, y: 0.75 * height),
- lineColor: UIColor.white.withAlphaComponent(0.2))]
+ lineColor: UIColor.red.withAlphaComponent(0.2),
+ cometColor: UIColor.red)]
// draw track and animate
for comet in comets {
diff --git a/Example/Podfile.lock b/Example/Podfile.lock
index c6a414b..9028477 100644
--- a/Example/Podfile.lock
+++ b/Example/Podfile.lock
@@ -1,5 +1,5 @@
PODS:
- - Comets (0.3.0)
+ - Comets (0.3.1)
- Gradients (0.3.0)
- SnapKit (5.0.0)
@@ -18,7 +18,7 @@ EXTERNAL SOURCES:
:path: "../"
SPEC CHECKSUMS:
- Comets: 80ad7341f67f2743b5f8bdcfaf299956b9840d57
+ Comets: ff75eb4658d612af66073bf9fcf6e8bef274817b
Gradients: d7e1be639692b86577616ee55ea96f54fb5f1de1
SnapKit: fd22d10eb9aff484d79a8724eab922c1ddf89bcf
diff --git a/README.md b/README.md
index 6495d54..04051c7 100644
--- a/README.md
+++ b/README.md
@@ -20,25 +20,32 @@ let width = view.bounds.width
let height = view.bounds.height
let comets = [Comet(startPoint: CGPoint(x: 100, y: 0),
endPoint: CGPoint(x: 0, y: 100),
- lineColor: UIColor.white.withAlphaComponent(0.2)),
+ lineColor: UIColor.white.withAlphaComponent(0.2),
+ cometColor: UIColor.white),
Comet(startPoint: CGPoint(x: 0.4 * width, y: 0),
endPoint: CGPoint(x: width, y: 0.8 * width),
- lineColor: UIColor.white.withAlphaComponent(0.2)),
+ lineColor: UIColor.white.withAlphaComponent(0.2),
+ cometColor: UIColor.white),
Comet(startPoint: CGPoint(x: 0.8 * width, y: 0),
endPoint: CGPoint(x: width, y: 0.2 * width),
- lineColor: UIColor.white.withAlphaComponent(0.2)),
+ lineColor: UIColor.white.withAlphaComponent(0.2),
+ cometColor: UIColor.white),
Comet(startPoint: CGPoint(x: width, y: 0.2 * height),
endPoint: CGPoint(x: 0, y: 0.25 * height),
- lineColor: UIColor.white.withAlphaComponent(0.2)),
+ lineColor: UIColor.white.withAlphaComponent(0.2),
+ cometColor: UIColor.white),
Comet(startPoint: CGPoint(x: 0, y: height - 0.8 * width),
endPoint: CGPoint(x: 0.6 * width, y: height),
- lineColor: UIColor.white.withAlphaComponent(0.2)),
+ lineColor: UIColor.white.withAlphaComponent(0.2),
+ cometColor: UIColor.white),
Comet(startPoint: CGPoint(x: width - 100, y: height),
endPoint: CGPoint(x: width, y: height - 100),
- lineColor: UIColor.white.withAlphaComponent(0.2)),
+ lineColor: UIColor.white.withAlphaComponent(0.2),
+ cometColor: UIColor.white),
Comet(startPoint: CGPoint(x: 0, y: 0.8 * height),
endPoint: CGPoint(x: width, y: 0.75 * height),
- lineColor: UIColor.white.withAlphaComponent(0.2))]
+ lineColor: UIColor.white.withAlphaComponent(0.2),
+ cometColor: UIColor.white)]
// draw line track and animate
for comet in comets {
@@ -62,7 +69,7 @@ pod "Comets"
### Carthage
```
-github "cruisediary/Comets" ~> 0.3.0
+github "cruisediary/Comets" ~> 0.3.1
```
## ❤️ Contribution