日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

2.CCGridAction(3D效果),3D反转特效,凸透镜特效,液体特效,3D翻页特效,水波纹特效,3D晃动的特效,扭曲旋转特效,波动特效,3D波动特效

發布時間:2024/9/27 编程问答 28 豆豆


1 類圖組織

2 實例

CCSprite * spr = CCSprite::create("HelloWorld.png");

spr->setPosition(ccp(winSize.width/2,winSize.height/2));

addChild(spr);

?

//GridAction

//CCFlipX3D * action = CCFlipX3D::create(2);

//CCFlipY3D * action = CCFlipY3D::create(2);

//CCLens3D * action = CCLens3D::create(2,

CCSize(20,20),ccp(240,160),100);

//CCLiquid * action = CCLiquid::create(4, CCSize(20, 20), 20, 35);

//CCPageTurn3D * action = CCPageTurn3D::create(2, CCSize(20,20));

//CCRipple3D * action = CCRipple3D::create(2,

CCSize(20,20),ccp(240,160),40,20,30);

//CCShaky3D * action = CCShaky3D::create(2,

CCSize(20,20),20,false);

//CCTwirl * action = CCTwirl::create(2,

CCSize(20,20),ccp(240,160),3,30);

//CCWaves * action = CCWaves::create(2,

CCSize(20,20),30,30,false,true);

//CCWaves3D * action = CCWaves3D::create(2, CCSize(20,20),30,30);

?

3 ?Y? 3D反轉特效(CCFlipX3D

CCActionInterval* filpX = CCFlipX3D::create(5);?

sp->runAction(filpX);?

//作用:Y3D反轉特效

//參數:特效持續的時間

案例:

T18Grid3D.h

#ifndef __T18Grid3D_H__

#define __T18Grid3D_H__

?

#include "cocos2d.h"

#include "TBack.h"

USING_NS_CC;

class T18Grid3D :public TBack

{

public:

??? static CCScene * scene();

??? CREATE_FUNC(T18Grid3D);

??? bool init();

};

?

#endif

T18Grid3D.cpp

#include "T18Grid3D.h"

#include "AppMacros.h"

?

CCScene *T18Grid3D::scene()

{

??? CCScene * scene = CCScene::create();

??? T18Grid3D * layer = T18Grid3D::create();

??? scene->addChild(layer);

??? return scene;

}

?

bool T18Grid3D::init()

{

??? TBack::init();

???

??? //Grid3D

??? CCSprite * spr = CCSprite::create("HelloWorld.png");

??? spr->setPosition(ccp(winSize.width / 2, winSize.height / 2));

??? addChild(spr);

?

??? //x? 3D反轉特效

??? CCActionInterval* filpX = CCFlipX3D::create(5);

??? spr->runAction(filpX);

?

??? return true;

}

運行效果:

Y3D發轉特效

CCActionInterval* filpY = CCFlipY3D::create(5);

spr->runAction(filpY);

#include "T18Grid3D.h"

#include "AppMacros.h"

?

CCScene *T18Grid3D::scene()

{

??? CCScene * scene = CCScene::create();

??? T18Grid3D * layer = T18Grid3D::create();

??? scene->addChild(layer);

??? return scene;

}

?

bool T18Grid3D::init()

{

??? TBack::init();

???

??? //Grid3D

??? CCSprite * spr = CCSprite::create("HelloWorld.png");

??? spr->setPosition(ccp(winSize.width / 2, winSize.height / 2));

??? addChild(spr);

?

??? //x? 3D反轉特效

??? CCActionInterval * filpY = CCFlipY3D::create(5);

??? spr->runAction(filpY);

?

??? return true;

}

運行效果:

凸透鏡特效

CCLen3D * CCLen3D::create(float duration,const CCSize & gridSize,const CCPoint& position,float radius);

?

CCPointMake表示的是創建一個點)

CCActionInterval* lens = CCLens3D::create(2, CCSize(10, 10),CCPointMake(240, 160), 240);

spr->runAction(lens);

作用:凸鏡特效

參數:網格持續的時間

參數:網格大小

參數:凸透鏡中心點

參數:凸鏡半徑

#include "T18Grid3D.h"

#include "AppMacros.h"

?

CCScene *T18Grid3D::scene()

{

??? CCScene * scene = CCScene::create();

??? T18Grid3D * layer = T18Grid3D::create();

??? scene->addChild(layer);

??? return scene;

}

?

bool T18Grid3D::init()

