ProxyColor.js 781 B

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. * @author jbaicoianu / http://baicoianu.com/
  4. */
  5. THREE.ProxyColor = function ( array, offset ) {
  6. this.array = array;
  7. this.offset = offset;
  8. }
  9. THREE.ProxyColor.prototype = Object.create( THREE.Color.prototype );
  10. Object.defineProperties( THREE.ProxyColor.prototype, {
  11. 'r': {
  12. enumerable: true,
  13. get: function () { return this.array[ this.offset ]; },
  14. set: function ( v ) { this.array[ this.offset ] = v; }
  15. },
  16. 'g': {
  17. enumerable: true,
  18. get: function () { return this.array[ this.offset + 1 ]; },
  19. set: function ( v ) { this.array[ this.offset + 1 ] = v; }
  20. },
  21. 'b': {
  22. enumerable: true,
  23. get: function () { return this.array[ this.offset + 2 ]; },
  24. set: function ( v ) { this.array[ this.offset + 2 ] = v; }
  25. }
  26. } );