GithubHelp home page GithubHelp logo

kycircularprogress's People

Contributors

katsumeshi avatar kentya6 avatar readmecritic avatar softwareengineer48 avatar tamanyan avatar wanbok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kycircularprogress's Issues

Add support to Carthage

I know this might seem overkill for the size of your project, but it would help a lot to keep up with updates.

Unable to Set Colors

When I set colors on the circularProgress view, I get a runtime error. I also get the error when I run the sample project. For example:

//the exception happens when I do this
circularProgress.colors = [0xFFF77A, 0xF3C0AB];

Here is the error:

KYCircularProgress.swift
Line 60. self.gradientLayer.colors = convertedColors
fatal error: array element cannot be bridged to Objective-C

Any way to stop/reset animation to start new one?

Hi, thanks for this open source project. Like it so far but cannot get some wanted behavior.
I want to use single circular bar for multiple cases, or dynamically change its current progress.
But, as soon as I start animation there is no way to reset it to another value to start new animation.

For example I tried to start animation from 0.6 to 0 in 600 seconds.
After some user progress, I want to reset animation without waiting it to finish all 10 minutes, for example, to progress 0.8 and animate to 0 in 300 seconds.
But it just starts from previous animation last position and resets timer to 300 even if very small portion left, it divides that portion into.. 300 seconds.
Im trying to set its inital value too, not only duration.

I tried so far

popupProgressCircle.progress = 0.8 // Doesnt work if animation in progress
popupProgressCircle.set(progress: 0.8, duration: 0)  // Also doesnt work if animation in progress
popupProgressCircle.set(progress: 0.8, duration: 0.000001) // This just breaks everything, may be because next part is called immediately, and code execution is faster than 0.000001

popupProgressCircle.set(progress: 0, duration: 300) // This works, but because of above part doesnt work, it is just making  slower and slower every attempts remaining part

So I want to achieve - either reset/stop animation in order to safely set new progress value, or just set progress value and it is automatically stops all current animations.
On top of that, there is no way to check if any animation is currently ongoing without waiting progress delegate~ But its just minor issue

Using Swift 5.1 and XCode 11.

Progress animation should start from current state

If I call setProgress(progress:duration) several times, it appears that animations are not updated smoothly. I suspect is due to the fact that when calling setProgress(progress:duration) the new animation starts where the previous one ends, even if it is not terminated.

If you confirm my analysis, I can work on a Pull request to correct this.

Autolayout issues when KYCircularProgress created programmatically