{

??? TBack::init();

???

??? //Grid3D

??? CCSprite * spr = CCSprite::create("HelloWorld.png");

??? spr->setPosition(ccp(winSize.width / 2, winSize.height / 2));

??? addChild(spr);

?

??? //凸透鏡特效

??? CCLens3D * action = CCLens3D::create(20,CCSize(20,20),

??????? ccp(240,160),100);

??? spr->runAction(action);

?

??? return true;

}

運行結果:

CCLiquid* CCLiquid::create(float duration, const CCSize& gridSize, unsigned int waves, float amplitude);

spr->runAction(liquid);

作用:液體特效

參數:特效持續時間

參數:網格大小

參數:wave個數

參數:振幅

#include "T18Grid3D.h"

#include "AppMacros.h"

?

CCScene *T18Grid3D::scene()

{

??? CCScene * scene = CCScene::create();

??? T18Grid3D * layer = T18Grid3D::create();

??? scene->addChild(layer);

??? return scene;

}

?

bool T18Grid3D::init()

{

??? TBack::init();

???

??? //Grid3D

??? CCSprite * spr = CCSprite::create("HelloWorld.png");

??? spr->setPosition(ccp(winSize.width / 2, winSize.height / 2));

??? addChild(spr);

?

??? //液體震蕩特效

??? CCLiquid *action = CCLiquid::create(8,CCSize(4,4),10,3);

??? spr->runAction(action);

?

??? return true;

}

運行結果(出現液體的震蕩效果):

3D 翻頁特效

CCPageTurn3D* CCPageTurn3D::create(float duration, const CCSize& gridSize);

CCActionInterval * pageTurn3D = CCPageTurn3D::create(4,CCSize(20,20));

spr->runAction(pageTurn3D);

//作用:3D翻頁特效

//參數:特效持續的時間

//參數:網格大小

#include "T18Grid3D.h"

#include "AppMacros.h"

?

CCScene *T18Grid3D::scene()

{

??? CCScene * scene = CCScene::create();

??? T18Grid3D * layer = T18Grid3D::create();

??? scene->addChild(layer);

??? return scene;

}

?

bool T18Grid3D::init()

{

??? TBack::init();

???

??? //Grid3D

??? CCSprite * spr = CCSprite::create("HelloWorld.png");

??? spr->setPosition(ccp(winSize.width / 2, winSize.height / 2));

??? addChild(spr);

?

??? //3D 翻頁特效

??? CCPageTurn3D * action = CCPageTurn3D::create(20, CCSize(20, 20));

??? spr->runAction(action);

?

??? return true;

}

水波紋特效

CCRipple3D* CCRipple3D::create(

float duration,

const CCSize& gridSize,

const CCPoint& position,

float radius,

unsigned int waves,

float amplitude);

作用:水波特效

參數:特效持續的時間

參數:網格大小

參數:起始位置

參數:半徑

參數:速率

參數:振幅

#include "T18Grid3D.h"

#include "AppMacros.h"

?

CCScene *T18Grid3D::scene()

{

??? CCScene * scene = CCScene::create();

??? T18Grid3D * layer = T18Grid3D::create();

??? scene->addChild(layer);

??? return scene;

}

?

bool T18Grid3D::init()

{

??? TBack::init();

???

??? //Grid3D

??? CCSprite * spr = CCSprite::create("HelloWorld.png");

??? spr->setPosition(ccp(winSize.width / 2, winSize.height / 2));

??? addChild(spr);

?

??? //水波紋特效

??? CCActionInterval * action = CCRipple3D::create(

??????? 10,???????????????????? //特效持續的時間

??????? CCSize(10, 10),???????? //網格大小

??????? CCPointMake(240, 210),? //起始位置

??????? 40,???????????????????? //半徑

??????? 6,????????????????????? //速率

??????? 160);?????????????????? //振幅

??? spr->runAction(action);

?

??? return true;

}

3D 晃動特效

CCShaky3D *CCShaky3D::create(float duration,const CCSize& gridSize,int range,bool shakeZ);

CCActionInterval* shaky3D = CCShaky3D::create(5, CCSize(10, 10), 15, false);

sp->runAction(shaky3D);

作用:創建一個3d晃動的特效

參數:特效持續的時間

參數:網格大小

參數:晃動的范圍

參數:是否有Z軸晃動

#include "T18Grid3D.h"

#include "AppMacros.h"

?

CCScene *T18Grid3D::scene()

{

??? CCScene * scene = CCScene::create();

??? T18Grid3D * layer = T18Grid3D::create();

??? scene->addChild(layer);

??? return scene;

}

?

bool T18Grid3D::init()

