我有这个被重复调用的函数,但顶点没有改变:
function renderChart() {
requestAnimationFrame(renderChart);
// Copy frequency data to frequencyData array.
analyser.getByteFrequencyData(frequencyData); //frequencyData is an array that changes over time.
var dat = 79600;
var step = dat/frequencyData.length
var f = 0;
for(v=0; v<dat; v+=step){
globe._baseGeometry.verticesNeedUpdate = true;
globe.points.geometry.verticesNeedUpdate = true;
globe._baseGeometry.vertices[v].z = globe._baseGeometry.vertices[v].z * frequencyData[f]
globe._baseGeometry.vertices[v].y = globe._baseGeometry.vertices[v].y * frequencyData[f]
globe._baseGeometry.vertices[v].x = globe._baseGeometry.vertices[v].x * frequencyData[f]
f++;
}
}
// Run the loop
renderChart();
如果我在$(document).ready(function(){...
中运行它,它将成功运行一次。有什么变化
答案 0 :(得分:0)