0
我有一個數組,其中包含繪製多個山丘的點。當我畫直線時效果很好,但那是不自然的,所以我想讓山的頂部/底部彎曲。AS2繪製山丘曲線 - 隨機工作
for(i = 0; i < rPoints.length - 1; i++){
gamebg.lineStyle(1,0x000000,100);
gamebg.moveTo(rPoints[i][0] + 45, rPoints[i][1]); //Doesn't directly move to a point so there is empty space for the curved parts.
if(rPoints[i+1][1] > rPoints[i][1]){ //Determines if it is the top part of a hill or a bottom part, compares y
gamebg.lineTo(rPoints[i+1][0], rPoints[i+1][1]);
gamebg.moveTo(rPoints[i+1][0], rPoints[i+1][1]);
//I didn't add a curveTo here because I only wanted to test it on one so I can make changes easier
} else {
gamebg.lineTo(rPoints[i+1][0], rPoints[i+1][1]);
gamebg.moveTo(rPoints[i+1][0], rPoints[i+1][1]);
gamebg.curveTo(rPoints[i+1][0]+22, rPoints[i+1][1]-25, rPoints[i+1][1]+45, rPoints[i+1][1]);
}
}
當我運行代碼時,它似乎工作了一些時間。
當它工作時,它只適用於第一個。
謝謝!