Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animation does not cycle through all colors #6

Open
ekoranek12 opened this issue May 15, 2017 · 9 comments
Open

Animation does not cycle through all colors #6

ekoranek12 opened this issue May 15, 2017 · 9 comments

Comments

@ekoranek12
Copy link

(Sorry if I'm doing this incorrectly, somewhat new to issues)

In my app I've set a PastelView as a background view of a UITableView in a UITableViewController. The PastelView will only animate through the first 3 colors provided. The default configuration (when no custom colors, start/end points, or duration are set) has the same issue.

@cruisediary
Copy link
Owner

Thank you for your new issue :D
However, I did not encounter any problems when I created a simple table view controller example using 7 colors( rainbow colors )

Can you show me a problem with some repository using PastelView ?

I think that will help solve the problem. :D

@ekoranek12
Copy link
Author

Here is the code that I am using.

import UIKit
import Pastel

class AddNewMemberTableViewController: UITableViewController {

    @IBOutlet weak var tableBackgroundView: PastelView!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        tableView.backgroundView = tableBackgroundView
        setupPastelView()
    }
    
    // MARK - Setup
    private func setupPastelView() {
        tableBackgroundView.startPoint = .bottomLeft
        tableBackgroundView.endPoint = .topRight
        tableBackgroundView.animationDuration = 15.0
        
        tableBackgroundView.setColors(colors: [#colorLiteral(red: 0.9411764741, green: 0.4980392158, blue: 0.3529411852, alpha: 1), 
        #colorLiteral(red: 0.9686274529, green: 0.78039217, blue: 0.3450980484, alpha: 1), 
        #colorLiteral(red: 0.5843137503, green: 0.8235294223, blue: 0.4196078479, alpha: 1), 
        #colorLiteral(red: 0.2588235438, green: 0.7568627596, blue: 0.9686274529, alpha: 1), 
        #colorLiteral(red: 0.3647058904, green: 0.06666667014, blue: 0.9686274529, alpha: 1), 
        #colorLiteral(red: 0.8549019694, green: 0.250980407, blue: 0.4784313738, alpha: 1)])
        tableBackgroundView.startAnimation()
    }

}

@cruisediary
Copy link
Owner

it works fine to me but its too slow to show all colors because it takes 15 seconds per pair color set
please check this branch
fix/issue6-cycle-not-working it works too

@ekoranek12
Copy link
Author

Interesting. I will try it this evening when I am off work. Thanks for looking into this.

@cruisediary
Copy link
Owner

I hope this example solves the problem. :)

@ekoranek12
Copy link
Author

I found the problem in my app was starting the animation in viewDidLoad. Moving pastelView.startAnimation() to viewDidAppear fixed the issue. I also found that viewWillAppear also works. Assuming you're content with this functionality, I would say this could be closed!

@younatics
Copy link

More, You will know that it will be stopped when view is not in front. So, viewDidAppear will always call startAnimation

Cheers!

@ThreadPitt
Copy link

Yes, had the same issue, in one ViewController it only worked in viewDidAppear. The only difference I could tell was that the first VC (where it worked in viewDidLoad) was created from Storyboard, the other one not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@cruisediary @younatics @ekoranek12 @ThreadPitt and others