@property(cc.Slider)
slider: cc.Slider = null;
animation : cc.SkeletonAnimation = null;
onLoad () {
this.animation = this.node.getComponent(cc.SkeletonAnimation);
this.animation.getClips()[0].wrapMode = 0;
this.animation.setCurrentTime(1.4);
this.animation.sample(this.animation.getClips()[0].name);
// this.animation.play();
console.log(this.animation.getClips()[0].duration);
}
start () {
this.slider.node.on("slide",(val:cc.Slider)=>{
let progress = val.progress;
this.animation.setCurrentTime(progress * this.animation.getClips()[0].duration,this.animation.getClips()[0].name);
this.animation.sample(this.animation.getClips()[0].name);
});
}
在设置动画时间时,sample未生效