CCTransition class -- Cocos2D-Swift v3.3, cocos2dswift

Source: Internet
Author: User

CCTransition class -- Cocos2D-Swift v3.3, cocos2dswift
CCTransition Class Reference

Inherited from: CCScene: CCNode: CCResponder: NSObject

Declared From: CCTranslation. h

 

Overview:

A transition animates the presentation of a new scene while moving the current scene out of view. A transition is optionally played when calling one of the presentScene: withTransition: methods of CCDirector.

When the current scene is removed from the view, transition activates a new scene display. When the prensentScene: withTransition method of CCDirector is called, transition is an optional parameter.

Note:Since both scenes remain in memory and are being rendered, a transition may raise performance issues or memory warnings. if two complex scenes can not be reliably transitioned from/to it is best to not use transitions or to introduce an in-between scene that is presented only for a short period of time (ie loading scene or merely a "fade to black" scene ).

Note: At the underlying layer, all scenes are stored in the memory. transition can cause performance problems or memory warnings. If two complex scenes cannot be effectively transition, it is recommended that you do not use transitions or introduce a built-in scene that only shows a short period of time (such as loading scene or gradually blackening scene ).

 

TasksCreating a Fade Scene Transition
  • + transitionCrossFadeWithDuration:
  • + transitionFadeWithColor:duration:
  • + transitionFadeWithDuration:

Creating a Directional Scene Transition
  • + transitionMoveInWithDirection:duration:
  • + transitionPushWithDirection:duration:
  • + transitionRevealWithDirection:duration:

Transition Performance Settings
  •   outgoingDownScaleProperty
  •   incomingDownScaleProperty
  •   retinaTransitionProperty
  •   transitionPixelFormatProperty
  •   transitionDepthStencilFormatProperty

Controlling Scene Animation during Transition
  •   outgoingSceneAnimatedProperty
  •   incomingSceneAnimatedProperty

Transition Running Time and Progress
  •   runTimeProperty
  •   progressProperty

 

Properties

 

IncomingDownScale

Will downscale incoming scene. Can be used as an effect, or to decrease render time on complex scenes. Default 1.0.

@property (nonatomic, assign) float incomingDownScaleYou can reduce the size of the input scene. It can be used as an effect or reduce the underlying time in complex scene. Declared In CCTransition.hIncomingSceneAnimated

Defines whether incoming scene will be animated during transition. Default NO.

Specifies whether the transferred scene will be activated during the transition process. The default value is NO.

@property (nonatomic, getter=isIncomingSceneAnimated) BOOL incomingSceneAnimatedDeclared In CCTransition.hOutgoingDownScale

Will downscale outgoing scene. Can be used as an effect, or to decrease render time on complex scenes. Default 1.0.

This can reduce the size of the outgoing scene. It can be used as an effect, or reduce the time required for underlying processing on complex scenes.

@property (nonatomic, assign) float outgoingDownScaleDeclared In CCTransition.hOutgoingSceneAnimated

Defines whether outgoing scene will be animated during transition. Default NO.

Define whether the output scenario is activated during the transition process. NO by default

@property (nonatomic, getter=isOutgoingSceneAnimated) BOOL outgoingSceneAnimatedDeclared In CCTransition.hSS

Normalized (percentage) transition progress in the range 0.0 to 1.0.

Normalize the transition progress within the range of 0.0 to 1.0 (in percent form)

@property (nonatomic, readonly) float progressDeclared In CCTransition.hRetinaTransition

Transition will be performed med in retina resolution. Will force outgoingDownScale and incomingDownScale to 1.0 on non retina devices, and 2.0 on retina devices if not set. Default YES.

@property (nonatomic, getter=isRetinaTransition) BOOL retinaTransitionDeclared In CCTransition.hRunTime

The actual transition runtime in seconds.

The actual transition running time.

@property (nonatomic, readonly) NSTimeInterval runTimeDeclared In CCTransition.hTransitionDepthStencilFormat

Depth/stencel format used for transition. DefaultGL_DEPTH24_STENCIL8_OES.

@property (nonatomic, assign) GLuint transitionDepthStencilFormatDeclared In CCTransition.hTransitionPixelFormat

Pixel format used for transition. DefaultCCTexturePixelFormat_RGBA8888.

@property (nonatomic, assign) CCTexturePixelFormat transitionPixelFormatSee Also
  • CCTexturePixelFormat

Declared In CCTransition.hClass MethodstransitionCrossFadeWithDuration:

Creates a cross fade transition directly from outgoing to incoming scene.

Create a cross-gradient transition. (In the old scenario, the alpha value changes from 1 to 0, the alpha value of the new scenario changes from 0 to 1, and the two cross nodes are together)

+ (CCTransition *)transitionCrossFadeWithDuration:(NSTimeInterval)durationParameters
Duration

The duration of the transition in seconds.

Return Value

The CCTransition Object.

Declared In CCTransition.hTransitionFadeWithColor: duration:

Creates a fade transition from outgoing to incoming scene, through color.

Create a gradient transition using a color scenario. (First from the old scene cross fade to the color scene, then from the color scene cross fade to the new scene)

+ (CCTransition *)transitionFadeWithColor:(CCColor *)color duration:(NSTimeInterval)durationParameters
Color

The color to fade through

Duration

The duration of the transition in seconds.

Return Value

The CCTransition Object.

See Also
  • CCColor

Declared In CCTransition.hTransitionFadeWithDuration:

Creates a fade transition from outgoing to incoming scene, through black.

Wear a gradient transition through a black scene.

+ (CCTransition *)transitionFadeWithDuration:(NSTimeInterval)durationParameters
Duration

The duration of the transition in seconds.

Return Value

The CCTransition Object.

Declared In CCTransition.hTransitionMoveInWithDirection: duration:

Creates a transition where the incoming scene is moved in over the outgoing scene.

Create a transtion (the effect is that the new scene is moved to the old scene like a lid)

Note: CCTransitionDirection:

typedef NS_ENUM(NSInteger, CCTransitionDirection ) {
   CCTransitionDirectionUp,
   CCTransitionDirectionDown,
   CCTransitionDirectionRight,
   CCTransitionDirectionLeft,
   CCTransitionDirectionInvalid = -1,
};

+ (CCTransition *)transitionMoveInWithDirection:(CCTransitionDirection)direction duration:(NSTimeInterval)durationParameters
Direction

Direction to move the incoming scene.

Duration

The duration of the transition in seconds.

Return Value

The CCTransition Object.

See Also
  • CCTransitionDirection

Declared In CCTransition.hTransitionPushWithDirection: duration:

Creates a transition where the incoming scene pushed the outgoing scene out.

The effect is that the new scene pushes the old scene and moves it in parallel.

+ (CCTransition *)transitionPushWithDirection:(CCTransitionDirection)direction duration:(NSTimeInterval)durationParameters
Direction

Direction to move incoming and outgoing scenes.

Duration

The duration of the transition in seconds.

Return Value

The CCTransition Object.

See Also
  • CCTransitionDirection

Declared In CCTransition.hTransitionRevealWithDirection: duration:

Creates a transition where the incoming scene is revealed by sliding the outgoing scene out.

The old scene is covered in the new scene, and then the old one is removed like the old one, and the new one is revealed. In contrast to moving in, one is built in a new scenario, and the other is revealed in an old scenario.

+ (CCTransition *)transitionRevealWithDirection:(CCTransitionDirection)direction duration:(NSTimeInterval)durationParameters
Direction

Direction to slide outcoing scene.

Duration

The duration of the transition in seconds.

Return Value

The CCTransition Object.

See Also
  • CCTransitionDirection

Declared In CCTransition.h

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.