热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

9.多彩的幕布layer

CCLayerCorlorboolCCLayerColor::initWithColor(constccColor4B&color);boolCCLayerColor::init
  • CCLayerCorlor

    bool CCLayerColor::initWithColor(const ccColor4B & color);
    bool CCLayerColor::initWithColor(const ccColor4B & color, GLfloat w, GLfloat h);
    //例子
    CCLayerColor::initWithColor(ccc4(255, 255, 255, 255));
    CCLayerColor::initWithColor(cc4(
    255, 255, 255), 100, 100);
    ignoreAnchorPointForPosition(
    false);

     

  • CCLayerGradient

    bool CCLayerGradient::initWithColor(const ccColor4B & start, const ccColor4B& end);
    bool CCLayerGradient::initWithColor(const ccColor4B & start,const CCLayerGradient, const CCPoint& v);
    //例子
    CCLayerGradient::initWithColor(ccc4(123, 89, 0, 255), ccc4(0, 255, 255, 255), ccp(10));

     

代码例子:

1 class T4ColorLayer:public CCLayerGradient
2 {
3 public:
4 static CCScene *scene();
5 CREATE_FUNC(T4ColorLayer);
6 bool init();
7 };
8
9 bool T4ColorLayer::init()
10 {
11 //CCLayerColor::initWithColor(ccc4(255, 255, 255, 255));
12 CCLayerGradient::initWithColor(ccc4(255, 0, 0, 255), ccc4(0, 0, 255, 255));
13 return true;
14 }
15

 

运行效果:

 

转:https://www.cnblogs.com/xiaochi/p/8350206.html



推荐阅读
author-avatar
唯爱WE创丶
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有