函数opacity(CocosCreator2.4常用函数)

本文目录
CocosCreator2.4常用函数
d=cc.director
d.loadScene(String,function)
d.preloadScene(String,function)
d.pause()
d.isPaused()return Boolean
d.resume()
d.runScene(Scene)
d.getScene()return Scene
cc.game.addPersistRootNode(Node)
cc.game.removePersistRootNode(Node)
ex. cc.find
this.node.
cc.find("childNode/...",this);
node=cc.instantiate(Prefab)
cc.isValid(obj)//为空或者销毁返回false
var n=this.node;
n.position,n.x,n.y
n.anchorX,n.anchorY
n.angle
n.scale,n.scaleX,n.scaleY
n.width,n.height
n.color,n.opacity
n.name,n.uuid
n.children,n.parent
n.active,n.activeInHierarchy
n._persistNode//Boolean
n.zIndex//渲染顺序,越大越在上面
n.setPosition(x,y)
var pos=n.getPosition()
n.setScale(x,y)
var sca=n.getScale()
n.addChild(childNode,zIndex,nameString)
n.getChildByUuid(String)
n.getChildByName(String)
n.removeChild(childNode,false)
n.removeAllChildren(false)
n.isChildOf(Node)
n.getComponent(String|类)
n.getComponents(String|类)
n.getComponentInChildren(String|类)
n.getComponentsInChildren(String|类)
n.addComponent(String|类)
component.destroy()
n.destroyAllChildren()
n.clear()
n.destroy()
n.walk(prefunc,postfunc)//遍历
cc.tween(this.node)
.to(time,{prop:value,prop:value},{easing:"sineOutIn"})
.by(time,{prop:value,prop:value})
.then(cc.tween())
.bezierTo(...)
.call(function)
.repeat(number,cc.tween().by(...))
.repeatForever()
.parallel(cc.tween.to(),cc.tween.to())
.delay(duration)
.start()
cc.tween(this.node).to(...).stop()
this.schedule(function,interval,repeat,delay)
this.scheduleOnce(function,delay)
this.unschedule(function)
this.unscheduleAllCallbacks();
node.on(eventType|string,function,this)
node.off(eventType|string,function,this)
cc.systemEvent.on(eventType|string,function,this)
cc.systemEvent.off(eventType|string,function,this)
e.getLocation()
e.getLocationX()
e.getLocationY()
cc.view
audio=cc.audioEngine;
audioID=audio.playMusic(clip,true)
audio.stopMusic()
audio.pauseMusic()
audio.resumeMusic()
audio.getMusicVolume()
audio.setMusicVolume(0-1)
audio.isMusicPlaying()
audioID=audio.playEffect(clip,false)
audio.setEffectsVolume(0-1)
audio.getEffectsVolume()
audio.pauseEffect(audioID)
audio.pauseAllEffects()
audio.resumeAllEffects()
audio.stopEffect(audioID)
audio.stopAllEffects()
audio.isLoop(audioID)
audio.setLoop(audioID,true)
audio.getDuration(audioID)
audio.getCurrentTime(audioID)
audio.setCurrentTime(audioID,number)
audio.uncache(filepath)//卸载文件
audio.uncacheAll()
r是弧度
Math.abs(v)
Math.sin(r)
Math.cos(r)
Math.tan(r)
r=Math.asin(v)
r=Math.acos(v)
r=Math.atan(v)
r=Math.atan2(y,x)
Math.floor(v)//取下
Math.round(v)//四舍五入
Math.random()//0-1包含0,不包含1
Math.max(a,b,c,...)
Math.min(a,b,c,...)
坐标转换
var vec=n.convertToNodeSpaceAR(Vec2)
var vec=n.convertToWorldSpaceAR(Vec2)
Vec2:
v.mag()
v.subSelf(v)
v.mulSelf(n)
v.divSelf(n)
v.scaleSelf(v)//分量相乘
v.negSelf()//取反
v.addSelf(v)
n=v.dot(v)
n=v.cross(v)
v.normalizeSelf()
v.angle(v)
v=v.lerp(vTarget,ratio)//线性插值
boolean=v.equals(v)
v=Vec2.random()//生成单位随机向量
anim.play(string)
animClips=anim.getClips()
anim.stop(string)
anim.pause(string)
anim.setCurrentTime(number,string)
anim.addClip(clip,string)
anim.removeClip(clip,false//是否强制)
this.pool=new NodePool();
this.pool.put(Node);
var node=this.pool.get();
var num=this.pool.size();
this.pool.clear();
js如何交替执行两个函数
使用setInterval间隔指定时间后执行需要的函数
setInterval(to_show,60000);每隔一分钟调用一次函数to_show
setInterval(to_hide,300000);每隔一分钟调用一次函数to_hide
axure这么多函数有什么用
一、函数使用方法
Axure函数使用的基本语法是:用””双方括号(即英文双中括号)包含,变量值和函数用英文句号(即点”. ”)连接。
例如: 表示变量LVAR的宽度
当前元件的宽度
二、 函数分类
根据Axure函数的应用范围,可划分为以下10类:元件函数、页面函数、窗口函数、鼠标指针函数、数字函数、字符串函数、数学函数、日期函数、中继器函数和布尔运算符(逻辑运算)。
三、函数使用说明
3.1 元件函数
This:获取当前元件对象,当前元件指添加事件的元件。
Target:获取目标元件对象,目标元件指添加动作的元件。
x:获取元件对象的X轴坐标值。
y:获取元件对象Y轴坐标值。
width:获取元件对象的宽度值。
height:获取元件对象的高度值。
scrollX:获取元件对象水平移动的距离。
scrollY:获取元件对象垂直移动的距离。
text:获取元件对象的文字。
name:获取元件对象的名称。
top:获取元件对象顶部边界的坐标值。
left:获取元件对象左边界的坐标值。
right:获取元件对象右边界的坐标值。
bottom:获取元件对象底部边界的坐标值。
opacity:获取元件对象的不透明度。
rotation:获取元件对象的旋转角度。
3.2 页面函数
PageName:获取当前页面的名称。
3.3 窗口函数
Windows.width:获取浏览器的当前宽度。
Windows.height:获取浏览器的当前高度。
Windows.scrollX:获取浏览器的水平滚动距离。
Windows.scrollY:获取浏览器的垂直滚动距离。
3.4 鼠标指针函数
Cursor.x:获取鼠标当前位置的X轴坐标。
Cursor.Y:获取鼠标当前位置的Y轴坐标。
DragX:获取鼠标在水平方向的移动速度(0.01秒内移动的距离)。
DragY:获取鼠标在垂直方向的移动速度(0.01秒内移动的距离)。
TotalDragX:整个拖动过程中,鼠标指针在水平方向上移动的距离。
TotalDragY:整个拖动过程中,鼠标指针在垂直方向上移动的距离。
DragTime:鼠标拖动操作的总时长。从鼠标按下左键到释放左键的总时长,中间
js将十六进制颜色转透明度的函数
js将十六进制颜色转透明度的函数
CSS颜色的表示方式一般有两种10进制与16进制,分别是【rgb(255, 100, 0)】【#FF0000】。两个16进制组合数是0-255(16*16=256)。
颜色是RGB红绿蓝三原色组成的,16进制的颜色由6位字符组成(如:FF0000,相隔重复类型也可以简写成F00),如果16进制要包含透明度必须由八位字符组成(如:FFDDAA80)。
平时css样式的透明度都是按十进制计算的,如:opacity: 0.5;与background-color: rgba(255, 100, 0, 0.8);。
10进制的255阶为不透明(0%),0阶为100%透明。所以如果要获取50%透明度,255 * 0.5 = 127.5;将127.5四舍五入再转16进制,方法如下:
下面方法是0%-100%的透明度输出:

更多文章:
下载免费java(有什么无病毒、安全的网站可以免费下载java格式手机游戏,且是触屏全屏的)
2026年9月24日 18:00
php7连接mysql数据库操作(PHP7连接mysql数据库方法)
2025年12月29日 00:15
c语言终止程序(C语言~~~如何使程序中途结束、跳出~~~)
2025年6月5日 07:30
flex布局的兼容性(怎么用css使得input的输入框对齐,要写出代码,别百度其他的)
2026年7月27日 12:15
正则表达式支持库(怎样在aardio中使用正则表达式,用哪个函数)
2025年11月17日 05:30
腾讯云数据库管理工具(navicat导入mangodb几百万行传输中断)
2025年12月5日 03:30
java 线程安全(java中为什么说,String是线程安全的)
2026年5月1日 04:00
下载excel教程(windows家庭中文版的怎么下载excel教程)
2026年8月11日 20:15
delphi控制485(如何在delphi中使用海康威视的485口)
2026年9月4日 06:00
tengine windows(天龙八部报错是怎么回事啊 )
2026年2月14日 17:45
ctab化学名称?predictive与predictable的区别
2026年8月14日 15:30














