this._camera = this.getComponent(CameraComponent);
tween(this._camera).to(1, {color: Color.BLUE}).start();
使用这段代码相机背景颜色变黑了,请问各位是写错了,还是不能改?
this._camera = this.getComponent(CameraComponent);
tween(this._camera).to(1, {color: Color.BLUE}).start();
使用这段代码相机背景颜色变黑了,请问各位是写错了,还是不能改?
tween(this._camera).to(1, {Color: Color.BLUE}).start();
大小写改一下再试试
大写没变化,CameraComponent的属性字段是color,大写应该是找不到属性
不行吧~~~
目前用tween我是没实现,只能用动画编译器做。不过能变黑说明可以改到颜色值,请@引擎组 抢答一下
用 tween 是可以的,但是目前有几个小阻碍,下个版本会修复
类型cc.Color 目前将rgba编码到了一个number上,所以直接缓动的效果是不对的,需要把目标属性拆分成单通道(例如下面代码),这块会考虑优化一下
最后给一个目前的解决方法:
const camera = this.getComponent(CameraComponent);
const c = new Color(camera.color);
cc.tween(c)
.to(3, { r:255, g:255, b:255 }, { "onUpdate": function (target) { camera.color = target; }})
.start();
还是吴彦祖帅!
2d的可以用吗