UIView that simulates a 2D view of a fluid in motion

Related tags

UI BAFluidView
Overview
Comments
  • Glitch when using autolayout

    Glitch when using autolayout

    Hi :) I'm using BAFluidView with interface builder and autolayout, and I noticed a glitch when doing so:

    http://d.pr/v/aR6

    looks like the bezier path are computed at the starting size, but once autolayout resizes it to fit a bigger screen those values are no longer valid.

    This sample shows the issue (you might need to hide the frontmost mask in IB, or just run it on your device and tilt it :) )

    Any idea?

    Thanks

    opened by andreamazz 12
  • Issue running pod install

    Issue running pod install

    Hey just want to let you know that doing just pod install on the Example folder triggered this error:

    [!] Unable to satisfy the following requirements:

    • BAFluidView (from../) required by Podfile
    • BAFluidView (from../) required by Podfile
    • BAFluidView (= 0.1.1) required by Podfile.lock

    However, running pod update after solved it.

    opened by palcalde 6
  • Fix background glitch

    Fix background glitch

    This should fix #14 although it might need to be documented in the readme since this happens also when you have a fluid view in a tab. Once the user switches tabs and goes back to the one with the fluid we should stop and restart the animation as well. In this case the UIApplicationWillResignActiveNotification and UIApplicationDidBecomeActiveNotification won't do the trick and we need to use for instance viewWillAppear/Disappear.

    What do you think?

    opened by andreamazz 5
  • Memory issue

    Memory issue

    After applications goes to background and returns to foreground BAFluidView causes memory issue and app crashes with error : Terminated due to memory issue . I thinks something strange is happening in getBezierPathValues method but ca't figure it out.

    Can you please give some idea how to fix this?

    opened by Eke 3
  • Use accelerometer to influence fluid

    Use accelerometer to influence fluid

    It would be cool if the accelerometer was used to influence how to fluid behaves. I guess that would require some sort of physics simulation, but it would still be cool :)

    opened by martinjo 3
  • Swift Implementation

    Swift Implementation

    Hi, I'm trying to implement this great lib on swift, by writing this code:

        let fluidView = BAFluidView(frame: self.view.frame, startElevation: 0.9)!
        
        fluidView.strokeColor = UIColor.green
        fluidView.fillColor = Constants.COLOR_BLUE
        fluidView.keepStationary()
        fluidView.startAnimation()
        
        self.view.addSubview(fluidView)
    

    and here is the preview: screen shot 2017-04-06 at 6 53 53 pm

    I've been changing the value of startElevation from 0.1 to 9000, but the height of wave didn't change. I want to achieve that the height of wave is 1/4 of the height screen.

    Thank you.

    question 
    opened by gemamegantara 2
  • Tilt won't work if device starts app while laying flat on surface

    Tilt won't work if device starts app while laying flat on surface

    If I start the app while holding my phone in my hand in an upright position, the tilting functionality works well. However, if app is launched while the device is flat on a desk or counter top, the tilting functionality will not work once the device is picked up.

    opened by matcartmill-old 2
  • made fill position adhere to self.bounds for scaling purposes

    made fill position adhere to self.bounds for scaling purposes

    1. Fill layer should be calculated on the view's bounds, not its frame. Transformations aren't applied to the frame property when the view is scaled, so the fill level isn't properly adjusted. From Apple:

    Views have both a frame (coordinates in superview's coordinate system) and bounds (coordinates in own coordinate system) property, but if you transform a view, you should not use or rely on the frame property anymore. If you are using transformations, work with the bounds property only, not the frame property, as transformations are applied to the bounds, but aren't necessarily reflected accurately in frame.

    1. Added kCAMediaTimingFunctionEaseInEaseOut timing function to fillTo()'s CAKeyframeAnimation for a nice, cold, smooth pour.
    opened by davidtperk 2
  • Lagging on other animation started

    Lagging on other animation started

    I added BAFluidView to my screen and I use SWRevealViewController to menu navigation. IF I started to swipe in the menu, the View animation starts to lagging until I release the pull.

    invalid 
    opened by chosa91 2
  • Tilt animation in Swift?

    Tilt animation in Swift?

    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)
        }
    
    opened by AF-cgi 2
  • Add speed field

    Add speed field

    Great API, I think you could add the option for the user easily to change the speed by changing the value 7 on verticalAnimation.duration inside the method fillTo to a variable that the user of the API could set.

    opened by frapsMatheus 2
  • Issue on adding a new BAFluidView to the same View

    Issue on adding a new BAFluidView to the same View

    On adding a new BAFluidView to the same container view there is an issue where you can not animate it.

    Other than that you work is great @antiguab πŸ‘

    Improvements you can do:

    1. Add a variable to set the Wave Crest speed.
    2. Add the Swift 5 version.
    opened by AgileFlex 0
  • Tilt functionality doesn't work in Landscape orientation

    Tilt functionality doesn't work in Landscape orientation

    To reproduce: Start example app in landscape orientation Swipe down to get to Tilt example Notice incorrect Tilt (see screenshot) Changing orientation of device incorrectly changes fluid level (to near zero)

    IMG_0266

    Note: Tilt does work correctly if you start app in portrait orientation

    opened by srgray 0
  • Random Crash!

    Random Crash!

    It seems like the app runs out of memory after a certain period of time.

    Screenshot 2019-12-19 at 21 39 11 Screenshot 2019-12-19 at 21 38 58 Screenshot 2019-12-19 at 21 38 44

    Here is a console log:

    malloc: can't allocate region
    *** mach_vm_map(size=939524096) failed (error code=3) AppName
    <img width="555" alt="Screenshot 2019-12-19 at 21 38 44" src="https://user-images.githubusercontent.com/3489125/71204297-7ae68800-22a8-11ea-855d-e5af690c9d16.png">
    (7620,0x101ecebc0) malloc: *** set a breakpoint in malloc_error_break to debug
    
    opened by yaroslav-zhurakovskiy 0
  • Option to pause the fill animation while keeping the wave animation

    Option to pause the fill animation while keeping the wave animation

    I'm working on a project where the background liquid "fill" animation will need to be paused by a user interaction. I'd like to have the waves continue to crest, even when the animation is not filling the view.

    Have you considered adding something like this?

    I'm struggling with the implementation, but if it's easy, could you share some initial direction?

    Thanks!

    opened by christopherdavis1 1
  • Reverse animation to 0

    Reverse animation to 0

    I am trying to animate the FluidView from top (1.0) to bottom (0.0) On doing so, the FluidView just remains at the top, without any reverse animation.

    I tried animating from 1.0 to 0.1, with a fillDuration of 7, but the FluidView just quickly animates to 0.1 in one second.

    Here is the code for reference:

    fluidView = BAFluidView(frame: fluidViewFrame, maxAmplitude: 25, minAmplitude: 20, amplitudeIncrement: 5, startElevation: 1.0)
    fluidView.backgroundColor = LIGHTER_GRAY
    fluidView.fillAutoReverse = false
    fluidView.fillDuration = 7
    fluidView.strokeColor = OFF_WHITE
    fluidView.fillRepeatCount = 1
    fluidView.fillColor = WHITE
    fluidView.fill(to: 0.0)
    
    opened by vishaluae 2
