let a = [-150, -20],
b = [-450, -5],
c = 100
function twopoint(num1, num2, ymove) {
var arr = []
let d = [num1[0]-num2[0],num1[1]-num2[1]]
for (i = 0; i <= c; i++) {
let count1 = d[0]*i/c
let count2 = d[1]*i/c
arr.push([num1[0]-count1,num1[1]-count2])
}
return arr
}
console.log(twopoint(a, b, c))
先得到兩點座標,再去根據你需要求幾個點做增減回傳幾筆資料