3.8.4数值有逗号缓动怎么写???

this.gold.string = “0”
const val : string = “100,000,000”
tween(this.gold).to(1, { string: val}).start();

这样会报错,正确的写法应该是什么?

image 每次处理current我这样做的

 private _gold = {v:0}
 tween(this._gold).to(1,{v:100000000},(start:number,end:number,current:number,ratio:number) =>{
      const v = start + (end-start)*ratio;
     //format 函数把数字转化为有逗号的字符串
     this.gold = format(v):  
    return v;
});
1赞

+10086

参考:
https://docs.cocos.com/creator/3.8/manual/zh/tween/tween-example.html#用例三-自定义处理多个字符串属性

tween的时候用数字,update里面转换成字符串