Simple battery shaped UIView

BatteryView Simple battery shaped UIView. Usage let batteryView = BatteryView(frame: smallRect) batteryView.level = 42 // anywhere in 0...100 batteryV

Yonat Sharon 50 Sep 19, 2022
UIView and CGRect extension that adds properties to manipulate them efficiently

Geometry Geometry is a UIView and CGRect extension that lets you work with view and rect geometry easier. It adds the following properties to UIView:

Tuomas Artman 92 Sep 7, 2022
An iOS Library that makes shadows management easy on UIView.

ShadowView is an iOS Shadow library that makes view's shadow implementation easy and sweet ?? ?? . Add simple shadows to add a gaussian blurred projec

Pierre 404 Dec 8, 2022
High performance and lightweight UIView, UIImage, UIImageView, UIlabel, UIButton, Promise and more.

SwiftyUI High performance and lightweight UIView, UIImage, UIImageView, UIlabel, UIButton and more. Features SwiftyView GPU rendering Image and Color

Haoking 336 Nov 26, 2022
Twinkle is a Swift and easy way to make any UIView in your iOS or tvOS app twinkle.

Twinkle ✨ Twinkle is a Swift and easy way to make any UIView in your iOS or tvOS app twinkle. This library creates several CAEmitterLayers and animate

