cc.sequence()中怎么写可以实现一个拉伸效果,就是动态改变节点的宽度,让Sprite发挥九宫格效果。
(cc.scaleTo只能扩大倍数,图片跟着扩大,不能九宫格形式扩大,而且只需要扩展宽度,不需要高度)
挖坟,碰到同样的需求,2.4.5版本用的 sprite.schedule 自定义回调函数实现
文档
https://docs.cocos.com/creator/api/zh/classes/Sprite.html#schedule
let aniTime = 1;
let totalTime = 0;
let curHeight = node.height;
node.getComponent(cc.Sprite).schedule(function(dt) {
totalTime += dt;
let prog = totalTime/time;
if (prog >= 1) {
node.height = endH;
node.getComponent(cc.Sprite).unscheduleAllCallbacks();
} else {
node.height = curHeight + (endH - curHeight) * prog;
}
})
const yourNode = xxx;
cc.tween(yourNode ).to(5, {width: 900}).start();
学到了,刚升到2.x,还没去看新特性 