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

Tilt animation in Swift? #38

Closed
AF-cgi opened this issue Mar 18, 2016 · 2 comments
Closed

Tilt animation in Swift? #38

AF-cgi opened this issue Mar 18, 2016 · 2 comments
Assignees

Comments

@AF-cgi
Copy link

AF-cgi commented Mar 18, 2016

Hey,
nice view, but in Swift the kBAFluidViewCMMotionUpdate doesn't work. Can you help me?

    private func addFluidIndicator() {
        if self.motionManager.deviceMotionAvailable
        {
            self.motionManager.deviceMotionUpdateInterval = 0.3
            self.motionManager.startDeviceMotionUpdatesToQueue(NSOperationQueue.mainQueue(), withHandler: { (deviceManager, error) -> Void in

                guard let deviceManager = deviceManager else { return }

                let nc = NSNotificationCenter.defaultCenter()
                let userInfo = NSDictionary(object: deviceManager, forKey: "data")
                nc.postNotificationName(kBAFluidViewCMMotionUpdate, object: self, userInfo: userInfo as [NSObject : AnyObject])
            })
        }

        let fluidView           = BAFluidView(frame: UIScreen.mainScreen().bounds, startElevation: 0.5)
        fluidView.fillColor     = UIColor.blueColor()
        fluidView.strokeColor   = UIColor.whiteColor()
        fluidView.keepStationary()
        fluidView.startAnimation()
        fluidView.startTiltAnimation()
        self.view.addSubview(fluidView)
    }
@antiguab antiguab self-assigned this Mar 18, 2016
@AF-cgi
Copy link
Author

AF-cgi commented Mar 21, 2016

It's a timing problem. I solve this issue.

@AF-cgi AF-cgi closed this as completed Mar 21, 2016
@antiguab
Copy link
Owner

Hey @AFcgi - I gave it a quick glance over the weekend, but couldn't figure it out. Glad you found a solution though!

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

2 participants