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.测试效果


    本打算上传视频的,已经录制好了,但是还没有找到比较好的上传方法,先上传图片吧
  • 相关阅读:
    多线程之同步代码块与同步函数
    图片上传客户端与服务端
    tcp上传学习二--文本文件上传
    javaScript编写9*9口诀
    tcp聊天
    udp聊天室--简易
    往sencha.cmd中恢复设计项时,不论是系统的还是应用的,恢复进去之后都应该一键发布到前端
    一个设计项上的按钮调另一个设计项的列表界面,同时加筛选条件
    点击【****】设计项上的某个按钮,直接调出另一个设计项的【编辑界面】
    前端向后端发送请求,后端返回的一个值的请求的ajax.get();方法
  • 原文地址:https://www.cnblogs.com/ketmales/p/2877898.html
Copyright © 2011-2022 走看看