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
layout
A 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.alpha
to1
and item.transform
toidentity
.
Declaration
Swift
@objc public static func identity() -> JJItemPreparation
Return Value
An item preparation object.
- sets
-
Returns an item preparation object that
- sets
item.alpha
to0
and scales the item by given ratio.
Declaration
Swift
@objc public static func scale(by ratio: CGFloat = 0.4) -> JJItemPreparation
Parameters
ratio
The factor by which the item is scaled
Return Value
An item preparation object.
- sets
-
Returns an item preparation object that
- sets
item.alpha
to0
, - 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) -> JJItemPreparation
Parameters
translationX
The value in points by which the item is offsetted horizontally
translationY
The value in points by which the item is offsetted vertically
scale
The factor by which the item is scaled
Return Value
An item preparation object.
- sets
-
Returns an item preparation object that
- sets
item.alpha
to0
, 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) -> JJItemPreparation
Parameters
distance
The value in points by which the item is offsetted horizontally towards the closest vertical edge of the screen.
scale
The factor by which the item is scaled
Return Value
An item preparation object.
- sets
-
Returns an item preparation object that
- sets
item.alpha
to0
, 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) -> JJItemPreparation
Parameters
distance
The value in points by which the item is offsetted towards the action button.
scale
The factor by which the item is scaled
angleForItem
A closure that calculates the angle for each item in a floating action button. Default is
JJItemAnimationConfiguration.angleForItem
.Return Value
An item preparation object.
- sets