All special effects for ccscene switching (27 effects) and screen portrait setting!

Source: Internet
Author: User

[Ccdirector shareddire] replacescene: [gamelayer scene]; original address: http://blog.csdn.net/xiaominghimi/article/details/6651281 ccscene must be familiar with cocos2d shoes, so when using [[ccdirectorshareddirector] replacescene: <# (ccscene *) scene #>]; cocos2d provides some special effects for transition when switching scene scenarios (cclayout). Today, we carefully turn on the cocos2d source code, I tested all the animation effects and sorted them out as follows. Let's check them and use them. Because I am using the latest cocos2d Version 1.0, therefore, some function methods are different from the previous ones, so don't be surprised. Because the Code has comments, you can directly go to the code and do not explain them in detail; all the comments are my intuitive experience. We recommend that you put them in your project and take a look at each effect, which is memorable; view plain // touch event-method called when the finger is lifted from the screen-himi-(void) cctouchesended :( nsset *) touches withevent :( uievent *) event {ccscene * scenec = [otherlayout scene]; // blog ------ // cctransitionturnofftiles * transitionscene = [cctransitionturnofftiles transitionwithduration: 3 scene: scenec]; // near-distance ----- // cctransitionshrinkgrow * transitionscene = [cctransitionshrinkgrow transitionwithduration: 3 scene: scenec]; // the left side of the other layout is displayed (the screen is shifted to the right) // transfer* transitionscene = [transfertransitionwithduration: 3 scene: scenec]; // enter the right side of another layout (the visual feeling is that the screen is moved left) // cctransitionslideinr * transitionscene = [transfertransitionwit: 3 scene: scenec]; // The other layout top-side access (visual perception is screen down) // cctransitionslideint * transitionscene = [cctransitionslideint transitionwithduration: 3 scene: scenec]; // another layout lower-side entry (visual perception is screen-up) // cctransitionslideinb * transitionscene = [cctransitionslideinb transitionwithduration: 3 scene: scenec]; // The current screen is divided into three columns, two moves down, middle move up // cctransitionsplitcols * transitionscene = [cctransitionsplitcols transitionwithduration: 3 scene: scenec]; // The current screen is divided into three columns, and the two move left, middle right shift // required * transitionscene = [audio transitionwithduration: 3 scene: scenec]; // sector conversion ----- // required * transitionscene = [audio transitionwithduration: 3 scene: scenec]; // plane rotation ----- // required * transitionscene = [cctransitionrotozoom transitionwithduration: 3 scene: scenec]; // near-far-beat ------ // required * transitionscene = [transfer transitionwithduration: 3 scene: scenec]; // stereoscopic inversion (X axis) -- (there is also a feeling from near to far, from far to near) -------- // cctransitionzoomflipx * transitionscene = [effectransitionwithduration: 3 scene: scenec]; // stereoscopic inversion (Y axis)-(there is also a feeling of going from near to far, from far to near) ------- // cctransitionzoomflipy * transitionscene = [Semi transitionwithduration: 3 scene: scenec]; // stereoscopic inversion (X, Y axis) --- (there is also a feeling of going from near to far, from far to near) ----- // cctransitionzoomflipangular * transitionscene = [effectransitionwithduration: 3 scene: scenec]; // enter the left side of another layout to overwrite the current layout.

// Cctransitionmoveinl * transitionscene = [cctransitionmoveinl transitionwithduration: 3 scene: scenec];

