动画简单实例

v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}

Normal
0
false

10 pt
0
2

false
false
false

EN-US
ZH-CN
X-NONE

$([{£¥·‘“〈《「『【〔〖〝﹙﹛﹝$(.[{£¥
!%),.:;>?]}¢¨°·ˇˉ―‖’”…‰′″›℃∶、。〃〉》」』】〕〗〞︶︺︾﹀﹄﹚﹜﹞!"%'),.:;?]`|}~¢

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Cambria;
mso-ascii-font-family:Cambria;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Cambria;
mso-hansi-theme-font:minor-latin;
mso-font-kerning:1.0pt;}

pic2476.png

简单的动画代码:

CCSize winSize=CCDirector::sharedDirector()->getWinSize();         //#1:生成动画需要的数据类     CCTexture2D *texture=CCTextureCache::sharedTextureCache()->addImage(“pic2476.png”);    CCSpriteFrame *frame0=CCSpriteFrame::createWithTexture(texture,CCRectMake(32*0,48*0,32,48));    CCSpriteFrame *frame1=CCSpriteFrame::createWithTexture(texture,CCRectMake(32*1,48*0,32,48));    CCSpriteFrame *frame2=CCSpriteFrame::createWithTexture(texture,CCRectMake(32*2,48*0,32,48));    CCSpriteFrame *frame3=CCSpriteFrame::createWithTexture(texture,CCRectMake(32*3,48*0,32,48));     CCArray *arrayFrames=CCArray::create();    arrayFrames->addObject(frame0);    arrayFrames->addObject(frame1);    arrayFrames->addObject(frame2);    arrayFrames->addObject(frame3);     CCAnimation *animation=CCAnimation::createWithSpriteFrames(arrayFrames,0.2f);    //#2:初始化并设置Sprite    CCSprite *sprite=CCSprite::createWithSpriteFrame(frame0);    sprite->setPosition(ccp(winSize.width/2,winSize.height/2));    addChild(sprite);    //#3:使用animation生成一个动画动作animate     CCAnimate *animate=CCAnimate::create(animation);    sprite->runAction(CCRepeatForever::create(animate));

注意,cocos2dx不支持使用clip的动画,另外,clip动画的开发成本很高,在智能手机这种大内存的平台是否适用(牺牲内存换开发速度么?),值得商量。

#2 相关的类关系图

简单过程是,使用CCTexture2D加载图片 ,用CCTexture2D生成对应的CCSpriteFrame(对应的就是帧),将CCSpriteFrame添加到CCAnimation生成动画数据,用CCAnimation生成CCAnimate(就是最终的动画动作),最后用CCSprite执行这个动作。

动作-CCActionInterval之CCAnimation&CCAnimate的更多相关文章

  1. cocos2dx基础篇(22) 基本动画CCAnimation/CCAnimate

    [小知识] CCSpriteFrame     :精灵帧.    它是相对动画而产生的,其实就是一张纹理图片. CCAnimationFrame  :动画帧.    由精灵帧与间隔帧数组成,是动画CC ...

  2. cocos2dX 之CCAnimation/CCAnimate

    我们今天来学习cocos2dX里面的动画的制作, 有人说, 不是前面CCAction已经学过了吗? 怎么还要学, CCAction是动作, 而我们今天要学的是动画哦, 是让一个东西动起来哦, 好了进入 ...

  3. cocos2dx 运动+旋转动画 CCSequence CCAnimation CCAnimate CCMoveTo CCCallFuncN

    cocos2dx 动画是个非常奇妙的东西~~. 这里看到的是一个物体,在运动的过程中会不断地翻转的过程. 两个动画一起来~~ 以下的代码中涉及到:CCAnimation(补间动画 )  CCAnima ...

  4. 动作-CCActionInterval之CCActionEase家族

    补间动作也是一个包装器(之前叫补间动画,从字面上讲,叫动作更合适一些.).你也可以叫他缓释动作. 1.含义 补间动作改变的是,内部动作的执行速率(注意,并没有改变执行的最终效果,和执行的时间.)关于这 ...

  5. 动作-CCActionInterval之CCGridAction家族

    CCGrid3DAction // 作用:x轴3D反转特效 CCActionInterval *flipX3D= CCFlipX3D::create(4); //    作用:Y轴3D反转特效 CCA ...

  6. cocos2dx中的动作

    CCAction是cocos2dx中专门用来处理动作相关的类,几乎所有的与动作相关的类都是从它派生而来的.而CCAction继承自CCObject class CCFiniteTimeAction : ...

  7. cocos2dx常见的46中+22中动作详解

    cocos2dx常见的46中+22中动作详解 分类: iOS2013-10-16 00:44 1429人阅读 评论(0) 收藏 举报 bool HelloWorld::init(){    ///// ...

  8. [Cocos2d-x For WP8]EaseActions缓动动作

    我们用Silverlight框架开发WP8的应用程序的时,编写动画可以使用缓动效果来实现缓动动画对吧,那么在Cocos2d-x框架里面我们一样是可以缓动动作(缓动动画),其实技术的东西都是想通的,如果 ...

  9. 转载cocos2dx的各种动作用法

    以下内容来源于:http://www.cnblogs.com/linux-ios/archive/2013/04/06/3001946.html 转载时请保留以上链接. bool HelloWorld ...

随机推荐

  1. SQL server数据类型int、bigint、smallint、tinyint

    1. 整数类型 int.bigint.smallint.tinyint 数据类型 范围 存储 bigint -2^63 (-9,223,372,036,854,775,808) 到 2^63-1 (9 ...

  2. java代码转换为c# 工具

    Demo Java to C# Converter.exe 已下载到 F:\SoftWare-new\java\Java_to_CSharp_Converter.rar

  3. 【HDOJ】3337 Guess the number

    神一样的题目.简言之,利用手段获得测试用例的第一行,输出结果.很显然利用wa, TLE, OLE等judge status可以获得测试用例.因此,果断Python写一个acm提交机器人.依赖lxml库 ...

  4. WIP_DISCRETE_JOBS.STATUS_TYPE

    WIP_DISCRETE_JOBS.STATUS_TYPE Value Meaning 7 Cancelled 8 Pending Bill Load 9 Failed Bill Load 10 Pe ...

  5. [Hadoop源码解读](二)MapReduce篇之Mapper类

    前面在讲InputFormat的时候,讲到了Mapper类是如何利用RecordReader来读取InputSplit中的K-V对的. 这一篇里,开始对Mapper.class的子类进行解读. 先回忆 ...

  6. Hibernate java.lang.NoSuchFieldError: INSTANCE

    在使用hibernate3.6.2是我遇到了一个有趣的错误java.lang.NoSuchFieldError: INSTANCEat org.hibernate.type.BasicTypeRegi ...

  7. htmlparser源码简单分析

    Htmlparser源代码分析 一.根目录下的类 1.Attribute.java 属性类,四个field:mName,mAssignment,mValue,mQuote; 空白标签时:mName=n ...

  8. 从零开始学习jQuery (八) 插播:jQuery实施方案

    一.摘要 本系列文章将带您进入jQuery的精彩世界, 其中有很多作者具体的使用经验和解决方案,  即使你会使用jQuery也能在阅读中发现些许秘籍. 本篇文章属于临时插播,  用于介绍我在本公司的j ...

  9. Python能做什么

       There should be one--and preferably only one --obvious way to do it. 首先,对于小白来说,Python比较容易上手.额就是个活 ...

  10. Entity Framework 杂碎

    其实看图很简单,database first和model first都是通过 data model创建的edmx文件,只不过model first模块可以自己根据需要创建和修改实体,显得更加灵活. c ...