cocos creator 二次貝賽爾曲線用法


private _startpos:cc.Vec3;
    private _controlPos:cc.Vec2;
    private _endPos:cc.Vec2;
    private _plainAngle:number;
 
public get parabola():number {
        return 0;
    }
 
public set parabola(t:number){
        this.node_plain.x = (1 - t) * (1 - t) * this._startpos.x + 2 * t * (1 - t) * this._controlPos.x + t * t * this._endPos.x;
        this.node_plain.y = (1 - t) * (1 - t) * this._startpos.y + 2 * t * (1 - t) * this._controlPos.y + t * t* this._endPos.y;
        this.node_plain.angle = t * this._plainAngle;
    }
 
cc.tween(this).to(this.revertTime,{parabola: 1}).call(()=>{
                    // this.node_plain.scaleY = -1;
                    //this._goldTarget = goldTarget;
                    // cc.tween(this.node_plain).to(1, { scaleY: -1 }).start();
                }).start();

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM