overte-HifiExperiments/scripts/tutorials/makeBlocks.js
2017-03-04 18:50:30 +02:00

15 lines
431 B
JavaScript

// Toy
const MAX_RGB_COMPONENT_VALUE = 256 / 2; // Limit the values to half the maximum.
const MIN_COLOR_VALUE = 127;
function newColor() {
color = {
red: randomPastelRGBComponent(),
green: randomPastelRGBComponent(),
blue: randomPastelRGBComponent()
};
return color;
}
// Helper functions.
function randomPastelRGBComponent() {
return Math.floor(Math.random() * MAX_RGB_COMPONENT_VALUE) + MIN_COLOR_VALUE;
}