Linking uniforms to getters

I don’t want to write a code to update uniform values directly, so is it OK with the library to use getter, like so:

const uni_color = {
  color: [0.3, 0.0, 0.3],
  get value() { 
  	const t = window.performance.now();
  	return this.color.map(a => a * 0.5 * (1 + Math.cos(0.001 * t))); 
  }
}

const cube = new THREE.Mesh(
  new THREE.BoxBufferGeometry(80, 80, 50, 1, 1, 1),
  new THREE.ShaderMaterial( {
  uniforms: {
  	color: uni_color,
  },
  vertexShader: getShader('vs'),
  fragmentShader: getShader('fs')
}),
);

scene.add(cube);

animate();

Fiddle:
https://jsfiddle.net/tfoller/70xc4vzf/45/

Thank you!

Seems to look okay :+1: .

BTW: With latest three.js versions, you can simply use BoxGeometry. BoxBufferGeometry is now an alias and both use BufferGeometry.