Protocol: SC.SwapTransitionProtocol
The SC.SwapTransitionProtocol
protocol defines the properties and methods that you may
implement in your custom swap transition plugins. All methods are optional, but a plugin is
expected to use at least one of the methods.
SC.ContainerView
uses transition plugins to setup, execute and cleanup the swapping between views
and expects the given transition plugin object to implement the methods in this protocol.
Note: Do not mix SC.SwapTransitionProtocol
into your classes. As a protocol, it exists only
for reference sake. You only need define any of the properties or methods listed below in order to
use this protocol.*
Defined in: swap_transition_protocol.js
Class Methods
- buildInDidCancel(container, content, options)
- buildInToView(statechart, container, content, previousStatechart, options)
- buildOutDidCancel(container, content, options)
- buildOutFromView(statechart, container, content, options, exitCount)
- didBuildInToView(container, content, options)
- didBuildOutFromView(container, content, options)
- transitionClippingFrame(container, clippingFrame, options)
- willBuildInToView(container, content, previousStatechart, options)
- willBuildOutFromView(container, content, options)
Class Method Detail
This optional method is called to cancel an active entrance transition.
Use this method to stop the animation and immediately clean up the views.
- Parameters:
- container SC.ContainerView
- The SC.ContainerView using this plugin.
- content SC.View
- The new view in the container, which is still transitioning in.
- options Object
- Options to modify the transition.
This optional method is called to transition the new content in.
When the transition completes, the function must call the entered() method on the statechart.
- Parameters:
- statechart SC.ContainerContentStatechart
- The statechart for the content view.
- container SC.ContainerView
- The SC.ContainerView using this plugin.
- content SC.View
- The new view added to the container.
- previousStatechart SC.View
- The current content statechart in the container.
- options Object
- Options to modify the transition.
This optional method is called to cancel an active exit transition.
Use this method to stop the animation and immediately clean up the views.
- Parameters:
- container SC.ContainerView
- The SC.ContainerView using this plugin.
- content SC.View
- The old view being removed from the container, which is still transitioning out.
- options Object
- Options to modify the transition.
This optional method is called to transition the old content out.
When the transition completes, the function must call the exited() method on the statechart.
Note that a view may be repeatedly built out before it has completed. In
order to accelerate the build out transition, the exitCount
parameter will
be incremented each time buildOutFromView
is called. The initial value
will always be 1.
- Parameters:
- statechart SC.ContainerContentStatechart
- The statechart for the content view.
- container SC.ContainerView
- The SC.ContainerView using this plugin.
- content SC.View
- The old view being removed from the container.
- options Object
- Options to modify the transition.
- exitCount Number
- The number of times the content is being built out.
This optional method is called to clean up the entrance the transition.
Use this method to adjust the layout of the container and new content after the transition completes. For example, you may need to adjust the layout from a fixed layout (i.e. { left: 0, top: 0, width: 100, height: 200 }) to a flexible layout (i.e. { left: 0, top: 0, right: 0, bottom: 0 }).
- Parameters:
- container SC.ContainerView
- The SC.ContainerView using this plugin.
- content SC.View
- The new view added to the container.
- options Object
- Options that were used to modify the transition.
This optional method is called to clean up the entrance the transition.
Use this method to adjust the layout of the container and new content after the transition completes. For example, you may need to adjust the layout from a fixed layout (i.e. { left: 0, top: 0, width: 100, height: 200 }) to a flexible layout (i.e. { left: 0, top: 0, right: 0, bottom: 0 }).
- Parameters:
- container SC.ContainerView
- The SC.ContainerView using this plugin.
- content SC.View
- The new view added to the container.
- options Object
- Options that were used to modify the transition.
This optional method is called to adjust the clippingFrame
during the
transition.
Because some childViews
are altered by the clippingFrame
of their parent
views (notably collection views), we may need to provide a modified
clipping frame while the transition is in process.
For example, a push transition should double the regular clippingFrame
of the container to fit both the new and current content while the
transition is in progress.
- Parameters:
- container SC.ContainerView
- The SC.ContainerView using this plugin.
- clippingFrame Object
- The current clippingFrame of the container.
- options Object
- Options used to modify the transition.
- Returns:
- clippingFrame
This optional method is called to set up the entrance transition.
Use this method to adjust the layout of the container and new content so that it may be properly animated. For example, you may need to adjust the content from a flexible layout (i.e. { left: 0, top: 0, right: 0, bottom: 0 }) to a fixed layout (i.e. { left: 0, top: 0, width: 100, height: 200 }) so that it can be moved.
- Parameters:
- container SC.ContainerView
- The SC.ContainerView using this plugin.
- content SC.View
- The new view added to the container.
- previousStatechart SC.View
- The current content statechart in the container.
- options Object
- Options to modify the transition.
This optional method is called to set up the exit transition.
Use this method to adjust the layout of the container and new content so that it may be properly animated. For example, you may need to adjust the content from a flexible layout (i.e. { left: 0, top: 0, right: 0, bottom: 0 }) to a fixed layout (i.e. { left: 0, top: 0, width: 100, height: 200 }) so that it can be moved.
- Parameters:
- container SC.ContainerView
- The SC.ContainerView using this plugin.
- content SC.View
- The old view being removed from the container.
- options Object
- Options to modify the transition.