mod hue and clamp saturation and lightness
This makes it similar to rotation. With rotation you can do things like someObj.rotation.x += speed * deltaTime; You don't have to keep the result in the 0 to 2*PI or -PI to PI range. Similarly by modding hue you can cycle through hues with someObj.hue += speed * deltaTime; someColor.setHSL(someObj.hue, 1, 0.5); That helps several use cases like tweening libaries tween.fromTo(someObj, 5, { hue: 0 }, { hue: 5 }); It's also useful for random color selection from a given hue, saturation, lightness var hsl = someColor.getHSL(); hsl.h += Math.random(); hsl.s += Math.random() * 0.2 - 0.1; // make it slightly more or less saturated someColor.setHSL(hsl.h, hsl.s, hsl.l); Also updated `THREE.ColorConverter.setHSV`
Showing
想要评论请 注册 或 登录