Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bd82ddebde | |||
| 4e9f5f1a5e | |||
| 673b9640cf | |||
| 90fe33531a | |||
| d20c565ee4 | |||
| 3f2a90ea9a | |||
| 9df1f477d2 | |||
| aa019d3bcb | |||
| 18582bd9da | |||
| 6b44a8a99e | |||
| 10a1b7dcc4 | |||
| a57242f3eb |
@@ -67,7 +67,7 @@ public class CircularProgressView: DeterminateAnimation {
|
||||
|
||||
backgroundCircle.strokeColor = foreground.colorWithAlphaComponent(0.5).CGColor
|
||||
backgroundCircle.fillColor = NSColor.clearColor().CGColor
|
||||
var backgroundPath = NSBezierPath()
|
||||
let backgroundPath = NSBezierPath()
|
||||
backgroundPath.appendBezierPathWithArcWithCenter(rect.mid, radius: radius, startAngle: 0, endAngle: 360)
|
||||
backgroundCircle.path = backgroundPath.CGPath
|
||||
self.layer?.addSublayer(backgroundCircle)
|
||||
@@ -82,8 +82,8 @@ public class CircularProgressView: DeterminateAnimation {
|
||||
|
||||
progressLayer.frame = rect
|
||||
progressLayer.strokeColor = foreground.CGColor
|
||||
var arcPath = NSBezierPath()
|
||||
var startAngle = CGFloat(90)
|
||||
let arcPath = NSBezierPath()
|
||||
let startAngle = CGFloat(90)
|
||||
arcPath.appendBezierPathWithArcWithCenter(rect.mid, radius: radius, startAngle: startAngle, endAngle: (startAngle - 360), clockwise: true)
|
||||
progressLayer.path = arcPath.CGPath
|
||||
self.layer?.addSublayer(progressLayer)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 494 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
@@ -61,7 +61,7 @@ public class CircularSnail: IndeterminateAnimation {
|
||||
var strokeEndAnimation: CABasicAnimation!
|
||||
|
||||
func makeAnimationforKeyPath(keyPath: String) -> CABasicAnimation {
|
||||
var tempAnimation = CABasicAnimation(keyPath: keyPath)
|
||||
let tempAnimation = CABasicAnimation(keyPath: keyPath)
|
||||
tempAnimation.repeatCount = 1
|
||||
tempAnimation.speed = 2.0
|
||||
tempAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
|
||||
@@ -91,7 +91,7 @@ public class CircularSnail: IndeterminateAnimation {
|
||||
let radius = (rect.width / 2) * 0.75
|
||||
progressLayer.frame = rect
|
||||
progressLayer.lineWidth = lineWidth == -1 ? radius / 10: lineWidth
|
||||
var arcPath = NSBezierPath()
|
||||
let arcPath = NSBezierPath()
|
||||
arcPath.appendBezierPathWithArcWithCenter(rect.mid, radius: radius, startAngle: 0, endAngle: 360, clockwise: false)
|
||||
progressLayer.path = arcPath.CGPath
|
||||
backgroundRotationLayer.addSublayer(progressLayer)
|
||||
@@ -99,7 +99,7 @@ public class CircularSnail: IndeterminateAnimation {
|
||||
|
||||
var currentRotation = 0.0
|
||||
let π2 = M_PI * 2
|
||||
override public func animationDidStop(anim: CAAnimation!, finished flag: Bool) {
|
||||
override public func animationDidStop(anim: CAAnimation, finished flag: Bool) {
|
||||
if !animate { return }
|
||||
CATransaction.begin()
|
||||
CATransaction.setDisableActions(true)
|
||||
|
||||
@@ -36,7 +36,7 @@ public class Crawler: IndeterminateAnimation {
|
||||
let insetRect = NSInsetRect(rect, rect.width * 0.15, rect.width * 0.15)
|
||||
|
||||
for var i = 0.0; i < 5; i++ {
|
||||
var starShape = CAShapeLayer()
|
||||
let starShape = CAShapeLayer()
|
||||
starList.append(starShape)
|
||||
starShape.backgroundColor = foreground.CGColor
|
||||
|
||||
@@ -46,16 +46,16 @@ public class Crawler: IndeterminateAnimation {
|
||||
starShape.position = CGPoint(x: rect.midX, y: rect.midY + insetRect.height / 2)
|
||||
self.layer?.addSublayer(starShape)
|
||||
|
||||
var arcPath = NSBezierPath()
|
||||
let arcPath = NSBezierPath()
|
||||
arcPath.appendBezierPathWithArcWithCenter(insetRect.mid, radius: insetRect.width / 2, startAngle: 90, endAngle: -360 + 90, clockwise: true)
|
||||
|
||||
var rotationAnimation = CAKeyframeAnimation(keyPath: "position")
|
||||
let rotationAnimation = CAKeyframeAnimation(keyPath: "position")
|
||||
rotationAnimation.path = arcPath.CGPath
|
||||
rotationAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
|
||||
rotationAnimation.beginTime = (duration * 0.075) * i
|
||||
rotationAnimation.calculationMode = kCAAnimationCubicPaced
|
||||
|
||||
var animationGroup = CAAnimationGroup()
|
||||
let animationGroup = CAAnimationGroup()
|
||||
animationGroup.animations = [rotationAnimation]
|
||||
animationGroup.duration = duration
|
||||
animationGroup.repeatCount = Float.infinity
|
||||
@@ -65,7 +65,7 @@ public class Crawler: IndeterminateAnimation {
|
||||
}
|
||||
|
||||
override func startAnimation() {
|
||||
for (index, star) in enumerate(starList) {
|
||||
for (index, star) in starList.enumerate() {
|
||||
star.addAnimation(animationGroups[index], forKey: "")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Rainbow: CircularSnail {
|
||||
self.background = NSColor.clearColor()
|
||||
}
|
||||
|
||||
override public func animationDidStop(anim: CAAnimation!, finished flag: Bool) {
|
||||
override public func animationDidStop(anim: CAAnimation, finished flag: Bool) {
|
||||
super.animationDidStop(anim, finished: flag)
|
||||
if onLightOffDark {
|
||||
progressLayer.strokeColor = lightColorList[Int(arc4random()) % lightColorList.count].CGColor
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ShootingStars: IndeterminateAnimation {
|
||||
tempAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn)
|
||||
}
|
||||
|
||||
override public func animationDidStop(anim: CAAnimation!, finished flag: Bool) {
|
||||
override public func animationDidStop(anim: CAAnimation, finished flag: Bool) {
|
||||
starLayer2.addAnimation(animation, forKey: "default")
|
||||
}
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@ public class Spinner: IndeterminateAnimation {
|
||||
var iRadian = CGFloat(i * M_PI / 180.0)
|
||||
if clockwise { iRadian = -iRadian }
|
||||
|
||||
animation.values.append(iRadian)
|
||||
var starShape = CAShapeLayer()
|
||||
animation.values?.append(iRadian)
|
||||
let starShape = CAShapeLayer()
|
||||
starShape.cornerRadius = roundedCorners ? starSize.width / 2 : 0
|
||||
|
||||
let centerLocation = CGPoint(x: frame.width / 2 - starSize.width / 2, y: frame.width / 2 - starSize.height / 2)
|
||||
|
||||
+2
-2
@@ -1,13 +1,13 @@
|
||||
Pod::Spec.new do |spec|
|
||||
spec.name = 'ProgressKit'
|
||||
spec.version = '0.0.1'
|
||||
spec.version = '0.2.0'
|
||||
spec.license = 'MIT'
|
||||
spec.summary = 'Animated ProgressViews for OSX'
|
||||
spec.homepage = 'https://github.com/kaunteya/ProgressKit'
|
||||
spec.authors = { 'Kaunteya Suryawanshi' => 'k.suryawanshi@gmail.com' }
|
||||
spec.source = { :git => 'https://github.com/kaunteya/ProgressKit.git', :tag => spec.version }
|
||||
|
||||
spec.platform = :osx, '10.9'
|
||||
spec.platform = :osx, '10.10'
|
||||
spec.requires_arc = true
|
||||
|
||||
spec.source_files = 'Determinate/*.swift', 'InDeterminate/*.swift', 'ProgressUtils.swift', 'BaseView.swift'
|
||||
|
||||
@@ -205,7 +205,9 @@
|
||||
E3AD65CA1B426758009541CD /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0630;
|
||||
LastSwiftMigration = 0700;
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = "Kauntey Suryawanshi";
|
||||
TargetAttributes = {
|
||||
E3AD65D11B426758009541CD = {
|
||||
@@ -328,6 +330,7 @@
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
@@ -394,6 +397,7 @@
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = ProgressKit/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.kaunteya.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -405,6 +409,7 @@
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = ProgressKit/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.kaunteya.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
@@ -424,6 +429,7 @@
|
||||
);
|
||||
INFOPLIST_FILE = ProgressKitTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.kaunteya.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ProgressKit.app/Contents/MacOS/ProgressKit";
|
||||
};
|
||||
@@ -440,6 +446,7 @@
|
||||
);
|
||||
INFOPLIST_FILE = ProgressKitTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.kaunteya.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ProgressKit.app/Contents/MacOS/ProgressKit";
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Application-->
|
||||
@@ -690,7 +690,7 @@
|
||||
<scene sceneID="poQ-ev-CZa">
|
||||
<objects>
|
||||
<viewController id="rgo-kk-Wcf" customClass="InDeterminateViewController" customModule="ProgressKit" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" id="lmx-kT-Si1">
|
||||
<view key="view" wantsLayer="YES" id="lmx-kT-Si1">
|
||||
<rect key="frame" x="0.0" y="0.0" width="500" height="184"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
|
||||
@@ -22,9 +22,9 @@ class DeterminateViewController: NSViewController {
|
||||
@IBAction func sliderDragged(sender: NSSlider) {
|
||||
|
||||
let event = NSApplication.sharedApplication().currentEvent
|
||||
let dragStart = event!.type == NSEventType.LeftMouseDown
|
||||
// let dragStart = event!.type == NSEventType.LeftMouseDown
|
||||
let dragEnd = event!.type == NSEventType.LeftMouseUp
|
||||
let dragging = event!.type == NSEventType.LeftMouseDragged
|
||||
// let dragging = event!.type == NSEventType.LeftMouseDragged
|
||||
|
||||
if liveProgress || dragEnd {
|
||||
setProgress(CGFloat(sender.floatValue))
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.kaunteya.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.kaunteya.$(PRODUCT_NAME:rfc1034identifier)</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@ extension NSRect {
|
||||
extension NSBezierPath {
|
||||
/// Converts NSBezierPath to CGPath
|
||||
var CGPath: CGPathRef {
|
||||
var path = CGPathCreateMutable()
|
||||
var points = UnsafeMutablePointer<NSPoint>.alloc(3)
|
||||
let path = CGPathCreateMutable()
|
||||
let points = UnsafeMutablePointer<NSPoint>.alloc(3)
|
||||
let numElements = self.elementCount
|
||||
|
||||
if numElements > 0 {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||

|
||||

|
||||
|
||||
`ProgressKit` has set of cool `IBDesignable` progress views, with huge customisation options.
|
||||
You can now make spinners, progress bar, crawlers etc, which nicely gets integrated according to your app theme.
|
||||
|
||||
# Contents
|
||||
- [Installation](#installation)
|
||||
@@ -12,7 +14,7 @@
|
||||
- [Determinate Progress](#determinate-progress)
|
||||
- [Circular Progress] (#circular-progress)
|
||||
- [Progress Bar](#progress-bar)
|
||||
|
||||
- [License](#license)
|
||||
|
||||
# Installation
|
||||
##CocoaPods
|
||||
@@ -34,11 +36,11 @@ $ pod install
|
||||
|
||||
# Usage
|
||||
- Drag a View at desired location in `XIB` or `Storyboard`
|
||||
- Change the Class to any of the desired progress Views
|
||||
- Change the Class to any of the desired progress views
|
||||
- Set the size such that width and height are equal
|
||||
- Drag `IBOutlet` to View Controller
|
||||
- For `Indeterminate` Progress Views
|
||||
- Call `view.startAnimation()` and `view.stopAnimation()`
|
||||
- Set `Boolean` value to `view.animate`
|
||||
- For `Determinate` Progress Views:
|
||||
- Set `view.progress` to value in `0...1`
|
||||
|
||||
@@ -50,7 +52,6 @@ Progress indicators which animate indefinately are `Indeterminate Progress` View
|
||||
|
||||
This are the InDeterminate Progress Indicators.
|
||||
|
||||
|
||||
## CircularSnail
|
||||

|
||||
|
||||
@@ -69,4 +70,6 @@ Determinate progress views can be used for tasks whos progress can be seen and d
|
||||
## Progress Bar
|
||||

|
||||
|
||||
# License
|
||||
`ProgressKit` is released under the MIT license. See LICENSE for details.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user