// Enter the right side of another layout to overwrite the current layout // cctransitionmoveinr * transitionscene = [cctransitionmoveinr transitionwithduration: 3 scene: scenec]; // overwrite the current layout on the other layout. // cctransitionmoveint * transitionscene = [cctransitionmoveint transitionwithduration: 3 scene: scenec]; // The lower side of another layout will overwrite the current layout // cctransitionmoveinb * transitionscene = [cctransitionmoveinb transitionwithduration: 3 scene: scenec]; // three-dimensional inversion (X axis) -- 2D Plane inversion, no sense of distance // cctransitionflipx * transitionscene = [cctransitionflipx transitionwithduration: 3 scene: scenec]; // three-dimensional inversion (Y axis) -- 2D plane inversion, no sense of distance // cctransitionflipy * transitionscene = [cctransitionflipy transitionwithduration: 3 scene: scenec]; // three-dimensional inversion (X, Y axis) -- 2D plane inversion, no sense of distance // cctransitionflipangular * transitionscene = [cctransitionflipangular transitionwithduration: 3 scene: scenec]; // entity-transparent-entity (color-included by default) // cctr Ansitionfade * transitionscene = [cctransitionfade progress: 3 scene: scenec withcolor: ccwhite]; // another direct gradient overwrites the current layout // optional * transitionscene = [transfer transitionwithduration: 3 scene: scenec]; // move (grid-like) a blog, from bottom left to top right // cctransitionfadetr * transitionscene = [cctransitionfadetr transitionwithduration: 3 scene: scenec]; // move (grid-like) blog, from top right to bottom left cctransitionfadebl * Trans Itionscene = [transfer transitionwithduration: 3 scene: scenec]; // move (long rectangle, width: screen width) the group, from bottom up // optional * transitionscene = [cctransitionfadeup transitionwithduration: 3 scene: scenec]; // move (long rectangle, width is screen width); move from top to bottom // cctransitionfadedown * transitionscene = [cctransitionfadedown transitionwithduration: 3 scene: scenec]; [[ccdirector shareddire] replacescene: transitionscene];} himi recommended Everyone uses common sense to run each special effect. After all, everyone has a different feeling. Comments are all written by me. I just commented on them; next, I will introduce how to set the portrait display in cocos2d 1.0, because the default screen is a horizontal screen. First, find rootviewcontroller. M class (this class exists in version 1.0), and then find a piece of macro-defined Code. The Code is as follows: # Elif game_autorotation = kgameautorotationuiviewcontroller. Then, the default code of cocos2d is to set a horizontal screen: view plainreturn (uiinterfaceorientationislandscape (interfaceorientation); to set a portrait screen, change the following: View plainreturn (uiinterfaceorientationisportrait (interfaceorientation) ); OK. we will introduce it here today ~ Continue Learning ~ The following is a blog effect, which is a special switching effect from the lower left to the upper right. cctransitionfade, // The gradient effect cctransitionfadetr, // The fragment effect cctransitionjumpzoom, // The beating effect cctransitionmoveinl, // move cctransitionpageturn from left to right, // flip effect seek, // swing effect cctransitionrotozoom, // turbine effect seek, // cctransitionshrinkgrow, // fade effect cctransitionslideinl, // shift left to cctransitionsplitcols, // move up and down cctransitionturnofftiles // cctransitionscene: ccscene // The base class ccrotozoomtra Nsition // switch ccjumpzoomtransition after rotation and zoom out // switch ccslideinltransition from left to right // switch ccslideinttransition from right to left // switch from top to bottom switch between centers // gradually scale down switch ccflipxtransition // The ccflipytransition has been switched from the center of X to the axis plane rotation switch ccflipytransition // the center of Y has been switched to the axis plane rotation switch ccflipangulartransition // X is the axis rotation switch cczoomflipytransition // After the scale-out, Y is the axis rotation switch cczoomflipangulartransition // C Cfadetransition // gradually fades switch cccrossfadetransition // gradually fades switch 2 Gb/s // random box Coverage Switch ccsplitcolstransition switch ccsplitrowstransition // switch between the three sides and the left and right sides to switch between the two sides. // switch between the small square switch to the lower left to upper right! Ccfadebltransition // switch between the top right and the bottom left of the small block! Blind // shutter bottom up ↓ // shutter top down cctransitionrotozoom: cctransitionscene // rotate to cctransitionjumpzoom: cctransitionscene // beat to bottom: cctransitionscene <strong> // enter the left: else // enter cctransitionmoveint: direction from the right: direction: Direction // enter cctransitionslideinl: cctransitionscene <cctransitioneasescene> // slide cctransitionslideinr from the left: else // slide from the right to cctransitionslideinl // slide from the top to cctransitionslideint: Break // slide from the bottom to cctransitionscene <cctransitioneasescene> // alternate to cctransitionflipx: cctransitionsceneoriented // X axis (left and right) cctransitionflipy) rotate: Rotate // y axis flip zoom in zoom out effect (up and down) Fill: rotate top left right bottom axis flip in zoom out effect cctransitionfade: cctransitionscene // darken to cctransitioncrossfade: cctransitionscene // gradient to fill: cctransitionscene <strong> // The small square disappears into cctransitionsplitcols: cctransitionscene <cctransitioneasescene> // switch the bars to cctransitionsplitrows: fail // switch to cctransitionfadetr: cctransitionscene <strong> // displayed in the upper-right corner of the cell to go to cctransitionfadebl: Drawing // displayed in the lower left corner of the cell to go to the upper left corner To Go To The cctransitionfadetr: [ccdirector shareddirector] replacescene: [gamelayer scene]; two methods for scenario switching: direct call scenario [ccdirector shareddire] replacescene: [gamelayer scene]; 2. Execute ccscene * scene = [ccscene node] From the init function; [scene addchild: [gamelayer node]; [[ccdirector shareddire] replacescene: [effectransitionwithduration: 1.2f scene: scene]; Method for switching scenarios in scaling mode [[ccdirector shareddire] replacescene: [ccshrinkgrowtransition transitionwithduration: 1.2f Scene: Scene];


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.