Skip to content

NiceThings/FlubberView

Repository files navigation

FlubberView

A very special UIView subclass.

Build Status Carthage compatible Version License Platform


Installation with Carthage

FlubberView is compatible with Carthage. To install it, simply add the following line to your Cartfile:

github "NiceThings/FlubberView"

Design

FlubberView consists of a UIView and a collection of subviews arranged in a grid. Each subview is attached to the 2 views immediately horizontally adjacent to it with a UIAttachmentBehavior.

The animate() function repositions each subview, causing the grid to jiggle and eventually settle.


Overview

A `CAShapeLayer` can be passed into the constructor to give your `FlubberView` coherent shape.

Overview


Usage

Configure your FlubberView at initialization time with the following parameters:

  • desiredSize: a CGSize for your FlubberView
  • damping: to put it one way, the percentage of "flubbery-ness" lost with each oscillation of your FlubberView (expressed as a value between 0 and 1)
  • frequency: the speed at which your FlubberView oscillates
  • nodeDensity: the relative concentration of subviews within your FlubberView. Enum values of low, medium, and high correspond to 9, 25, and 49

Additionaly, you can pass a CAShapeLayer into the constructor to sit on top of your FlubberView and provide a coherent shape.

After initialization, you can modify your FlubberView's magnitude property to change the distance that each constituent subview will "jump" during animation.

Trigger your FlubberView's animation by calling animate()

Inspiration

FlubberView was inspired by victorBaro's mighty VBFJellyView