{

??? TBack::init();

???

??? //Grid3D

??? CCSprite * spr = CCSprite::create("HelloWorld.png");

??? spr->setPosition(ccp(winSize.width / 2, winSize.height / 2));

??? addChild(spr);

?

??? CCShaky3D * action = CCShaky3D::create(

??????? 20,??????????????? //特效持續的時間

??????? CCSize(70, 70),??? //網格大小

??????? 60,??????????????? //晃動的范圍

??????? true);???????????? //是否有z軸晃動

?

??? spr->runAction(action);

?

??? return true;

}

扭曲旋轉特效

CCTwirl* CCTwirl::create(float duration, const CCSize& gridSize, CCPoint position, unsigned int twirls, float amplitude);

CCActionInterval* twirl = CCTwirl::create(50, CCSize(10, 10), CCPointMake(240, 160), 2, 2.5);

sp->runAction(twirl);

//作用:扭曲旋轉特效

//參數:特效持續時間

//參數:網格大小

//參數:扭曲旋轉中心點

//參數:扭曲旋轉的次數

//參數:振幅

#include "T18Grid3D.h"

#include "AppMacros.h"

?

CCScene *T18Grid3D::scene()

{

??? CCScene * scene = CCScene::create();

??? T18Grid3D * layer = T18Grid3D::create();

??? scene->addChild(layer);

??? return scene;

}

?

bool T18Grid3D::init()

{

??? TBack::init();

???

??? //Grid3D

??? CCSprite * spr = CCSprite::create("HelloWorld.png");

??? spr->setPosition(ccp(winSize.width / 2, winSize.height / 2));

??? addChild(spr);

?

??? CCActionInterval* action = CCTwirl::create(

??????? 50, ??????????????????? //特效持續時間??

??????? CCSize(10, 10), ??????? //網格大小

??????? CCPointMake(240, 160), //扭曲旋轉中心點

??????? 2, ???????????????????? //扭曲旋轉的次數

??????? 2.5);?????????????????? //振幅

?

??? spr->runAction(action);

?

??? return true;

}

波動特效

CCWaves* CCWaves::create(

float duration,

const CCSize& gridSize,

unsigned int waves,

float amplitude,

bool horizontal,

bool vertical);

作用:創建一個波動特效

參數:特效持續時間

參數:網格大小

參數:波動的速率

參數:振幅

參數:水平波動

參數:垂直波動

#include "T18Grid3D.h"

#include "AppMacros.h"

?

CCScene *T18Grid3D::scene()

{

??? CCScene * scene = CCScene::create();

??? T18Grid3D * layer = T18Grid3D::create();

??? scene->addChild(layer);

??? return scene;

}

?

bool T18Grid3D::init()

{

??? TBack::init();

???

??? //Grid3D

??? CCSprite * spr = CCSprite::create("HelloWorld.png");

??? spr->setPosition(ccp(winSize.width / 2, winSize.height / 2));

??? addChild(spr);

?

??? //創建一個波動特效

??? CCWaves * action = CCWaves::create(

??????? 20,??????????????? //特效持續時間

??????? CCSize(20, 20),??? //網格大小

??????? 30,??????????????? //波動的速率

??????? 30,??????????????? //振幅

??????? false,???????????? //水平波動

??????? true);???????????? //垂直波動

?

??? spr->runAction(action);

?

??? return true;

}

運行結果:

3D波動特效(創建一個3D波動特效)

CCWaves3D* CCWaves3D::create(

float duration,

const CCSize& gridSize,

unsigned int waves,

float amplitude);

參數:特效持續時間

參數:網格大小

參數:波動的速率

參數:振幅

#include "T18Grid3D.h"

#include "AppMacros.h"

?

CCScene *T18Grid3D::scene()

{

??? CCScene * scene = CCScene::create();

??? T18Grid3D * layer = T18Grid3D::create();

??? scene->addChild(layer);

??? return scene;

}

?

bool T18Grid3D::init()

{

??? TBack::init();

???

??? //Grid3D

??? CCSprite * spr = CCSprite::create("HelloWorld.png");

??? spr->setPosition(ccp(winSize.width / 2, winSize.height / 2));

??? addChild(spr);

?

??? CCWaves3D * action = CCWaves3D::create(

??????? 20,

??????? CCSize(20,20),

??????? 30,

??????? 30);

?

??? spr->runAction(action);

?

??? return true;

}

運行結果:

?

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的2.CCGridAction(3D效果),3D反转特效,凸透镜特效,液体特效,3D翻页特效,水波纹特效,3D晃动的特效,扭曲旋转特效,波动特效,3D波动特效的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。