MotionTransition

Motion Identifier

Animates the view with a matching motion identifier.

.motionIdentifier(_ identifier: String)

Masks To Bounds

Animates the view's current masksToBounds to the given masksToBounds.

.masksToBounds(_ masksToBounds: Bool)

Background Color

Animates the view's current background color to the given color.

.background(color: UIColor) -> MotionTransition

Border Color

Animates the view's current border color to the given color.

.border(color: UIColor)

Border Width

Animates the view's current border width to the given width.

.border(width: CGFloat)

Corner Radius

Animates the view's current corner radius to the given radius.

.corner(radius: CGFloat)

Transform

Animates the view's current transform (perspective, scale, rotate) to the given one.

.transform(_ transform: CATransform3D)

Perspective

Animates the view's current perspective to the given one through a CATransform3D object.

.perspective(_ perspective: CGFloat)

Rotate

Animates the view's current rotate to the given x, y, and z values.

.rotate(x: CGFloat, y: CGFloat, z: CGFloat)

Animates the view's current rotate to the given point.

.rotate(_ point: CGPoint, z: CGFloat)

Rotate 2d.

.rotate(_ z: CGFloat)

Scale

Animates the view's current scale to the given x, y, z scale values.

.scale(x: CGFloat, y: CGFloat, z: CGFloat)

Animates the view's current x & y scale to the given scale value.

.scale(_ xy: CGFloat)

Animates the view's current translation to the given x, y, and z values.

.translate(x: CGFloat, y: CGFloat, z: CGFloat)

Translate

Animates the view's current translation to the given point value (x & y), and a z value.

.translate(_ point: CGPoint, z: CGFloat)

Position

Animates the view's current position to the given point.

.position(_ point: CGPoint)

Force Non Fade

Forces the view to not fade during a transition.

.forceNonFade

Fade In

Fades the view in during a transition.

.fadeIn

Fade Out

Fades the view out during a transition.

.fadeOut

Fade

Animates the view's current opacity to the given one.

.fade(_ opacity: Double)

Z Position

Animates the view's current zPosition to the given position.

.zPosition(_ position: CGFloat)

Size

Animates the view's current size to the given one.

.size(_ size: CGSize)

Shadow Path

Animates the view's current shadow path to the given one.

.shadow(path: CGPath)

Shadow Color

Animates the view's current shadow color to the given one.

.shadow(color: UIColor)

Shadow Offset

Animates the view's current shadow offset to the given one.

.shadow(offset: CGSize)

Shadow Opacity

Animates the view's current shadow opacity to the given one.

.shadow(opacity: Float)

Shadow Radius

Animates the view's current shadow radius to the given one.

.shadow(radius: CGFloat)

Contents Rect

Animates the view's contents rect to the given one.

.contents(rect: CGRect)

Contents Scale

Animates the view's contents scale to the given one.

.contents(scale: CGFloat)

Duration

The duration of the view's animation.

.duration(_ duration: TimeInterval)

Preferred Duration Matches Longest

Sets the view's animation duration to the longest running animation within a transition.

.preferredDurationMatchesLongest

Delay

Delays the animation of a given view.

.delay(_ time: TimeInterval)

Timing Function

Sets the view's timing function for the transition.

.timingFunction(_ timingFunction: CAMediaTimingFunction)

Spring

Available in iOS 9+, animates a view using the spring API, given a stiffness and damping.

.spring(stiffness: CGFloat, damping: CGFloat)

Arc

Animates the natural curve of a view. A value of 1 represents a curve in a downward direction, and a value of -1 represents a curve in an upward direction.

.arc(intensity: CGFloat = 1)

Cascade

Animates subviews with an increasing delay between each animation.

.cascade(delta: TimeInterval, direction: CascadeDirection, animationDelayedUntilMatchedViews: Bool)

Overlay

Creates an overlay on the animating view with a given color and opacity.

.overlay(color: UIColor, opacity: CGFloat)

Begin with

Apply transitions directly to the view at the start of the transition. The transitions supplied here won't be animated. For source views, transitions are set directly at the begining of the animation. For destination views, they replace the target state (final appearance).

.beginWith(transitions: [MotionTransition])

Begin With If Matched

Apply transitions directly to the view at the start of the transition if the view is matched with another view. The transitions supplied here won't be animated. For source views, transitions are set directly at the begining of the animation. For destination views, they replace the target state (final appearance).

.beginWithIfMatched(transitions: [MotionTransition])

Global Coordinate Space

When using global coordinate space. The view becomes an 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 attributes. When a view is matched, this is automatically enabled. The source transition will also enable this.

.useGlobalCoordinateSpace

Use same parent coordinate space.

.useSameParentCoordinateSpace

Ignore Transitions

Ignore all motion transition attributes for a view's direct subviews.

.ignoreSubviewTransitions

Ignore all motion transition attributes for a view's subviews.

.ignoreSubviewTransitions(recursive: Bool)

Snapshot

This will create a snapshot optimized for different view types. 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 transition actually does nothing by itself since .useOptimizedSnapshot is the default.

.useOptimizedSnapshot

Create a snapshot using snapshotView(afterScreenUpdates:).

.useNormalSnapshot

Create a snapshot using layer.render(in: currentContext). This is slower than .useNormalSnapshot but gives more accurate snapshots for some views (eg. UIStackView).

.useLayerRenderSnapshot

Force Motion to not create any snapshots when animating this view. This will mess up the view hierarchy, therefore, view controllers have to rebuild their view structure after the transition finishes.

.useNoSnapshot

Force Animate

Force the view to animate (Motion will create animation contexts & snapshots for them, so that they can be interactive).

.forceAnimate

Force Scale Based Size Change

Force Motion to use scale based size animation. This will convert all .size transitions into a .scale transition. This is to help Motion animate layers that doesn't support bounds animations. This also gives better performance.

.useScaleBasedSizeChange

Last updated