patrick piemonte 600 Nov 24, 2022
Custom Beautiful UIView For Handling IDs in iOS

IDView Custom Beautiful UIView For Handling IDs in iOS Setup Set the placeholder images for the front and back faces. override func viewDidLoad()

Omar Labib 6 Aug 21, 2021
A framework which helps you attach observers to `UIView`s to get updates on its frame changes

FrameObserver is a framework that lets you attach observers to any UIView subclass and get notified when its size changes. It doesn't use any Method S

null 11 Jul 25, 2022
Easily use UIKit views in your SwiftUI applications. Create Xcode Previews for UIView elements

SwiftUIKitView Easily use UIKit views in SwiftUI. Convert UIView to SwiftUI View Create Xcode Previews from UIView elements SwiftUI functional updatin

Antoine van der Lee 682 Dec 29, 2022
A swift PropertyWrapper to provide automatic NSView/UIView invalidation when the properties value changes.

A swift PropertyWrapper to provide automatic NSView/UIView invalidation when the properties value changes. It duplicates the @Invalidating propertyWrapper for build targets prior to macOS 12 and iOS 15.

Darren Ford 8 Oct 15, 2021
πŸ“Ή Framework to Play a Video in the Background of any UIView

SwiftVideoBackground is an easy to use Swift framework that provides the ability to play a video on any UIView. This provides a beautiful UI for login

Wilson Ding 334 Jan 7, 2023
Easily add drop shadows, borders, and round corners to a UIView.

Easily add drop shadows, borders, rounded corners to a UIView. Installation CocoaPods Add the follwing to your Podfile: pod 'Shades' Usage Storyboard

Aaron Sutton 14 Jun 20, 2020
Anchorage - Single file UIView drag and drop system

anchorage Single file UIView drag and drop system anchors.mp4 License Copyright

● ●●   ● 3 Jan 28, 2022
A way to quickly add a notification badge icon to any view. Make any view of a full-fledged animated notification center.

BadgeHub A way to quickly add a notification badge icon to any view. Demo/Example For demo: $ pod try BadgeHub To run the example project, clone the r

Jogendra 772 Dec 28, 2022
Confetti View lets you create a magnificent confetti view in your app

ConfettiView Confetti View lets you create a magnificent confetti view in your app. This was inspired by House Party app's login screen. Written in Sw

Or Ron 234 Nov 22, 2022
A custom stretchable header view for UIScrollView or any its subclasses with UIActivityIndicatorView and iPhone X safe area support for content reloading. Built for iOS 10 and later.

Arale A custom stretchable header view for UIScrollView or any its subclasses with UIActivityIndicatorView support for reloading your content. Built f

Putra Z. 43 Feb 4, 2022
Play BreakOut while loading - A playable pull to refresh view using SpriteKit

BreakOutToRefresh Play BreakOut while loading - A playable pull to refresh view using SpriteKit BreakOutToRefresh uses SpriteKit to add a playable min

Dominik Hauser 2.5k Jan 5, 2023
A simple, customizable view for efficiently collecting country information in iOS apps.

CountryPickerView CountryPickerView is a simple, customizable view for selecting countries in iOS apps. You can clone/download the repository and run

Kizito Nwose 459 Dec 27, 2022
Cool Animated music indicator view written in Swift

Cool Animated music indicator view written in Swift. ESTMusicIndicator is an implementation of NAKPlaybackIndicatorView in Swift for iOS 8. ζœ¬δΊΊθ‘—δ½œηš„δΉ¦η±γ€ŠLa

Aufree 465 Nov 28, 2022
A child view controller framework that makes setting up your parent controllers as easy as pie.

Description Family is a child view controller framework that makes setting up your parent controllers as easy as pie. With a simple yet powerful publi

Christoffer Winterkvist 246 Dec 28, 2022