cocos2d CascadeOpacity 小坑

cocos2d-x 之按钮的回调函数是如何绑定与调用的     上篇讲到,自定义一个宏,实现按钮的音效在绑定的回调调用前播放。那么,现在就来详细分析一下,这是如何做到的,其实,主要就是要弄明白,回调函数是如何绑定,以及被调用。      1.回调函数如何绑定:       在CCMenuItem.h里边有如下代码: typedef std::function<void(Ref*)> ccMenuCallback; /*ccMenu... 阅读详情


layer    FadeOut action  貌似 默认   CascadeOpacity   都是关闭的



如果是关闭状态,子节点的 透明度就不受父节点的影响.


开启方法 

layer->setCascadeOpacityEnabled(true)
layer->isCascadeOpacityEnabled()   //可获取开启状态








【CloudCompare】Windows源码编译CloudCompare 本文详细介绍了在Windows环境下编译安装CloudCompare V2.12.0的过程。首先配置了PCL 1.14.1、CMake 3.30.6和QT 5.14.2开发环境,使用Visual Studio 2022工具集。然后下载源码并通过CMake进行配置,特别注意勾选PLUGIN_STANDARD_QPCL以支持PCD文件加载。最后在VS2022中编译安装,并指出Debug模式下可能遇到的VTK库后缀问题,需添加CMAKE_DEBUG_POSTFIX变量解决。整个流程涵盖了从环境搭建到最终编译成功的 阅读详情

相关推荐

从零到一:手把手教你用YonBuilder for NCC搭建NC Cloud 2021.11开发环境(含避坑指南)

本文详细指导如何使用YonBuilder for NCC搭建NC Cloud 2021.11开发环境,涵盖硬件要求、软件安装、YonBuilder配置及常见故障排除。特别提供避坑指南,帮助开发者快速上手NCC开发,确保环境配置的原子化分解和开发思维的体系化建立。

weixin_42523326的博客 353

Morris算法遍历二叉树

中序遍历步骤 如果当前节点左子节点(cur.left)为空,输出当前节点(cur),进入右子节点(cur.right)。 如果当前节点左子节点(cur.left)非空,找到当前节点左子树的最右节点(mostRight): 1)如果该节点的右子节点(mostRight.right)为空,则将其指针指向当前节点(cur),进入左子节点(cur.left)。 2)如果该节点的右子节点(mostRight.right)非空,则将其指针置为空,输出当前节点(cur),进入右子节点(cur.right)。

qq_40585050的博客 833

Unity特效序列帧输出全攻略:Recorder+Timeline保姆级教程(解决透明通道问题)

本文提供Unity特效序列帧输出的完整解决方案,重点讲解如何结合Recorder与Timeline工具,实现带透明通道的PNG序列帧高效输出。通过保姆级教程,详细解析摄像机隔离、层级设置、参数配置等关键步骤,并深度解决透明通道丢失等常见问题,帮助特效师和动画师打通引擎创作与后期合成的工作流。

tensorflowjs6的博客 433

cocos creator移动事件和 opacity

当node在节点node的touchEvent中 如果节点node在touch_move中有opacity的改变。在touch_end或者touch_cancel事件中,在还原的时候会出现一些问题。 出现问题的假设是该node有多个子节点,而子节点会随着父节点node的改变也会发生改变,这点很神奇,这个bug找了好长时间才找到, 在开始设置改变该node的opacity时,只要设置一个属性就

W_han__的博客 5225

CTP-API开发系列之三:柜台系统简介

综合交易平台(Comprehensive Transaction Platform,CTP)是专门为期货公司开发的一套期货经纪业务管理系统,由交易、风险控制和结算三大系统组成。接下来分享的内容,对于期货公司的负责交易、运维同事会比较熟悉,针对CTP-API接口对接的朋友可以了解一下,在接口之上的系统是怎样的。

码上助君的专栏 6213

STM32F103循迹小车PID调参实战:手把手教你整定舵机PD与电机PI参数

本文详细介绍了基于STM32F103的循迹小车PID调参实战,重点讲解舵机PD控制与电机PI参数的整定技巧。通过硬件选型、基础测试、四步调参法和分段控制策略,帮助开发者解决小车蛇形走位等问题,提升循迹性能。文章还分享了高级调试技巧和典型问题排查方法,适用于智能车竞赛和机器人开发。

weixin_42524226的博客 364

cocos2dx中Opacity属性及相关操作(1)

Opacity指的是Node的透明度,从0~255之间的一个整数,通过Node的setOpacity来进行设置:

mdifferent的专栏 1万+

Windows配置L2TP/IPsec连接

Windows 系统的 L2TP/IPsec 功能,通过配置即可构建加密 VPN 通道。

m0_61806534的博客 1675

Cocos 子节点的渐变失效的处理

今天在游戏中加了个战斗数值显示,其中就有用到渐变的效果,发现竟然没有生效,查看了源代码发现子节点的opacity值跟随父节点的opacity更新是有前提的,那就是这货:_cascadeOpacityEnabled。请看源代码: void Node::setOpacity(GLubyte opacity) { _displayedOpacity = _realOpacity = opaci

keep_moving_cqu的专栏 1873

安路TangDynasty和FD和JTAG驱动器安装

安路FPGA产品矩阵包含SALPHOENIX高性能、SALEAGLE高性价比和SALELF低功耗三大系列,广泛应用于网络通信、消费电子等领域。配套的TangDynasty(TD)集成开发环境支持标准设计输入,提供完整优化流程与调试工具。简要介绍了TD 6.2.1版本的安装步骤。

wangjie36的博客 1062

ApacheCordova 13 +Vs 2026 项目搭建教程_开发环境搭建教程

本文介绍基于Cordova 13.0.0、Android 13.0.0及JDK 21.0.8的开发环境搭建流程。通过npm全局安装Cordova CLI创建项目,配置JDK与Android SDK环境变量(Java_Home、ANDROID_SDK_ROOT),并设置Gradle 8.14.7路径。使用VS Code配合CordovaTools插件进行开发调试,验证adb devices连接状态。特别说明VS2026中JDK/Sdk位于H:\dev\vsshared\Android目录,适用于.Net MA

天马3798 74

cocos2dx 3.x 中setOpacity 在子节点绘制中的延续问题

最近在项目开发中遇到一个问题,就是特效用cocos studio 做的特效在项目中使用时老是出现显示不正确的问题,后测试发现,只要在改变Opacity的父节点下添加Layer 就会显示异常,翻查源码发现,Layer直接继承与Node类,而Node类中的控制是否向子节点延伸opacity的值,也就是_cascadeOpacityEnabled默认是false,所以导致一遇到Layer就终止了opac

chenqi3316的博客 862

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

cocos2dx3.x中Opacity和visible

当我们需要场景中的某个精灵不可见时可能会面临两种选择,特别地,我们可能经常使用Fadein和Fadeout表示淡入淡出的特效,而当我调用Fadeout淡出精灵时,其实本质上是在对精灵的Opacity,即精灵的透明度进行操作。透明度操作并不会影响精灵的Visible即可见属性。 综合来讲,当精灵的Opacity属性设置为0时,在场景中是不可见的,但是其visible为true,也就是说该精灵仍然被渲染;而当我们将该精灵的visible设置为fasle时,尽管该精灵不可见,但其实其opacity为25...

qq_41620823的博客 689

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

setCascadeOpacityEnabled

setCascadeOpacityEnabled Enable or disable cascade opacity, if cascade enabled, child nodes' opacity will be the multiplication of parent opacity and its own opacity. 转载于:https://www.cnblogs.co...

weixin_30955341的博客 748

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

cocos2d-x-2.2.6子类随父类透明度变化而变化setCascadeOpacityEnabled(true)

setCascadeOpacityEnabled

qq_33335724的博客 5419

Cocos 2dx - lua 透明度设置setOpacity()不起作用的解决方案

子节点跟随父节点透明度变化 self.rootNode:setCascadeOpacityEnabled(true) -- 如果是关闭状态,子节点的 透明度就不受父节点的影响,开启父节点级联透明度开关,设置透明度 self.rootNode:setOpacity(0) ...

汐客SeaKr的博客 3394

cocos2dx对所有子节点设置透明度

看到cocos2dx2.2.5发布了,修复了输入框的bug,于是我们的项目也升级到了2.2.5, 升级过程还是比较顺利,没想到后来发现设置透明度无效了。 经过调试发现要调用一下setCascadeOpacityEnabled ( true ),结果还是没有效果, 又继续调试,原来noe没父节点不会更新自己的透明度,于是改为如下: void CCNode::setOpacity(

MOMO 1万+

透明度设置:opacity与rgba

opacity:不透明度,用于设置整体属性得不透明,意味着其后代属性也会不透明。 文字也一起半透明了 rgba:一般用于调整background-color,color,box-shadow等的透明度 文字并不半透明

乌衣巷 926

creator 遇到的问题--更新中.

layout 父节点透明子节点不透明 creator 2.0 已经移除了 cascadeOpacity 的相关方法 解决办法--> 给layout中的sprite设置一张透明的图片。 完美解决 creator 代码中的require的文件不能加 .js require("gameData.js") 要改为require("gameData"), 否则微信小程...

W_han__的博客 675

cocos2d-x对Layer设置setOpacity()不起作用的解决办法(十分坑爹)

本来狠正常的一个Layer,我想把它整个设置为半透明,结果就是不起作用,后来发现解决办法十分坑爹: layer:setCascadeOpacityEnabled(true) layer:setOpacity(255 * 0.4) 我就不明白了,官方为啥不把cascadeOpacityEnabled默认设为true呢?这不纯搞人呢么?文档里又不说,StackOverflow上都搜不到,妈蛋

wuzhongchao的专栏 1104

Cocos2d-x Sprite 执行 CCFade~ 这类透明度变化动作的一些问题

在引擎中提供了几个有关透明度变化的动作:CCFadeIn,CCFadeOut,CCFadeTo CCFadeIn:the opacity from 0 to 255 CCFadeOut:the opacity from 255 to 0 CCFadeTo: from the current value to a custom one     下面简单记录一下我所遇到的一些问题:

小邓笔记 9662

cocos2d设置子节点不随父节点的透明度和可见性改变

Vector childrenVec = m_MaskBg->getChildren(); for (int i = 0; i < childrenVec.size(); i++) { childrenVec.at(i)->setCascadeColorEnabled(false); childrenVec.at(i)->setCascadeOpac

Lin&Yi的专栏 5687

CCNodeRGBA

CCNodeRGBA继承于CCNode,所以它拥有CCNode的所有特性,并且它也继承于CCRGBAProtocol。从名字看来我们就知道它是一个带有颜色和透明度的节点。 所以它比起CCNode就多了2个特性,Opacity和RGB值。 如果要给子节点传递透明度属性,那么需要设置setCascadeOpacityEnabled(true),如果传递的过程中遇到了CCNode,那么传递会

u013321328的专栏 1162

cocos2d-x 使用CCLabelAtlas自定义字体

原创文章,欢迎转载!转载请注明: 转载自Cocos2D开发网--Cocos2Dev.com 原文链接地址: cocos2d-x 使用CCLabelAtlas自定义字体 有时候游戏中要用到一些特殊的字体效果,特别是数字。 CCLabelAtlas就可以从png图中读取文字。 CCLabelAtlas* diceCount=CCLabelAtlas::label

chaoyuan899的专栏 3311

控件设置alpha或者layer的opacity时,他的子类的透明度也会跟着变成透明

控件设置alpha或者layer的opacity时,他的子类的透明度也会跟着变成透明 解决方法如下:  view.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.25];

zookpk的专栏 1160
上一篇: webstorm idea phpstorm appcode 自定义注释代码段- 日期时间
下一篇: cocos2d html5 3.8.1 .修复Cocos2d Particle Builder plist 粒子文件 base64 图片 解压错误
whitehack
博客等级 码龄19年 67粉丝 123原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址