1
如果可以更新animate()
环路以外的值,则为not clear。ThreeJS环路更新
循环外的更新是否会影响渲染性能?
我能看到的唯一缺点是有些更新可能会部分完成,不得不等待下一个动画电话完全显示。
我缺少什么缺点?
function animate() {
requestAnimationFrame(animate)
updatePositions()
}
与
function animate() {
requestAnimationFrame(animate)
}
function onWebSocketUpdate() {
updatePositions()
}
看它的另一种方式:
onWebSocketUpdate(data) {
// Option 1
// ws directly applies the update
model.update(data)
// Option 2
// ws saves data to buffer
buffer.push(data)
// when animate() runs, it pops buffer data
model.update(buffer.pop())
}