An Objective-C animation library used to create floating image views.

Overview

JRMFloatingAnimation

[![CI Status](http://img.shields.io/travis/Caroline Harrison/JRMFloatingAnimation.svg?style=flat)](https://travis-ci.org/Caroline Harrison/JRMFloatingAnimation) Version License Platform

About

JRMFloatingAnimation is an ObjC library used to create floating image views:

Bubbles Sax

Balloons Tractor

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

To create the animation view:

self.floatingView = [[JRMFloatingAnimationView alloc] initWithStartingPoint:self.view.center];
[self.floatingView addImage:[UIImage imageName:@"myImage"]];
[self.view addSubview:self.floatingView];

To animate the view:

[self.floatingView animate];

You can add as many images to your view as you want, and they will be used randomly. Note that the images should be square.

There are a variety of different settings you can add to your animation view.

  • startingPointWidth - Varies the x of the starting point, with the starting point y being the middle. default is 0.
  • maxAnimationHeight - The maximum height that the animation may go. Default is the distance from the top of the frame to the starting point y value.
  • minAnimationHeight - The minimum height that the animation may go. If this is larger than the maxAnimationHeight, they will swap. Default is 1/3 the maxAnimationHeight .
  • animationWidth - The maximum "width" of the bezier path's control points fro the object's starting point. Changing this may give you unexpected results. Defaults:
    • JRMFloatingShape: The object's size * 2.
    • JRMFloatingShapeCurveLeft: The distance between the starting point x and the let edge of the frame.
    • JRMFloatingShapeCurveRight: The distance between the starting point x and the right edge of the frame.
    • JRMFloatingShapeTriangleUp: The width of the frame.
  • pop: Gives the impression of the images "popping" before they are removed from the view. Default NO.
  • maxFloatObjectSize: The maximum size a floating object can be. Default is 20.
  • minFloatObjectSize: The minimum size a floating object can be. If the minFloatObjectSize < maxFloatObjectSize, both sizes become the minFloatObjectSize. Default is 10.
  • floatingShape: The "shape" that the animation can take. Default is JRMFloatingShapeStraight.
    • JRMFloatingShapeTriangleUp - Floats up in a cone shape from the starting point.
    • JRMFloatingShapeStraight - Floats straight up from the starting point.
    • JRMFloatingShapeCurveLeft - Floats up and curves to the left.
    • JRMFloatingShapeCurveRight - Floats up and curves to the right.
  • fadeOut: If the floating object's alpha should fade out before disappearing from the view. Default NO.
  • varyAlpha: If the floating object's alpahs should vary (to give a more randomized look). Default NO.
  • animationDuration: The speed of the animation. Default 2.
  • removeOnCompletion: If the floating object should be removed from the superview when the animation is finished. Default YES.
  • imageViewAnimationCompleted: A completion block to call whenever an image view is finished animating. It will return the image view. (See the JRMDemoBalloonViewController.m file for an example.)

Installation

CocoaPods

JRMFloatingAnimation is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "JRMFloatingAnimation"

Manually

  1. Download and drop /Pod/Classesfolder in your project.
  2. Congratulations!

Author

Caroline Harrison, [email protected]

License

JRMFloatingAnimation is available under the MIT license. See the LICENSE file for more info.

Comments
  • Memory  Leak

    Memory Leak

    if I have removeOnCompletion=true,

    when the animation finishes it does remove itself from the superview but something else is holding a strong reference to JRMFloatingAnimationView hence it never deallocates.

    Perhaps (not tested) the FloatingImageView deallocs but not the AnimationView.

    opened by pjebs 10
  • Callback when it deallocates

    Callback when it deallocates

    I really like this control. There is one feature request however: Can you allow us to define a block which gets fired when the control removes itself from the superview. Perhaps by firing on dealloc?

    opened by pjebs 4
  • protocol

    protocol

    I tried to implement your JRMBubbleTutorial using JRMFloatingImageView class. Unfortunately it's not easy to do because the delegate is specified to be of type JRMFloatingAnimationView rather than the JRMFloatingImageViewDelegate protocol.

    If you had added the synthesized property methods as part of the protocol, it would have been more idiomatic and reusable.

    opened by pjebs 1
  • Manual Installation

    Manual Installation

    CocoaPods and Carthage are awesome tools and make our life really easier, but there are some devs who still don't know how to use them.

    It would be cool to add the Manual installation guide in your README.md. You can take a look at my iOS Readme Template to see how you can do it.

    opened by lfarah 0
  • maxFloatObjectSize and minFloatObjectSize not change

    maxFloatObjectSize and minFloatObjectSize not change

    When changes in to default default object size it is not changing in initWithStartingPoint Method - (id)initWithStartingPoint:(CGPoint)startingPoint { self = [super init]; if (self) { self.startingPoint = startingPoint; self.backgroundColor = [UIColor clearColor]; self.images = [NSMutableArray new]; self.floatingShape = JRMFloatingShapeStraight; self.maxFloatObjectSize = 300; self.minFloatObjectSize = 200; self.animationDuration = 2; self.firstAnimation = YES; self.customWidth = NO; self.maxAnimationHeight = self.startingPoint.y; self.minAnimationHeight = self.startingPoint.y * 1/3; self.removeOnCompletion = YES; } return self; }

    opened by maulik6994 0
  • Adds a sinking animation and updates the Podfile to match the more recent Cocoapods changes

    Adds a sinking animation and updates the Podfile to match the more recent Cocoapods changes

    This seems like a huge change, but really, the bulk of the changes come from running "pod install" with the latest version of Cocoapods. The majority of the functional changes are in the JRMFloatingAnimationView and JRMFloatingImageView classes to support and calculate a sinking animation. I also updated the main storyboard to include a new example of "falling triangles".

    opened by Chris-Corea 0
  • add a removeAllImages method

    add a removeAllImages method

    I sometimes find I need to remove images that I've added (to flip to an alternative styling of the image). This is the smallest change I can suggest to implement that - a removeAllImages method that simply removes all added images.

    opened by jonmountjoy 0
Owner
Caroline Harrison
iOS developer, engineer at Public, and fan of four legged friends.
Caroline Harrison
SwiftUI-Text-Animation-Library - Text animation library for SwiftUI

⚠️ This repository is under construction. SwiftUI Text Animation Library Make yo

null 28 Jan 8, 2023
ChainPageCollectionView A custom View with two level chained collection views and fancy transition animation

ChainPageCollectionView A custom View with two level chained collection views and fancy transition animation. Demo Requirements iOS 9.0+ Xcode 8 Insta

Yansong Li 775 Dec 7, 2022
FloatingBubbles is a customizable views that float like zero gravity animation.

Floating Bubbles FloatingBubbles is a customizable views that float like zero gravity animation. $ pod try FloatingBubbles Features Create Multiple V

Chandan Sharda 18 Oct 11, 2022
Create a smooth transition between any two SwiftUI Views

GZMatchedTransformEffect Create a smooth transition between any two SwiftUI Views. It is very similar to the built-in .matchedGeometryEffect() modifie

Gong Zhang 10 Nov 26, 2022
Simple Interface Core Animation. Run type-safe animation sequencially or parallelly

Simple Interface Core Animation Sica can execute various animations sequentially or parallelly. Features Animation with duration and delay parallel /

CATS Open Source Softwares 1k Nov 10, 2022
Swiftui-animation-observer - Track SwiftUI animation progress and completion via callbacks

SwiftUI Animation Observer Track SwiftUI animation progress and completion via c

Gordan Glavaš 9 Nov 5, 2022
MGFlipView allows to create flipping view in easy way without worrying about flipping animation and flipping logic.

MGFlipView About If you are looking for an easy way of implement 3D flipping view, you are in the right place. MGFlipView allows to create flipping vi

Maciej Gomółka 47 Sep 28, 2022
Wave is a spring-based animation engine for iOS that makes it easy to create fluid, interruptible animations that feel great.

Wave is a spring-based animation engine for iOS and iPadOS. It makes it easy to create fluid, interactive, and interruptible animations that feel great.

Janum Trivedi 1.2k Jan 8, 2023
ZoomTransitioning provides a custom transition with image zooming animation and swiping the screen edge.

ZoomTransitioning Overview ZoomTransitioning provides a custom transition with image zooming animation. When you use this library with UINavigationCon

WorldDownTown 673 Dec 27, 2022
`LeafTextField` is CustomTextField that contains Image and Animation.

LeafTextField Example @IBOutlet weak var textField: LeafTextField! textField.setImage(UIImage(named: "pikases"), UIImage(named: "pikases-leaf")) text

Henry Lee 5 Apr 13, 2022
Tinder/Bumble like user image with user details scroll animation

TinderUserProfile Tinder/Bumble like user image with user details scroll animation Add ProfileView.m,ProfileView.h class to your project. Set the clas

Souvick Ghosh 21 Jun 21, 2022
SwiftUI animated image view that works on iOS and layout just as SwiftUI.Image

SwiftUI.AnimatedImage SwiftUI animated image view that works on iOS and layout just as SwiftUI.Image Screen.Recording.2021-07-31.at.02.18.33.mov Insta

Marcin Krzyzanowski 50 Oct 14, 2022
Get a remote image's size and type without downloading the full image

FastImage FastImage 2.0 is an Swift port of the Ruby project by Stephen Sykes. It's directive is to request as little data as possible (usually just t

Kyle Hickinson 64 Sep 2, 2022
jasu 29 Dec 20, 2022
A fantastic Physical animation library for swift

A fantastic Physical animation library for swift(Not Just Spring !!!), it is base on UIDynamic and extension to it, friendly APIs make you use it or c

August 2.9k Jan 4, 2023
Easy animation library on iOS with Swift2

Cheetah Cheetah is an animation utility on iOS with Swift. Cheetah can animate any properties since Cheetah uses simple CADisplayLink run loop to chan

Suguru Namura 592 Dec 6, 2022
A radical & elegant animation library for iOS.

Installation • Usage • Debugging • Animatable Properties • License Dance is a powerful and straightforward animation framework built upon the new UIVi

Saoud Rizwan 648 Dec 14, 2022
An extensible iOS and OS X animation library, useful for physics-based interactions.

Pop is an extensible animation engine for iOS, tvOS, and OS X. In addition to basic static animations, it supports spring and decay dynamic animations

Meta Archive 19.8k Dec 28, 2022