import { _decorator, Color, Component, director, Node, Quat, Sprite, tween, Vec2, Vec3 } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('mve2')
export class mve2 extends Component {
start() {
/*
tween()
.target(this.node)
.to(1.0,{position: new Vec3(0,100,0)})
.by(1.0,{position: new Vec3(100,0,0)})
.delay(1.0)
.by(1.0,{position: new Vec3(0,-100,0)})
.start()
*/
/* let ttw1 : number = 1.0 //缓动的时长
tween(this.node.position)
.to(ttw1, new Vec3(100,100,0),{ //to 接口表示节点的绝对值
onUpdate:(target:Vec3,ratio:number)=>{ //实现ttw1的onUpdate回调,接受当前缓动进度
this.node.position = target //将缓动系统计算出的结果赋予node的位置
}
}).start() //调用start方法,开启缓动
*/
/*
let ttw1:number = 1.0
let quat:Quat = new Quat()
Quat.fromEuler(quat,0,90,0)
tween(this.node)
.to(ttw1,{
position:new Vec3(0,100,0),
scale:new Vec3(1.2,3,1),
rotation:quat
}).start()
*/
/*
class BindTarget{
color:Color
}
let spr1:Sprite = this.node.getComponent(Sprite)
let bind1:BindTarget = new BindTarget()
bind1.color = Color.BLUE
tween(bind1).by(1.0,{color:Color.RED},{
onUpdate(tar:BindTarget){spr1.color = tar.color} // 设置精灵的为 BindTarget 内的颜色
}).start()
*/
/*
let twwe1:number = 1.0
tween(this.node.position).to(twwe1,new Vec3(0,100,0),{onUpdate:(tar1:Vec3,roi1:number)=>{
this.node.position = tar1
}}).to(twwe1,new Vec3(0,-100,0),{onUpdate:(tarf3:Vec3,rao1:number)=>{
this.node.position = tarf3
}}).start() // 此时 Tween 内的动作数量为 2
*/
/*
let dga1:number = 1.0
tween(this.node) // 这里以 node 为缓动的目标
.to(dga1,{position:new Vec3(0,100,0)})
.to(dga1,{position:new Vec3(0,-100,0)}) // 此时 Tween 内的动作数量为 2
.union() // 这里会将上述的两个缓动整合成一个,此时 Tween 内的动作数量为 1
.start() // 调用 start 方法,开启缓动
*/
/*
let pof3:number = 1.0
let fea1 = tween(this.node).to(pof3,{position:new Vec3(0,-100,0)})
let fea2 = tween(this.node).to(pof3,{position:new Vec3(-100,0,0)})
//tween(this.node).sequence(fea1,fea2).start() // 将 fea1 和 fea2 两个缓动加入到新的缓动队列内
tween(this.node).parallel(fea1,fea2).start() // 将 fea1 和 fea2 转化为并行的缓动并加入当前的缓动
*/
/*
let ove1 = tween(this.node)
.to(1.0,{position:new Vec3(0,100,0)})
tween(this.node).by(1.0,{position:new Vec3(100,0,0)})
.then(ove1) //插入一个 Tween 到缓动队列中
.start()
*/
let aef3:number = 1.0
let aev2 = tween(this.node).by(aef3,{position:new Vec3(0,-100,0)})
tween(this.node)
.to(aef3,{position:new Vec3(0,100,0)})
.by(aef3,{position:new Vec3(100,0,0)})
//.repeat(3) //注意这里会重复by这个缓动3次,若第二个参数为空,则只会重复 最后一个
.repeat(3,aev2) //这里会重复aev2
.start()
}
update(deltaTime: number) {
}
}