zoukankan      html  css  js  c++  java
  • cocos2d翻牌效果实现

    翻牌效果

    1.mac录制视频
        可以使用QuickTime Player方便地录制视频
    2.核心代码
    1 [CCOrbitCamera actionWithDuration:1.3 radius:1 deltaRadius:0 angleZ:0 deltaAngleZ:-90 angleX:0 deltaAngleX:0];
        转自 cocos2d 如何实现 翻牌效果
    3.测试代码
     1 -(void) testFlipCard
     2 {
     3     // create a sprite
     4     CCSprite *sprite1 = [CCSprite spriteWithFile: @"c1.png"];
     5     // set position of the sprite
     6     [sprite1 setPosition: ccp(240.0f, 160.0f)];
     7     // create an action
     8     id actionFunc1 = [CCSequence actions: [CCDelayTime actionWithDuration: 0.5f], [CCCallFuncN actionWithTarget: self selector: @selector(testFlipCardCallFunc1:)], [CCDelayTime actionWithDuration: 1.0f], [CCCallFuncN actionWithTarget: self selector: @selector(testFlipCardCallFunc2:)], [CCDelayTime actionWithDuration: 0.5f], nil];
     9     id actionFlip1 = [CCOrbitCamera actionWithDuration: 2.0f radius: 1.0f deltaRadius: 0.0f angleZ: 0.0f deltaAngleZ: -360.0f angleX: 0.0f deltaAngleX: 0.0f];
    10     id actionForever1 = [CCRepeatForever actionWithAction: [CCSpawn actions: actionFunc1, actionFlip1, nil]];
    11     // run action
    12     [sprite1 runAction: actionForever1];
    13     // add the sprite to the layer
    14     [self addChild: sprite1];
    15     
    16     // create a sprite
    17     CCSprite *sprite2 = [CCSprite spriteWithFile: @"c0.png"];
    18     // set position of the sprite
    19     [sprite2 setPosition: ccp(240.0f, 160.0f)];
    20     // hide sprite 2
    21     [sprite2 setVisible: NO];
    22     // create an action
    23     id actionFunc2 = [CCSequence actions: [CCDelayTime actionWithDuration: 0.5f], [CCCallFuncN actionWithTarget: self selector: @selector(testFlipCardCallFunc2:)], [CCDelayTime actionWithDuration: 1.0f], [CCCallFuncN actionWithTarget: self selector: @selector(testFlipCardCallFunc1:)], nil];
    24     id actionFlip2 = [CCOrbitCamera actionWithDuration: 2.0f radius: 1.0f deltaRadius: 0.0f angleZ: 0.0f deltaAngleZ: -360.0f angleX: 0.0f deltaAngleX: 0.0f];
    25     id actionForever2 = [CCRepeatForever actionWithAction: [CCSpawn actions: actionFunc2, actionFlip2, nil]];
    26     // run action
    27     [sprite2 runAction: actionForever2];
    28     // add the sprite to the layer
    29     [self addChild: sprite2];
    30 }
    31 
    32 -(void) testFlipCardCallFunc1 : (id) node
    33 {
    34     [node setVisible: NO];
    35 }
    36 
    37 -(void) testFlipCardCallFunc2 : (id) node
    38 {
    39     [node setVisible: YES];
    40 }
    4.测试效果


    本打算上传视频的,已经录制好了,但是还没有找到比较好的上传方法,先上传图片吧
  • 相关阅读:
    Java发送HTTP的Get 和 Post请求
    vue 中使用 Ant Design 依次提供了三级选项卡
    Postman中不为人知的秘密 之 设置全局变量,token
    vue组件之间传值(03)__兄弟组件传值,事件总线[ EventBus ]
    元素内部滚动到底部和顶部的监听
    如何将三个数的颜色色值兼容成六个数的方法
    前端内容的自动化构建
    模拟vue实现简单的webpack打包
    VXcode学习
    npm install 成功安装依赖后,运行跑不起来怎么办?
  • 原文地址:https://www.cnblogs.com/ketmales/p/2877898.html
Copyright © 2011-2022 走看看