docs/Classes/HeroModifier.html
public final class HeroModifier
extension HeroModifier: HeroStringConvertible
Undocumented
`
init(applyFunction:)
`
Undocumented
Swift
public init(applyFunction: @escaping (inout HeroTargetState) -> Void)
`
beginWith(_:)
`
Apply modifiers directly to the view at the start of the transition. The modifiers supplied here won’t be animated. For source views, modifiers are set directly at the beginning of the animation. For destination views, they replace the target state (final appearance).
Swift
public static func beginWith(_ modifiers: [HeroModifier]) -> HeroModifier
`
beginWith(modifiers:)
`
Undocumented
Swift
public static func beginWith(modifiers: [HeroModifier]) -> HeroModifier
`
beginWith(_:)
`
Undocumented
Swift
public static func beginWith(_ modifiers: HeroModifier...) -> HeroModifier
`
useGlobalCoordinateSpace
`
Use global coordinate space.
When using global coordinate space. The view become a independent view that is not a subview of any view. It won’t move when its parent view moves, and won’t be affected by parent view’s attributes.
When a view is matched, this is automatically enabled. The source modifier will also enable this.
Global coordinate space is default for all views prior to version 0.1.3
Swift
public static var useGlobalCoordinateSpace: HeroModifier
`
ignoreSubviewModifiers
`
ignore all heroModifiers attributes for a view’s direct subviews.
Swift
public static var ignoreSubviewModifiers: HeroModifier
`
ignoreSubviewModifiers(recursive:)
`
ignore all heroModifiers attributes for a view’s subviews.
Swift
public static func ignoreSubviewModifiers(recursive: Bool = false) -> HeroModifier
`
useOptimizedSnapshot
`
Will create snapshot optimized for different view type. For custom views or views with masking, useOptimizedSnapshot might create snapshots that appear differently than the actual view. In that case, use .useNormalSnapshot or .useSlowRenderSnapshot to disable the optimization.
This modifier actually does nothing by itself since .useOptimizedSnapshot is the default.
Swift
public static var useOptimizedSnapshot: HeroModifier
`
useNormalSnapshot
`
Create snapshot using snapshotView(afterScreenUpdates:).
Swift
public static var useNormalSnapshot: HeroModifier
`
useLayerRenderSnapshot
`
Create snapshot using layer.render(in: currentContext). This is slower than .useNormalSnapshot but gives more accurate snapshot for some views (eg. UIStackView).
Swift
public static var useLayerRenderSnapshot: HeroModifier
`
useNoSnapshot
`
Force Hero to not create any snapshot when animating this view. This will mess up the view hierarchy, therefore, view controllers have to rebuild its view structure after the transition finishes.
Swift
public static var useNoSnapshot: HeroModifier
`
forceAnimate
`
Force the view to animate.
By default, Hero will not animate if the view is outside the screen bounds or if there is no animatable hero modifier, unless this modifier is used.
Swift
public static var forceAnimate: HeroModifier
`
useScaleBasedSizeChange
`
Force Hero use scale based size animation. This will convert all .size modifier into .scale modifier. This is to help Hero animate layers that doesn’t support bounds animation. Also gives better performance.
Swift
public static var useScaleBasedSizeChange: HeroModifier
`
from(node:)
`
Undocumented
Swift
public static func from(node: ExprNode) -> HeroModifier?
`
fade
`
Fade the view during transition
Swift
public static var fade: HeroModifier
`
forceNonFade
`
Force don’t fade view during transition
Swift
public static var forceNonFade: HeroModifier
`
position(_:)
`
Set the position for the view to animate from/to.
Swift
public static func position(_ position: CGPoint) -> HeroModifier
`
size(_:)
`
Set the size for the view to animate from/to.
Swift
public static func size(_ size: CGSize) -> HeroModifier
`
transform(_:)
`
Set the transform for the view to animate from/to. Will override previous perspective, scale, translate, & rotate modifiers
Swift
public static func transform(_ t: CATransform3D) -> HeroModifier
`
perspective(_:)
`
Set the perspective on the transform. use in combination with the rotate modifier.
Swift
public static func perspective(_ perspective: CGFloat) -> HeroModifier
`
scale(x:y:z:)
`
Scale 3d
Swift
public static func scale(x: CGFloat = 1, y: CGFloat = 1, z: CGFloat = 1) -> HeroModifier
`
scale(_:)
`
Scale in x & y axis
Swift
public static func scale(_ xy: CGFloat) -> HeroModifier
`
translate(x:y:z:)
`
Translate 3d
Swift
public static func translate(x: CGFloat = 0, y: CGFloat = 0, z: CGFloat = 0) -> HeroModifier
`
translate(_:z:)
`
Undocumented
Swift
public static func translate(_ point: CGPoint, z: CGFloat = 0) -> HeroModifier
`
rotate(x:y:z:)
`
Rotate 3d
Swift
public static func rotate(x: CGFloat = 0, y: CGFloat = 0, z: CGFloat = 0) -> HeroModifier
`
rotate(_:z:)
`
Undocumented
Swift
public static func rotate(_ point: CGPoint, z: CGFloat = 0) -> HeroModifier
`
rotate(_:)
`
Rotate 2d
Swift
public static func rotate(_ z: CGFloat) -> HeroModifier
`
backgroundColor(_:)
`
Set the backgroundColor for the view to animate from/to.
Swift
public static func backgroundColor(_ backgroundColor: UIColor) -> HeroModifier
`
borderColor(_:)
`
Set the borderColor for the view to animate from/to.
Swift
public static func borderColor(_ borderColor: UIColor) -> HeroModifier
`
shadowColor(_:)
`
Set the shadowColor for the view to animate from/to.
Swift
public static func shadowColor(_ shadowColor: UIColor) -> HeroModifier
`
overlay(color:opacity:)
`
Create an overlay on the animating view.
Swift
public static func overlay(color: UIColor, opacity: CGFloat) -> HeroModifier
`
opacity(_:)
`
Set the opacity for the view to animate from/to.
Swift
public static func opacity(_ opacity: CGFloat) -> HeroModifier
`
cornerRadius(_:)
`
Set the cornerRadius for the view to animate from/to.
Swift
public static func cornerRadius(_ cornerRadius: CGFloat) -> HeroModifier
`
zPosition(_:)
`
Set the zPosition for the view to animate from/to.
Swift
public static func zPosition(_ zPosition: CGFloat) -> HeroModifier
`
contentsRect(_:)
`
Set the contentsRect for the view to animate from/to.
Swift
public static func contentsRect(_ contentsRect: CGRect) -> HeroModifier
`
contentsScale(_:)
`
Set the contentsScale for the view to animate from/to.
Swift
public static func contentsScale(_ contentsScale: CGFloat) -> HeroModifier
`
borderWidth(_:)
`
Set the borderWidth for the view to animate from/to.
Swift
public static func borderWidth(_ borderWidth: CGFloat) -> HeroModifier
`
shadowOpacity(_:)
`
Set the shadowOpacity for the view to animate from/to.
Swift
public static func shadowOpacity(_ shadowOpacity: CGFloat) -> HeroModifier
`
shadowOffset(_:)
`
Set the shadowOffset for the view to animate from/to.
Swift
public static func shadowOffset(_ shadowOffset: CGSize) -> HeroModifier
`
shadowRadius(_:)
`
Set the shadowRadius for the view to animate from/to.
Swift
public static func shadowRadius(_ shadowRadius: CGFloat) -> HeroModifier
`
shadowPath(_:)
`
Set the shadowPath for the view to animate from/to.
Swift
public static func shadowPath(_ shadowPath: CGPath) -> HeroModifier
`
masksToBounds(_:)
`
Set the masksToBounds for the view to animate from/to.
Swift
public static func masksToBounds(_ masksToBounds: Bool) -> HeroModifier
`
duration(_:)
`
Sets the duration of the animation for a given view. If not used, Hero will use determine the duration based on the distance and size changes.
Note: a duration of .infinity means matching the duration of the longest animation. same as .durationMatchLongest
Swift
public static func duration(_ duration: TimeInterval) -> HeroModifier
`
durationMatchLongest
`
Sets the duration of the animation for a given view to match the longest animation of the transition.
Swift
public static var durationMatchLongest: HeroModifier
`
delay(_:)
`
Sets the delay of the animation for a given view.
Swift
public static func delay(_ delay: TimeInterval) -> HeroModifier
`
timingFunction(_:)
`
Sets the timing function of the animation for a given view. If not used, Hero will use determine the timing function based on whether or not the view is entering or exiting the screen.
Swift
public static func timingFunction(_ timingFunction: CAMediaTimingFunction) -> HeroModifier
`
spring(stiffness:damping:)
`
(iOS 9+) Use spring animation with custom stiffness & damping. The duration will be automatically calculated. Will be ignored if arc, timingFunction, or duration is set.
Swift
@available(iOS 9, *)
public static func spring(stiffness: CGFloat, damping: CGFloat) -> HeroModifier
`
source(heroID:)
`
Transition from/to the state of the view with matching heroID Will also force the view to use global coordinate space.
The following layer properties will be animated from the given view.
position bounds.size cornerRadius transform shadowColor shadowOpacity shadowOffset shadowRadius shadowPath
Note that the following properties won’t be taken from the source view.
backgroundColor borderWidth borderColor
Swift
public static func source(heroID: String) -> HeroModifier
`
arc
`
Works in combination with position modifier to apply a natural curve when moving to the destination.
Swift
public static var arc: HeroModifier
`
arc(intensity:)
`
Works in combination with position modifier to apply a natural curve when moving to the destination.
Swift
public static func arc(intensity: CGFloat = 1) -> HeroModifier
`
cascade
`
Cascade applys increasing delay modifiers to subviews
Swift
public static var cascade: HeroModifier
`
cascade(delta:direction:delayMatchedViews:)
`
Cascade applys increasing delay modifiers to subviews
Swift
public static func cascade(delta: TimeInterval = 0.02,
direction: CascadeDirection = .topToBottom,
delayMatchedViews: Bool = false) -> HeroModifier
`
when(_:_:)
`
Apply modifiers only if the condition return true.
Swift
public static func when(_ condition: @escaping (HeroConditionalContext) -> Bool, _ modifiers: [HeroModifier]) -> HeroModifier
`
when(_:_:)
`
Undocumented
Swift
public static func when(_ condition: @escaping (HeroConditionalContext) -> Bool, _ modifiers: HeroModifier...) -> HeroModifier
`
whenMatched(_:)
`
Undocumented
Swift
public static func whenMatched(_ modifiers: HeroModifier...) -> HeroModifier
`
whenPresenting(_:)
`
Undocumented
Swift
public static func whenPresenting(_ modifiers: HeroModifier...) -> HeroModifier
`
whenDismissing(_:)
`
Undocumented
Swift
public static func whenDismissing(_ modifiers: HeroModifier...) -> HeroModifier
`
whenAppearing(_:)
`
Undocumented
Swift
public static func whenAppearing(_ modifiers: HeroModifier...) -> HeroModifier
`
whenDisappearing(_:)
`
Undocumented
Swift
public static func whenDisappearing(_ modifiers: HeroModifier...) -> HeroModifier