I have issue setting correct width and height for progress view.

 let circularProgressView : KYCircularProgress = {
        // this way (without some default frame) it doesnt work at all, even though autolayout sets frame later.
        //let circularProgress = KYCircularProgress()

        // Random height/width
        let circularProgress = KYCircularProgress(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
        circularProgress.lineWidth = 3.2
        circularProgress.guideLineWidth = 2.8
        circularProgress.lineCap = CAShapeLayerLineCap.round.rawValue
        circularProgress.translatesAutoresizingMaskIntoConstraints = false
        circularProgress.backgroundColor = .white
        return circularProgress
    }()

For this code, and constrainting circularProgressView to 5 for top, bottom, trailing and aspectRatio 1 (perfect square):

circularProgressView.topAnchor.constraint(equalTo: graphContainer.topAnchor, constant: 5).isActive = true
        circularProgressView.trailingAnchor.constraint(equalTo: graphContainer.trailingAnchor, constant: -5).isActive = true
        circularProgressView.bottomAnchor.constraint(equalTo: graphContainer.bottomAnchor, constant: -5).isActive = true
        circularProgressView.widthAnchor.constraint(equalTo: circularProgressView.heightAnchor, multiplier: 1).isActive = true

I am getting following result

Screen Shot 2020-02-06 at 5 40 30 PM

As you can see, autolayout setting correct frame according to white background color, inner circleViews are resized (from 100, 100 to 41, 41 frame). But inner circles are not perfectly centered, approximately: (left: 5 top: 5, bottom: 8, right: 8), and dont have size I need (same as white circle).
Am I missing something? circularProgressView.setNeedsLayout on parent LayoutSubviews doesnt work.

Swift 5, XCode 11.3.1 (11C504)

Convert it to slider

Is it possible to convert it to a UISlider ? I'm not really good in Swift so, i don't know if i'm able to do it myself.

Thanks for your control.

Isn't there anyway not to reset when it reached 100%

Sorry, there is no such place that I could ask about this. so I post it here.

I would like to show various data through this framework, however it keeps being reset.

on my project I used timer.scheduled to get some animation.
there is 2 integers I have set

for example

private var progress: UInt8 = 0
var totalAmount:Int = 28000
var paidAmount:Int = 8000
@IBOutlet private weak var storyboardCircularProgress1: KYCircularProgress!
@IBOutlet private weak var progressLabel: UILabel!

override func viewDidLoad() {
    super.viewDidLoad()
    
    configureStoryboardProgress1()
    updateProgress()
}

private func configureStoryboardProgress1() {
    storyboardCircularProgress1.colors = [.purple, .purple, .purple]
    storyboardCircularProgress1.progressChanged {
        (progress: Double, circularProgress: KYCircularProgress) in
        self.progressLabel.text = String.init(format: "%.0f", progress * 100.0) + "%"
    }
    storyboardCircularProgress1.
}

@objc private func updateProgress() {
    progress = progress &+ 2
    let normalizedProgress = Double(progress) / Double(UInt8.max)
    storyboardCircularProgress1.progress = normalizedProgress
    if progress == 255
    {
        
    }
    if progress < UInt8(Double(paidAmount) / Double(totalAmount) * 255)
    {
        self.addTime()
    }
}

func addTime()
{
    Timer.scheduledTimer(timeInterval: 0.01, target: self, selector: #selector(updateProgress), userInfo: nil, repeats: false)
}

}

the animation showed 30% whiles it's about 29.6% that's great however, when I set

var totalAmount:Int = 28000
var paidAmount:Int = 0

the result will be 1% that's weird and also

var totalAmount:Int = 28000
var paidAmount:Int = 28000

then the result keeps being reset and animation goes forever like your demo.
I really wish that I could use the framework for my project, it's really simple and nice but I'm not capable enough to fix this problem. Hope you could kindly guide me to right path.

Thanks million in advance.

Parameters: startAngle & endAngle don't work

Thanks for tool.
KYCircularProgress class doesn't handle correctly changing values startAngle & endAngle.
It happens because of method layoutSubviews in KYCircularShapeView only calls one time (KYCircularShapeView wasn't added as subview).
I think the KYCircularShapeView should update path every time when we update angle values

Constraints Causing Display Issue (Xcode 8)

I've run into an issue in xcode 8 where applying constraints or using autoresizing on the KYCircularProgress view causes the progress bar to display in unexpected ways.

Positioning constraints appear to affect the guide line, causing it to no longer display (or be moved outside of the view). Any constraints relating to the size of the view (width, height etc.) cause the progress line to be massively enlarged.

The views frame appears to react correctly to the constraints, it is just the graphic that is affected. Setting the constraints programmatically has the same effect.

Setting the constraints and saving the storyboard for xcode 7 fixes the issues. This works fine as a workaround

No Constraints

simulator screen shot 24 oct 2016 12 55 32 pm

Positioning Constraints

positioning

Size Constraints

sizing

Layer frame not changing with Autolayout

I'm using autolayout and I've set constraints to the KYCircularProgress view.
But after autolayout resized it's frame - KYCircularProgress's layer doesn't redraw according to the new frame.

Circle Offset

I wanted to implement a gauge with that framework.
I came across an issue where the circle was offset to the right.

gauges

I colored the frames of the label (which is centred) and the gauge itself. as you can see the circle is offset. In my implementation I did nothing else then setting the lineWidths and colours

Full Full the Circle

Hi, is possible to use this to get a full circle and filled? i mean draw a white circle and animate the completion of the progress of it using another color?

CircularProgress.startAngle doesn't take effect

Hi ,

I just want the animation start from the top of the circle.
So I set the startAngle as -Double.pi / 2 , but it still start from 0 .
Is there anything I missed?

Here is my code :
@IBAction func runAction(_ sender: Any) {
productACircularProgress.colors = [.purple, UIColor(rgba: 0xFFF77 A55), .orange]
productACircularProgress.startAngle = -Double.pi / 2
productACircularProgress.set(progress: 0.618, duration: 0.75)
}

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.