JJItemPreparation
@objc
public class JJItemPreparation : NSObject
Item preparation
-
A closure that prepares a given action item for animation.
Declaration
Swift
@objc public var prepare: (_ item: JJActionItem, _ index: Int, _ numberOfItems: Int, _ actionButton: JJFloatingActionButton) -> Void -
Initializes and returns a newly allocated item preparation object with given prepare closure.
Declaration
Swift
@objc public init(prepare: @escaping (_ item: JJActionItem, _ index: Int, _ numberOfItems: Int, _ actionButton: JJFloatingActionButton) -> Void)Parameters
layoutA closure that defines the the layout of given action items relative to an action button.
Return Value
An initialized item layout object.
-
Returns an item preparation object that
- sets
item.alphato1and item.transformtoidentity.
Declaration
Swift
@objc public static func identity() -> JJItemPreparationReturn Value
An item preparation object.
- sets
-
Returns an item preparation object that
- sets
item.alphato0and scales the item by given ratio.
Declaration
Swift
@objc public static func scale(by ratio: CGFloat = 0.4) -> JJItemPreparationParameters
ratioThe factor by which the item is scaled
Return Value
An item preparation object.
- sets
-
Returns an item preparation object that
- sets
item.alphato0, - offsets the item by given values and
scales the item by given ratio.
Declaration
Swift
@objc public static func offset(translationX: CGFloat, translationY: CGFloat, scale: CGFloat = 0.4) -> JJItemPreparationParameters
translationXThe value in points by which the item is offsetted horizontally
translationYThe value in points by which the item is offsetted vertically
scaleThe factor by which the item is scaled
Return Value
An item preparation object.
- sets
-
Returns an item preparation object that
- sets
item.alphato0, offsets the item horizontally by given values.
Remark
The item is offsetted towards the closest vertical edge of the screen.
Declaration
Swift
@objc public static func horizontalOffset(distance: CGFloat = 50, scale: CGFloat = 0.4) -> JJItemPreparationParameters
distanceThe value in points by which the item is offsetted horizontally towards the closest vertical edge of the screen.
scaleThe factor by which the item is scaled
Return Value
An item preparation object.
- sets
-
Returns an item preparation object that
- sets
item.alphato0, offsets the item horizontally by given values.
Remark
The item is offsetted towards the action button.
Declaration
Swift
@objc public static func circularOffset(distance: CGFloat = 50, scale: CGFloat = 0.4, angleForItem: @escaping JJItemAngle = JJItemAnimationConfiguration.angleForItem) -> JJItemPreparationParameters
distanceThe value in points by which the item is offsetted towards the action button.
scaleThe factor by which the item is scaled
angleForItemA closure that calculates the angle for each item in a floating action button. Default is
JJItemAnimationConfiguration.angleForItem.Return Value
An item preparation object.
- sets
Install in Dash
JJItemPreparation Class Reference