我画了一个三角形,我想在屏幕上旋转它
var k_rotate = Rx.Observable.fromEvent(document, 'keydown')
.filter(function (evt) { return evt.which === 37 || evt.which === 39; })
.map(function (event) {
在centroid()里面我想访问startWith值以找出三角形的中心
centroid();
return { here I should return the rotate coordinates };
})
.startWith({
a: { x: (canvas.width / 2) - SHIP_WIDTH, y: canvas.height / 2 },
b: { x: canvas.width / 2, y: (canvas.height / 2) + SHIP_WIDTH },
c: { x: (canvas.width / 2) + SHIP_WIDTH, y: canvas.height / 2 }
});