initial commit

This commit is contained in:
2026-03-22 03:21:45 +02:00
commit 897fea9f4e
15431 changed files with 2548840 additions and 0 deletions

3
node_modules/jibo-keyframes/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
src
gulpfile.js
.gitignore

7
node_modules/jibo-keyframes/.syncignore generated vendored Normal file
View File

@@ -0,0 +1,7 @@
.git
.gitignore
.idea
.bin
.DS_Store
node_module/jibo-gulp
node_module/gulp

3
node_modules/jibo-keyframes/LICENSE.txt generated vendored Normal file
View File

@@ -0,0 +1,3 @@
Copyright © 2015 Jibo, Inc. All rights reserved.
See www.jibo.com/legal/copyright for additional attributions.

1
node_modules/jibo-keyframes/lib/blend-operations.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";var r={lastOneWins:{texture:function(r,n){return n}},add:{"float":function(r,n,t){return r+(n-t)},vector2:function(r,n,t){return{x:r.x+(n.x-t.x),y:r.y+(n.y-t.y)}},rgb:function(r,n,t){return{r:r.h+(n.r-t.r),g:r.s+(n.g-t.g),b:r.v+(n.b-t.b)}}},multiply:{"float":function(r,n){return r*n},vector2:function(r,n){return{x:r.x*n.x,y:r.y*n.y}},rgb:function(r,n){return{r:r.r*n.r,g:r.g*n.g,b:r.b*n.b}}},singleton:{video:function(r,n){return n}},inverse:{lastOneWins:{texture:function(r){return r}},singleton:{video:function(r){return r}},add:{"float":function(r,n,t){return n+t-r},vector2:function(r,n,t){return{x:n.x+t.x-r.x,y:n.y+t.y-r.y}},rgb:function(r,n,t){return{r:n.r+t.r-r.r,g:n.g+t.g-r.g,b:n.b+t.b-r.b}}},multiply:{"float":function(r,n){return r/n},vector2:function(r,n){return{x:n.x/r.x,y:n.y/r.y}},rgb:function(r,n){return{r:n.h/r.r,g:n.s/r.g,b:n.v/r.b}}}}};module.exports=r;

1
node_modules/jibo-keyframes/lib/channels.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";var e={topSection_r:{type:"Body",name:"Head"},middleSection_r:{type:"Body",name:"Torso"},bottomSection_r:{type:"Body",name:"Pelvis"},eyeSubRootBn_r:{type:"Eye",name:"Rotate"},eyeSubRootBn_t:{type:"Eye",name:"Translate"},eyeSubRootBn_t_2:{type:"Eye",name:"Translate"},vertexJoint1_t:{type:"Eye"},vertexJoint1_t_2:{type:"Eye"},vertexJoint2_t:{type:"Eye"},vertexJoint2_t_2:{type:"Eye"},vertexJoint3_t:{type:"Eye"},vertexJoint3_t_2:{type:"Eye"},vertexJoint4_t:{type:"Eye"},"vertexJoint4_t_2`":{type:"Eye"},vertexJoint5_t:{type:"Eye"},vertexJoint5_t_2:{type:"Eye"},vertexJoint6_t:{type:"Eye"},vertexJoint6_t_2:{type:"Eye"},vertexJoint7_t:{type:"Eye"},vertexJoint7_t_2:{type:"Eye"},vertexJoint8_t:{type:"Eye"},vertexJoint8_t_2:{type:"Eye"},vertexJoint9_t:{type:"Eye"},vertexJoint9_t_2:{type:"Eye"},eyeTextureInfixBn_r:{type:"Eye Texture"},eye_redChannelBn_r:{type:"Eye Texture"},eye_greenChannelBn_r:{type:"Eye Texture"},eye_blueChannelBn_r:{type:"Eye Texture"},overlay_textureSubRootBn_r:{type:"Overlay",name:"Rotate"},overlay_textureSubRootBn_t:{type:"Overlay",name:"Translate"},overlay_textureSubRootBn_t_2:{type:"Overlay",name:"Translate"},overlay_vertexJoint1_t:{type:"Overlay"},overlay_vertexJoint1_t_2:{type:"Overlay"},overlay_vertexJoint2_t:{type:"Overlay"},overlay_vertexJoint2_t_2:{type:"Overlay"},overlay_vertexJoint3_t:{type:"Overlay"},overlay_vertexJoint3_t_2:{type:"Overlay"},overlay_vertexJoint4_t:{type:"Overlay"},overlay_vertexJoint4_t_2:{type:"Overlay"},overlay_vertexJoint5_t:{type:"Overlay"},overlay_vertexJoint5_t_2:{type:"Overlay"},overlay_vertexJoint6_t:{type:"Overlay"},overlay_vertexJoint6_t_2:{type:"Overlay"},overlay_vertexJoint7_t:{type:"Overlay"},overlay_vertexJoint7_t_2:{type:"Overlay"},overlay_vertexJoint8_t:{type:"Overlay"},overlay_vertexJoint8_t_2:{type:"Overlay"},overlay_vertexJoint9_t:{type:"Overlay"},overlay_vertexJoint9_t_2:{type:"Overlay"},overlayTextureInfixBn_r:{type:"Overlay Texture"},overlay_redChannelBn_r:{type:"Overlay Texture"},overlay_greenChannelBn_r:{type:"Overlay Texture"},overlay_blueChannelBn_r:{type:"Overlay Texture"},screenBGTextureInfixBn_r:{type:"Background Texture"},screenBG_redChannelBn_r:{type:"Background Texture"},screenBG_greenChannelBn_r:{type:"Background Texture"},screenBG_blueChannelBn_r:{type:"Background Texture"},lightring_redChannelBn_r:{type:"LED"},lightring_greenChannelBn_r:{type:"LED"},lightring_blueChannelBn_r:{type:"LED"}},t={dofNameToDisplayType:function(t){return e[t].type},dofNameToDisplayName:function(r){var n=e[r].name;return void 0!==n?n:t.dofNameToDisplayType(r)},displayNameToDof:function(t){for(var r in e)if(e[r].name===t)return r},radiansToDegrees:function(e){return e/Math.PI*180},degreesToRadians:function(e){return e/180*Math.PI},framesToSeconds:function(e,t){return e/t},secondsToFrames:function(e,t,r){return Math.round(e/t*r)},toTextureURL:function(e,t){return this.baseTextureURL+this.getPaddedValueString(t)+".png"},toBGTextureURL:function(e,t){return this.baseBGURL+this.getPaddedValueString(t)+".png"}};module.exports=t;

1
node_modules/jibo-keyframes/lib/colors.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";var r=function(r){return r&&r.__esModule?r["default"]:r},e=r(require("color-space/hsv")),u={hsvToRgb:function(r,u,o){var t=e.rgb([r,u,o]);return{r:t[0],g:t[1],b:t[2]}}};module.exports=u;

1
node_modules/jibo-keyframes/lib/easing.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";var e=require("lodash"),r=require("eases"),s=e.clone(r);s.snap=function(){return 0},module.exports=s;

1
node_modules/jibo-keyframes/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";module.exports={keysToAnim:require("./keys-to-anim"),keysToAnimObject:require("./keys-to-anim-object").keysToAnimObject,keysToAnimObjectAsync:require("./keys-to-anim-object").keysToAnimObjectAsync,keysObjToAnimObject:require("./keys-to-anim-object").keysObjToAnimObject,channels:require("./channels"),runtime:require("./runtime"),generateId:require("./uuid"),conversion:require("./layers/conversion")};

View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},r=e(require("./layers/body-layer")),a=e(require("./layers/eye-and-overlay-layers")),u=e(require("./layers/eye-texture-layer")),l=e(require("./layers/overlay-texture-layer")),o=e(require("./layers/background-texture-layer")),y=e(require("./layers/led-layer")),t=e(require("./layers/video-layer")),n=e(require("./layers/event-layer")),i=e(require("./layers/audio-layer")),s=e(require("./uuid")),v=e(require("semver")),c=e(require("./layers/conversion")),f=e(require("./colors")),d={layerTypes:{Body:r,Eye:a.Eye,"Eye Texture":u,Overlay:a.Overlay,"Overlay Texture":l,"Background Texture":o,LED:y,Event:n,"Audio Event":i,Video:t},defaults:{version:"0.5.0",framerate:30,duration:30,scale:1,layers:[{name:"Eye",type:"Eye"},{name:"Eye Texture",type:"Eye Texture"},{name:"Body",type:"Body"}]},onLoad:function(e){e.version=e.version||"0.3.0","0.2.0"===e.version&&e.layers.forEach(function(e){e.id=s()}),v.lt(e.version,"0.4.0")&&e.layers.forEach(function(e){("Eye"===e.type||"Overlay"===e.type)&&e.keyframes.forEach(function(e){for(var r in e.value)"Scale"!==r&&"Rotate"!==r&&(e.value[r].x=c.toPixelsX(e.value[r].x),e.value[r].y=c.toPixelsY(e.value[r].y))})}),v.lte(e.version,"0.4.0")&&e.layers.forEach(function(e){e.keyframes.forEach(function(e){for(var r in e.value)"Tween"===r&&"body"===e.value.Tween.value&&(e.value.Tween={display:"cubic in out",label:"Cubic Ease In Out",value:"cubicInOut"})})}),v.lt(e.version,"0.5.0")&&e.layers.forEach(function(e){("Background Texture"===e.type||"Eye Texture"===e.type||"Overlay Texture"===e.type||"LED"===e.type)&&e.keyframes.forEach(function(e){e.value.Color=f.hsvToRgb(e.value.Color.h,e.value.Color.s,e.value.Color.v)})}),e.version=d.defaults.version}};module.exports=d;

1
node_modules/jibo-keyframes/lib/keyframe-search.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";function e(e,r){for(var t=0,o=e.length-2,f=void 0;o>=t;)if(f=Math.floor((t+o)/2),r>=e[f+1].time)t=f+1;else{if(!(r<e[f].time))return{start:f,end:f+1};o=f-1}}function r(e,r){if(0!==e.length)for(var t=0,o=e.length-1,f=void 0;o>=t;){f=Math.floor((t+o)/2);var i=e[f].time;if(r===i)return f;r>i?t=f+1:o=f-1}}module.exports={keyframeSearch:e,keyframeSearchAbsolute:r};

View File

@@ -0,0 +1 @@
"use strict";function e(e,n){o.readFile(e,"utf8",function(a,t){if(a)console.log('\nError parsing "'+e+'". '+a+"\n"),process.exit(1);else{var o=JSON.parse(t);i.onLoad(o);var u=s.basename(e),c=r(o,u);n(c)}})}function n(e){var n=void 0;try{n=JSON.parse(o.readFileSync(e,"utf8")),i.onLoad(n)}catch(a){console.log('\nError parsing "'+e+'". '+a+"\n"),process.exit(1)}var t=s.basename(e);return r(n,t)}function r(e,n){t.header.creationTime=(new Date).getTime(),t.header.version=e.version,t.content.name=n,t.content.channels=[],t.content.events=[];for(var r={},a=0;a<e.duration;a++){var o=u.framesToSeconds(a,e.framerate),s=c.evaluateAllDOFLayers(e,i,o),l=c.evaluateAllEventLayers(e,i,o);for(var m in s)"undefined"==typeof r[m]?(r[m]={dofName:m,length:e.duration/e.framerate,times:[o],values:[s[m]]},t.content.channels.push(r[m])):(r[m].times.push(o),r[m].values.push(s[m]));for(var v=0;v<l.length;v++){var f={time:o,eventName:l[v].name,payload:l[v].payload};t.content.events.push(f)}}return t}var a=function(e){return e&&e.__esModule?e["default"]:e},t={header:{fileType:"Animation",version:"0.001",creationTime:1418336756906},content:{name:"AnythingElse_01.dae",channels:[],events:[]}},o=a(require("fs")),s=a(require("path")),i=a(require("./jibo-keyframe-info")),u=a(require("./channels.js")),c=a(require("./runtime.js"));module.exports={keysToAnimObject:n,keysToAnimObjectAsync:e,keysObjToAnimObject:r};

1
node_modules/jibo-keyframes/lib/keys-to-anim.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";function e(e,t){console.log(e);var r=n(e);try{o.writeFileSync(t,JSON.stringify(r,null," "),"utf8")}catch(i){console.log("\nERROROROROROR\n"),process.exit(1)}}var t=function(e){return e&&e.__esModule?e["default"]:e},o=t(require("fs")),n=require("./keys-to-anim-object").keysToAnimObject;module.exports=e;

1
node_modules/jibo-keyframes/lib/layer.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";var t=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)},e=function(){function t(t,e){for(var n in e){var r=e[n];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(t,e)}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),n=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r=function(){function t(){n(this,t)}return e(t,null,{getInfo:{value:function(){throw"Implement static Layer.getInfo() to supply property meta data"}},isEvent:{value:function(){throw"Implement static Layer.isEvent()"}}}),t}(),o=function(r){function o(){n(this,o),null!=r&&r.apply(this,arguments)}return t(o,r),e(o,null,{generateDofs:{value:function(){throw"Implement static Layer.generateDofs()"}},isEvent:{value:function(){return!1}}}),o}(r),u=function(r){function o(){n(this,o),null!=r&&r.apply(this,arguments)}return t(o,r),e(o,null,{generateEvent:{value:function(){throw"Implement static Layer.generateEvent()"}},isEvent:{value:function(){return!0}},isValid:{value:function(){throw"Implement static Layer.isValid(generedatedEvent)"}}}),o}(r);module.exports={DOFBaseLayer:o,EventBaseLayer:u};

View File

@@ -0,0 +1 @@
"use strict";var e=function(){function e(e,t){for(var r in t){var n=t[r];n.configurable=!0,n.value&&(n.writable=!0)}Object.defineProperties(e,t)}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),t=function a(e,t,r){var n=Object.getOwnPropertyDescriptor(e,t);if(void 0===n){var o=Object.getPrototypeOf(e);return null===o?void 0:a(o,t,r)}if("value"in n&&n.writable)return n.value;var i=n.get;if(void 0!==i)return i.call(r)},r=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=require("../layer").EventBaseLayer,i={layerType:"Audio Event",properties:{AudioEvent:{type:"audio",defaultValue:{file:""}}}},u=function(o){function u(){n(this,u),t(Object.getPrototypeOf(u.prototype),"constructor",this).call(this)}return r(u,o),e(u,null,{getInfo:{value:function(){return i}},generateEvent:{value:function(e){var t={name:"play-audio",payload:{file:e.AudioEvent.file}};return t}},isValid:{value:function(e){return"play-audio"===e.name&&e.payload.file.length>0}}}),u}(o);module.exports=u;

View File

@@ -0,0 +1 @@
"use strict";var e=function(){function e(e,r){for(var n in r){var t=r[n];t.configurable=!0,t.value&&(t.writable=!0)}Object.defineProperties(e,r)}return function(r,n,t){return n&&e(r.prototype,n),t&&e(r,t),r}}(),r=function l(e,r,n){var t=Object.getOwnPropertyDescriptor(e,r);if(void 0===t){var o=Object.getPrototypeOf(e);return null===o?void 0:l(o,r,n)}if("value"in t&&t.writable)return t.value;var u=t.get;if(void 0!==u)return u.call(n)},n=function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(e.__proto__=r)},t=function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")},o=require("../layer").DOFBaseLayer,u={layerType:"Background Texture",properties:{Texture:{type:"texture",defaultValue:"",blendOperation:"lastOneWins"},Color:{type:"rgb",defaultValue:{r:255,g:255,b:255},blendOperation:"add"}},dofs:{screenBGTextureInfixBn_r:!0,screenBG_redChannelBn_r:!0,screenBG_greenChannelBn_r:!0,screenBG_blueChannelBn_r0:!0}},a=function(o){function a(){t(this,a),r(Object.getPrototypeOf(a.prototype),"constructor",this).call(this)}return n(a,o),e(a,null,{getInfo:{value:function(){return u}},generateDofs:{value:function(e){return{screenBGTextureInfixBn_r:e.Texture,screenBG_redChannelBn_r:e.Color.r/255,screenBG_greenChannelBn_r:e.Color.g/255,screenBG_blueChannelBn_r:e.Color.b/255}}}}),a}(o);module.exports=a;

1
node_modules/jibo-keyframes/lib/layers/body-layer.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";var e=function(){function e(e,t){for(var n in t){var i=t[n];i.configurable=!0,i.value&&(i.writable=!0)}Object.defineProperties(e,t)}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),t=function s(e,t,n){var i=Object.getOwnPropertyDescriptor(e,t);if(void 0===i){var o=Object.getPrototypeOf(e);return null===o?void 0:s(o,t,n)}if("value"in i&&i.writable)return i.value;var r=i.get;if(void 0!==r)return r.call(n)},n=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},i=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=require("../layer").DOFBaseLayer,r=[{display:"linear",label:"Linear Tween",value:"linear"},{display:"sine in",label:"Sine Ease In",value:"sineIn"},{display:"sine out",label:"Sine Ease Out",value:"sineOut"},{display:"sine in out",label:"Sine Ease In Out",value:"sineInOut"},{display:"cubic in",label:"Cubic Ease In",value:"cubicIn"},{display:"cubic out",label:"Cubic Ease Out",value:"cubicOut"},{display:"cubic in out",label:"Cubic Ease In Out",value:"cubicInOut"}],a={type:{name:"enum",values:r},defaultValue:r[3],blendOperation:"none"},u={type:"float",defaultValue:0,blendOperation:"add"},l={layerType:"Body",properties:{Head:u,Torso:u,Pelvis:u,Tween:a},dofs:{topSection_r:!0,middleSection_r:!0,bottomSection_r:!0}},c=function(o){function r(){i(this,r),t(Object.getPrototypeOf(r.prototype),"constructor",this).call(this)}return n(r,o),e(r,null,{getInfo:{value:function(){return l}},generateDofs:{value:function(e){return{topSection_r:e.Head/180*Math.PI,middleSection_r:e.Torso/180*Math.PI,bottomSection_r:e.Pelvis/180*Math.PI}}}}),r}(o);module.exports=c;

1
node_modules/jibo-keyframes/lib/layers/conversion.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";module.exports={toMetersX:function(t){return t/1280*.13002148},toMetersY:function(t){return t/720*.06922346*-1},toPixelsX:function(t){return t/.13002148*1280},toPixelsY:function(t){return t/.06922346*720*-1}};

View File

@@ -0,0 +1 @@
"use strict";var e=function(){function e(e,t){for(var n in t){var r=t[n];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(e,t)}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),t=function i(e,t,n){var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var o=Object.getPrototypeOf(e);return null===o?void 0:i(o,t,n)}if("value"in r&&r.writable)return r.value;var a=r.get;if(void 0!==a)return a.call(n)},n=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o=require("../layer").EventBaseLayer,a={layerType:"Event",properties:{Event:{type:"event",defaultValue:{name:"",payload:""}}}},u=function(o){function u(){r(this,u),t(Object.getPrototypeOf(u.prototype),"constructor",this).call(this)}return n(u,o),e(u,null,{getInfo:{value:function(){return a}},generateEvent:{value:function(e){var t={name:0===e.Event.name.length?"":e.Event.name,payload:{}};if(e.Event.payload.length>0)try{t.payload=JSON.parse(e.Event.payload)}catch(n){t.payload=e.Event.payload}return t}},isValid:{value:function(e){return 0!==e.name.length}}}),u}(o);module.exports=u;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
"use strict";var e=function(){function e(e,r){for(var n in r){var t=r[n];t.configurable=!0,t.value&&(t.writable=!0)}Object.defineProperties(e,r)}return function(r,n,t){return n&&e(r.prototype,n),t&&e(r,t),r}}(),r=function l(e,r,n){var t=Object.getOwnPropertyDescriptor(e,r);if(void 0===t){var o=Object.getPrototypeOf(e);return null===o?void 0:l(o,r,n)}if("value"in t&&t.writable)return t.value;var u=t.get;if(void 0!==u)return u.call(n)},n=function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(e.__proto__=r)},t=function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")},o=require("../layer").DOFBaseLayer,u={layerType:"Eye Texture",properties:{Texture:{type:"texture",defaultValue:"animations/textures/white-eye.png",blendOperation:"lastOneWins"},Color:{type:"rgb",defaultValue:{r:255,g:255,b:255},blendOperation:"add"}},dofs:{eyeTextureInfixBn_r:!0,eye_redChannelBn_r:!0,eye_greenChannelBn_r:!0,eye_blueChannelBn_r:!0}},a=function(o){function a(){t(this,a),r(Object.getPrototypeOf(a.prototype),"constructor",this).call(this)}return n(a,o),e(a,null,{getInfo:{value:function(){return u}},generateDofs:{value:function(e){return{eyeTextureInfixBn_r:e.Texture,eye_redChannelBn_r:e.Color.r/255,eye_greenChannelBn_r:e.Color.g/255,eye_blueChannelBn_r:e.Color.b/255}}}}),a}(o);module.exports=a;

1
node_modules/jibo-keyframes/lib/layers/led-layer.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";var e=function(){function e(e,r){for(var n in r){var t=r[n];t.configurable=!0,t.value&&(t.writable=!0)}Object.defineProperties(e,r)}return function(r,n,t){return n&&e(r.prototype,n),t&&e(r,t),r}}(),r=function u(e,r,n){var t=Object.getOwnPropertyDescriptor(e,r);if(void 0===t){var o=Object.getPrototypeOf(e);return null===o?void 0:u(o,r,n)}if("value"in t&&t.writable)return t.value;var i=t.get;if(void 0!==i)return i.call(n)},n=function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(e.__proto__=r)},t=function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")},o=require("../layer").DOFBaseLayer,i={layerType:"LED",properties:{Color:{type:"rgb",defaultValue:{r:255,g:255,b:255},blendOperation:"add"}},dofs:{lightring_redChannelBn_r:!0,lightring_greenChannelBn_r:!0,lightring_blueChannelBn_r:!0}},l=function(o){function l(){t(this,l),r(Object.getPrototypeOf(l.prototype),"constructor",this).call(this)}return n(l,o),e(l,null,{getInfo:{value:function(){return i}},generateDofs:{value:function(e){return{lightring_redChannelBn_r:e.Color.r/255,lightring_greenChannelBn_r:e.Color.g/255,lightring_blueChannelBn_r:e.Color.b/255}}}}),l}(o);module.exports=l;

View File

@@ -0,0 +1 @@
"use strict";var e=function(){function e(e,r){for(var n in r){var t=r[n];t.configurable=!0,t.value&&(t.writable=!0)}Object.defineProperties(e,r)}return function(r,n,t){return n&&e(r.prototype,n),t&&e(r,t),r}}(),r=function u(e,r,n){var t=Object.getOwnPropertyDescriptor(e,r);if(void 0===t){var o=Object.getPrototypeOf(e);return null===o?void 0:u(o,r,n)}if("value"in t&&t.writable)return t.value;var a=t.get;if(void 0!==a)return a.call(n)},n=function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(e.__proto__=r)},t=function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")},o=require("../layer").DOFBaseLayer,a={layerType:"Overlay Texture",properties:{Texture:{type:"texture",defaultValue:"animations/textures/lens.png",blendOperation:"lastOneWins"},Color:{type:"rgb",defaultValue:{r:255,g:255,b:255},blendOperation:"add"}},dofs:{overlayTextureInfixBn_r:!0,overlay_redChannelBn_r:!0,overlay_greenChannelBn_r:!0,overlay_blueChannelBn_r:!0}},l=function(o){function l(){t(this,l),r(Object.getPrototypeOf(l.prototype),"constructor",this).call(this)}return n(l,o),e(l,null,{getInfo:{value:function(){return a}},generateDofs:{value:function(e){return{overlayTextureInfixBn_r:e.Texture,overlay_redChannelBn_r:e.Color.r/255,overlay_greenChannelBn_r:e.Color.g/255,overlay_blueChannelBn_r:e.Color.b/255}}}}),l}(o);module.exports=l;

View File

@@ -0,0 +1 @@
"use strict";var e=function(){function e(e,t){for(var r in t){var o=t[r];o.configurable=!0,o.value&&(o.writable=!0)}Object.defineProperties(e,t)}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),t=function a(e,t,r){var o=Object.getOwnPropertyDescriptor(e,t);if(void 0===o){var n=Object.getPrototypeOf(e);return null===n?void 0:a(n,t,r)}if("value"in o&&o.writable)return o.value;var i=o.get;if(void 0!==i)return i.call(r)},r=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)},o=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=require("../layer").DOFBaseLayer,i={layerType:"Video",properties:{Video:{type:"video",defaultValue:"",blendOperation:"singleton"}},dofs:{}},u=function(n){function u(){o(this,u),t(Object.getPrototypeOf(u.prototype),"constructor",this).call(this)}return r(u,n),e(u,null,{getInfo:{value:function(){return i}},generateDofs:{value:function(){return{}}}}),u}(n);module.exports=u;

1
node_modules/jibo-keyframes/lib/runtime.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},r=e(require("fs")),a=e(require("./tweening")),t=e(require("lodash")),n=e(require("./uuid")),l=e(require("./keyframe-search")),i=require("./blend-operations"),s={create:function(e){var r={version:e.defaults.version,framerate:e.defaults.framerate,duration:e.defaults.duration,scale:e.defaults.scale,layers:[]};return e.defaults.layers.forEach(function(e){r.layers.push({id:n(),name:e.name,type:e.type,visible:!0,locked:!1,keyframes:[]})}),r},load:function(e,a){var t=JSON.parse(r.readFileSync(e,"utf8"));return a.onLoad&&a.onLoad(t),t},save:function(e,a){r.writeFileSync(e,JSON.stringify(a,null," "),"utf8")},_isEventLayer:function(e,r){if(e){var a=r.layerTypes[e.type];return a.isEvent()}return!1},evaluateAllDOFLayers:function(e,r,a,t){var n=this,l=this.evaluateAllLayersFiltered(e,r,a,function(e){return!n._isEventLayer(e,r)},!1,t),i={};for(var s in l){var u=r.layerTypes[s],y=u.generateDofs(l[s]);for(var f in y)i[f]=y[f]}return i},evaluateAllLayersFiltered:function(e,r,a,t,n,l){for(var s={},u=e.layers.length-1;u>=0;u--)if(t(e.layers[u])&&e.layers[u].visible){var y=void 0===l?void 0:l[e.layers[u].id],f=this.evaluateLayer(e.layers[u],e,r,a,y);if("undefined"==typeof s[e.layers[u].type])s[e.layers[u].type]=f;else{var o=s[e.layers[u].type],v=r.layerTypes[e.layers[u].type].getInfo();for(var p in f){var d=v.properties[p];try{o[p]=i[d.blendOperation][d.type](o[p],f[p],d.defaultValue)}catch(c){u=0}}}}return s},computeRelativePropValues:function(e,r,a,t,n,l){var s=this.evaluateAllLayersFiltered(r,a,t,function(r){return r.type!==e.type||r.id===e.id?!1:!0},!0,l);if("undefined"==typeof s[e.type])return n;var u=a.layerTypes[e.type].getInfo(),y={};for(var f in n){var o=u.properties[f];y[f]=i.inverse[o.blendOperation][o.type](s[e.type][f],n[f],o.defaultValue)}return y},evaluateLayer:function(e,r,n,i,s){if(this._isEventLayer(e,n))return this._evaluateEventLayer(e,r,n,i);var u={};if(s){for(var y in s)u[y]=s[y];return u}var f=n.layerTypes[e.type].getInfo();if(0===e.keyframes.length)for(var y in f.properties)u[y]=t.cloneDeep(f.properties[y].defaultValue);else{void 0===r.scale&&(r.scale=n.defaults.scale);var o=i*r.framerate;if(1===e.keyframes.length||e.keyframes[0].time>=o)return t.cloneDeep(e.keyframes[0].value);if(e.keyframes[e.keyframes.length-1].time<=o)return t.cloneDeep(e.keyframes[e.keyframes.length-1].value);var v=l.keyframeSearch(e.keyframes,o),p=v.start,d=v.end;p=e.keyframes[p],d=e.keyframes[d];var c=p.time,m=d.time,h=(o-c)/(m-c),k="cubicInOut";p.value.Tween&&(k=p.value.Tween.value);for(var y in p.value)"string"==typeof f.properties[y].type?u[y]=a[f.properties[y].type](p.value[y],d.value[y],h,k):u[y]=a[f.properties[y].type.name](p.value[y],d.value[y],h,k)}return u},_evaluateEventLayer:function(e,r,a,n){var i=n*r.framerate,s=l.keyframeSearchAbsolute(e.keyframes,i);if(void 0!==s)return t.cloneDeep(e.keyframes[s].value);var u=a.layerTypes[e.type].getInfo(),y={};for(var f in u.properties)y[f]=t.cloneDeep(u.properties[f].defaultValue);return y},evaluateAllEventLayers:function(e,r,a){for(var t=[],n=e.layers.length,l=0;n>l;l++){var i=e.layers[l];if(this._isEventLayer(i,r)&&i.visible){var s=this.evaluateLayer(i,e,r,a);if(s){var u=r.layerTypes[i.type],y=u.generateEvent(s),f=typeof y;"object"===f&&u.isValid(y)&&t.push(y)}}}return t}};module.exports=s;

1
node_modules/jibo-keyframes/lib/shorten.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";function n(n,e){function t(n){var e=[];return e.push(n[0]),e.push(n[Math.floor((n.length-1)/2)]),e.push(n[n.length-1]),e}function s(n){for(var e=[],s=0;s<n.content.channels.length;s++)n.content.channels[s].times=t(n.content.channels[s].times),n.content.channels[s].values=t(n.content.channels[s].values),e.push(n.content.channels[s]);n.content.channels=e}var a=require("fs"),c=JSON.parse(a.readFileSync(n,"utf8"));s(c),a.writeFileSync(e,JSON.stringify(c,null," "),"utf8")}n("heart.anim","heart-shorter.anim"),n("smiley.anim","smiley-shorter.anim");

1
node_modules/jibo-keyframes/lib/tweening.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";function r(r){return"function"==typeof r?r:t[r]}var n=function(r){return r&&r.__esModule?r["default"]:r},t=n(require("./easing")),u={"float":function(n,t,u,e){var o=r(e)(u);return n*(1-o)+t*o},vector2:function(n,t,u,e){var o=r(e)(u);return{x:n.x*(1-o)+t.x*o,y:n.y*(1-o)+t.y*o}},rgb:function(n,t,u,e){var o=r(e)(u);return{r:n.r*(1-o)+t.r*o,g:n.g*(1-o)+t.g*o,b:n.b*(1-o)+t.b*o}},color:function(n,t,u){var e=r("linear")(u);return n*(1-e)+t*e},texture:function(r){return r},video:function(r){return r},"enum":function(r){return r}};module.exports=u;

1
node_modules/jibo-keyframes/lib/uuid.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";function e(){return r.v4().replace(/-/g,"")}var u=function(e){return e&&e.__esModule?e["default"]:e},r=u(require("uuid"));module.exports=e;

View File

@@ -0,0 +1,5 @@
language: node_js
node_js:
- "0.10"
- "0.12"
- "iojs"

19
node_modules/jibo-keyframes/node_modules/async/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2010-2014 Caolan McMahon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

1647
node_modules/jibo-keyframes/node_modules/async/README.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
{
"name": "async",
"description": "Higher-order functions and common patterns for asynchronous code",
"version": "0.9.2",
"main": "lib/async.js",
"keywords": [
"async",
"callback",
"utility",
"module"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/caolan/async.git"
},
"devDependencies": {
"nodeunit": ">0.0.0",
"uglify-js": "1.2.x",
"nodelint": ">0.0.0",
"lodash": ">=2.4.1"
},
"moduleType": [
"amd",
"globals",
"node"
],
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"authors": [
"Caolan McMahon"
]
}

View File

@@ -0,0 +1,16 @@
{
"name": "async",
"description": "Higher-order functions and common patterns for asynchronous code",
"version": "0.9.2",
"keywords": [
"async",
"callback",
"utility",
"module"
],
"license": "MIT",
"repository": "caolan/async",
"scripts": [
"lib/async.js"
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
{
"name": "async",
"description": "Higher-order functions and common patterns for asynchronous code",
"main": "lib/async.js",
"author": "Caolan McMahon",
"version": "0.9.2",
"keywords": [
"async",
"callback",
"utility",
"module"
],
"repository": {
"type": "git",
"url": "https://github.com/caolan/async.git"
},
"bugs": {
"url": "https://github.com/caolan/async/issues"
},
"license": "MIT",
"devDependencies": {
"nodeunit": ">0.0.0",
"uglify-js": "1.2.x",
"nodelint": ">0.0.0",
"lodash": ">=2.4.1"
},
"jam": {
"main": "lib/async.js",
"include": [
"lib/async.js",
"README.md",
"LICENSE"
],
"categories": [
"Utilities"
]
},
"scripts": {
"test": "nodeunit test/test-async.js"
},
"spm": {
"main": "lib/async.js"
},
"volo": {
"main": "lib/async.js",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}
}

View File

@@ -0,0 +1,53 @@
#!/usr/bin/env node
// This should probably be its own module but complaints about bower/etc.
// support keep coming up and I'd rather just enable the workflow here for now
// and figure out where this should live later. -- @beaugunderson
var fs = require('fs');
var _ = require('lodash');
var packageJson = require('../package.json');
var IGNORES = ['**/.*', 'node_modules', 'bower_components', 'test', 'tests'];
var INCLUDES = ['lib/async.js', 'README.md', 'LICENSE'];
var REPOSITORY_NAME = 'caolan/async';
packageJson.jam = {
main: packageJson.main,
include: INCLUDES,
categories: ['Utilities']
};
packageJson.spm = {
main: packageJson.main
};
packageJson.volo = {
main: packageJson.main,
ignore: IGNORES
};
var bowerSpecific = {
moduleType: ['amd', 'globals', 'node'],
ignore: IGNORES,
authors: [packageJson.author]
};
var bowerInclude = ['name', 'description', 'version', 'main', 'keywords',
'license', 'homepage', 'repository', 'devDependencies'];
var componentSpecific = {
repository: REPOSITORY_NAME,
scripts: [packageJson.main]
};
var componentInclude = ['name', 'description', 'version', 'keywords',
'license'];
var bowerJson = _.merge({}, _.pick(packageJson, bowerInclude), bowerSpecific);
var componentJson = _.merge({}, _.pick(packageJson, componentInclude), componentSpecific);
fs.writeFileSync('./bower.json', JSON.stringify(bowerJson, null, 2));
fs.writeFileSync('./component.json', JSON.stringify(componentJson, null, 2));
fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2));

View File

@@ -0,0 +1,105 @@
# Color-space [![Build Status](https://travis-ci.org/dfcreative/color-space.svg?branch=master)](https://travis-ci.org/dfcreative/color-space) [![Code Climate](https://codeclimate.com/github/dfcreative/color-space/badges/gpa.svg)](https://codeclimate.com/github/dfcreative/color-space) <a href="UNLICENSE"><img src="http://upload.wikimedia.org/wikipedia/commons/6/62/PD-icon.svg" width="20"/></a>
<img src="https://raw.githubusercontent.com/dfcreative/color-space/gh-pages/logo.png" width="100%" height="150"/>
_Color-space_ provides conversions and data for the following color spaces: RGB, HSl, HSV (HSB), [HWB](http://dev.w3.org/csswg/css-color/#the-hwb-notation), CMYK, CMY, [XYZ](http://en.wikipedia.org/wiki/CIE_1931_color_space), XYY (YXY), [LAB](http://en.wikipedia.org/wiki/Lab_color_space), LCH<sub>ab</sub>, [LUV](http://en.wikipedia.org/wiki/CIELUV), [LCH<sub>uv</sub>](http://en.wikipedia.org/wiki/CIELUV#Cylindrical_representation), [H<sub>u</sub>SL](http://www.boronine.com/husl/), [H<sub>u</sub>SL<sub>p</sub>](http://www.boronine.com/husl/), [LAB<sub>Hunter</sub>](http://en.wikipedia.org/wiki/Lab_color_space#Hunter_Lab), [LMS](http://en.wikipedia.org/wiki/LMS_color_space).
1. _Color-space_ has the most complete list of color convertions so far, comparing to [color-convert](https://github.com/harthur/color-convert), [chromatist](https://github.com/jrus/chromatist), [spectra](https://github.com/avp/spectra), [colorspaces.js](https://github.com/boronine/colorspaces.js) and others.
2. It can be used both in browser and node.
3. Each space can be required selectively as `require('color-space/<space>')`.
4. It has immediate conversions between _hsv_, _hsl_ and _hwb_, as well as _lchuv_ and _lchab_, which preserves hue.
5. It provides meta information about spaces: channel names, minimums, maximums, aliases.
#### [Color converter & tests](https://cdn.rawgit.com/dfcreative/color-space/master/test/index.html)
# Use
### In browser:
Include [color-space.js](https://raw.githubusercontent.com/dfcreative/color-space/master/dist/color-space.js) or [color-space.min.js](https://raw.githubusercontent.com/dfcreative/color-space/master/dist/color-space.min.js) on the page (before youll use it):
```html
<script src="path-to/color-space.js"></script>
```
Alternately you can include a [CDN version](https://cdn.rawgit.com/dfcreative/color-space/master/dist/color-space.min.js):
```html
<script src="https://cdn.rawgit.com/dfcreative/color-space/master/dist/color-space.min.js"></script>
```
Now you have a `window.colorSpace` object, so you can play around with it:
```html
<script>
var rgb = colorSpace.rgb;
//convert rgb to hsl
var hslColor = rgb.hsl([255,0,0]);
</script>
```
If you aware of final size, you can get your own build via [browserify](https://github.com/substack/node-browserify), including only needed target spaces. See how to include spaces separately below.
### In node:
First install color-space as a local module:
`$ npm install --save color-space`
Then include `color-space`:
```js
var colorSpace = require('color-space');
//convert lab to lch
var result = colorSpace.lab.lch([80,50,60]);
```
Each space can also be required separately as `require('color-space/<space>')`:
```js
var rgb = require('color-space/rgb');
var hsl = require('color-space/hsl');
//convert rgb to hsl
rgb.hsl([200,230,100]);
```
Note that in case of requiring specific spaces you might need to add absent conversions via `color-space/util/add-convertor`.
# API
API of color-space is straightforward.
You can convert one space to another:
```js
<fromSpace>.<toSpace>(array);
```
Also you can get space data:
```js
<space>.name //space name
<space>.min //channel minimums
<space>.max //channel maximums
<space>.channel //channel names
<space>.alias //alias space names, if any
xyz.whitepoint //list of whitepoint references
lms.transform //list of transform matrices
```
# Contribute
Please fork, add color space with basic conversions to/from XYZ or RGB and tests. _Color-space_ is supposed to be a basic library to work with color conversions, an enhanced replacement for [color-convert](https://github.com/harthur/color-convert).
[![NPM](https://nodei.co/npm/color-space.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/color-space/)

View File

@@ -0,0 +1,26 @@
/**
* CIECAM02 http://en.wikipedia.org/wiki/CIECAM02
*
* @todo add transforms
*
* @module cam
*/
var xyz = require('./xyz');
var cam = module.exports = {
name:'cam',
alias: ['ciecam', 'ciecam02'],
xyz: function(cam){
//TODO
}
};
//extend xyz
xyz.cam = function(xyz){
var x = xyz[0], y = xyz[1], z = xyz[2];
//TODO
};

View File

@@ -0,0 +1,37 @@
/**
* @module color-space/cmy
*/
var rgb = require('./rgb');
module.exports = {
name: 'cmy',
min: [0,0,0],
max: [100,100,100],
channel: ['cyan', 'magenta', 'yellow'],
rgb: function(cmy) {
var c = cmyk[0] / 100,
m = cmyk[1] / 100,
y = cmyk[2] / 100;
return [
(1 - c) * 255,
(1 - m) * 255,
(1 - y) * 255
];
}
};
//extend rgb
rgb.cmy = function(rgb) {
var r = rgb[0] / 255,
g = rgb[1] / 255,
b = rgb[2] / 255;
return [
(1-r) * 100 || 0,
(1-g) * 100 || 0,
(1-b) * 100 || 0
];
};

View File

@@ -0,0 +1,40 @@
/**
* @module color-space/cmyk
*/
var rgb = require('./rgb');
module.exports = {
name: 'cmyk',
min: [0,0,0,0],
max: [100,100,100,100],
channel: ['cyan', 'magenta', 'yellow', 'black'],
rgb: function(cmyk) {
var c = cmyk[0] / 100,
m = cmyk[1] / 100,
y = cmyk[2] / 100,
k = cmyk[3] / 100,
r, g, b;
r = 1 - Math.min(1, c * (1 - k) + k);
g = 1 - Math.min(1, m * (1 - k) + k);
b = 1 - Math.min(1, y * (1 - k) + k);
return [r * 255, g * 255, b * 255];
}
};
//extend rgb
rgb.cmyk = function(rgb) {
var r = rgb[0] / 255,
g = rgb[1] / 255,
b = rgb[2] / 255,
c, m, y, k;
k = Math.min(1 - r, 1 - g, 1 - b);
c = (1 - r - k) / (1 - k) || 0;
m = (1 - g - k) / (1 - k) || 0;
y = (1 - b - k) / (1 - k) || 0;
return [c * 100, m * 100, y * 100, k * 100];
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
!function(u){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=u();else if("function"==typeof define&&define.amd)define([],u);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self);f.colorSpace=u()}}(function(){return function f(g,k,a){function d(e,b){if(!k[e]){if(!g[e]){var h="function"==typeof require&&require;if(!b&&h)return h(e,!0);if(c)return c(e,!0);h=Error("Cannot find module '"+e+"'");throw h.code="MODULE_NOT_FOUND",
h;}h=k[e]={exports:{}};g[e][0].call(h.exports,function(a){var b=g[e][1][a];return d(b?b:a)},h,h.exports,f,g,k,a)}return k[e].exports}for(var c="function"==typeof require&&require,e=0;e<a.length;e++)d(a[e]);return d}({1:[function(f,g,k){function a(a,l){var b=l.name;return a.xyz&&d[b]?function(c){return d[b](a.xyz(c))}:a.rgb&&c[b]?function(d){return c[b](a.rgb(d))}:a[b]}var d=f("./xyz"),c=f("./rgb");g.exports=function(e,c){e[c.name]||(e[c.name]=a(e,c));return e}},{"./rgb":14,"./xyz":15}],2:[function(f,
g,k){f=f("./rgb");g.exports={name:"cmyk",min:[0,0,0,0],max:[100,100,100,100],channel:["cyan","magenta","yellow","black"],rgb:function(a){var d=a[1]/100,c=a[2]/100,e=a[3]/100;a=1-Math.min(1,a[0]/100*(1-e)+e);d=1-Math.min(1,d*(1-e)+e);c=1-Math.min(1,c*(1-e)+e);return[255*a,255*d,255*c]}};f.cmyk=function(a){var d=a[0]/255,c=a[1]/255;a=a[2]/255;var e;e=Math.min(1-d,1-c,1-a);return[100*((1-d-e)/(1-e)||0),100*((1-c-e)/(1-e)||0),100*((1-a-e)/(1-e)||0),100*e]}},{"./rgb":14}],3:[function(f,g,k){f=f("./rgb");
g.exports={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],rgb:function(a){var d=a[0]/360,c=a[1]/100;a=a[2]/100;var e,l;if(0==c)return e=255*a,[e,e,e];c=.5>a?a*(1+c):a+c-a*c;a=2*a-c;l=[0,0,0];for(var b=0;3>b;b++)e=d+1/3*-(b-1),0>e&&e++,1<e&&e--,e=1>6*e?a+6*(c-a)*e:1>2*e?c:2>3*e?a+(c-a)*(2/3-e)*6:a,l[b]=255*e;return l}};f.hsl=function(a){var d=a[0]/255,c=a[1]/255,e=a[2]/255;a=Math.min(d,c,e);var l=Math.max(d,c,e),b=l-a,h;l==a?h=0:d==l?h=(c-e)/b:c==l?h=2+(e-d)/b:e==
l&&(h=4+(d-c)/b);h=Math.min(60*h,360);0>h&&(h+=360);d=(a+l)/2;return[h,100*(l==a?0:.5>=d?b/(l+a):b/(2-l-a)),100*d]}},{"./rgb":14}],4:[function(f,g,k){k=f("./rgb");f=f("./hsl");g.exports={name:"hsv",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","value"],alias:["hsb"],rgb:function(a){var d=a[0]/60,c=a[1]/100;a=a[2]/100;var e=Math.floor(d)%6,l=d-Math.floor(d),d=255*a*(1-c),b=255*a*(1-c*l),c=255*a*(1-c*(1-l));a*=255;switch(e){case 0:return[a,c,d];case 1:return[b,a,d];case 2:return[d,a,c];
case 3:return[d,b,a];case 4:return[c,d,a];case 5:return[a,d,b]}},hsl:function(a){var d=a[0],c=a[1]/100,e=a[2]/100;a=(2-c)*e;c=(c=c*e/(1>=a?a:2-a))||0;return[d,100*c,a/2*100]}};k.hsv=function(a){var d=a[0],c=a[1];a=a[2];var e=Math.min(d,c,a),l=Math.max(d,c,a),b=l-e,h,f;f=0===l?0:b/l*1E3/10;l==e?h=0:d==l?h=(c-a)/b:c==l?h=2+(a-d)/b:a==l&&(h=4+(d-c)/b);h=Math.min(60*h,360);0>h&&(h+=360);return[h,f,l/255*1E3/10]};f.hsv=function(a){var d=a[0],c=a[1]/100;a=a[2]/100;a*=2;c*=1>=a?a:2-a;return[d,100*(2*c/(a+
c)||0),(a+c)/2*100]}},{"./hsl":3,"./rgb":14}],5:[function(f,g,k){var a=f("./xyz"),d=f("./lchuv"),c=f("husl");g.exports={name:"husl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],lchuv:c._conv.husl.lch,xyz:function(a){return d.xyz(c._conv.husl.lch(a))},huslp:function(a){return c._conv.lch.huslp(c._conv.husl.lch(a))}};d.husl=c._conv.lch.husl;a.husl=function(e){return c._conv.lch.husl(a.lchuv(e))}},{"./lchuv":11,"./xyz":15,husl:13}],6:[function(f,g,k){var a=f("./xyz"),d=f("./lchuv"),
c=f("husl");g.exports={name:"huslp",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],lchuv:c._conv.huslp.lch,xyz:function(a){return d.xyz(c._conv.huslp.lch(a))},husl:function(a){return c._conv.lch.husl(c._conv.huslp.lch(a))}};d.huslp=c._conv.lch.huslp;a.huslp=function(e){return c._conv.lch.huslp(a.lchuv(e))}},{"./lchuv":11,"./xyz":15,husl:13}],7:[function(f,g,k){var a=f("./rgb"),d=f("./hsv"),c=f("./hsl"),e=g.exports={name:"hwb",min:[0,0,0],max:[360,100,100],channel:["hue","whiteness",
"blackness"],rgb:function(a){var b=a[0]/360,e=a[1]/100;a=a[2]/100;var c=e+a,d;1<c&&(e/=c,a/=c);c=Math.floor(6*b);a=1-a;b=6*b-c;0!=(c&1)&&(b=1-b);b=e+b*(a-e);switch(c){default:case 6:case 0:c=a;d=b;break;case 1:c=b;d=a;break;case 2:c=e;d=a;e=b;break;case 3:c=e;d=b;e=a;break;case 4:c=b;d=e;e=a;break;case 5:c=a,d=e,e=b}return[255*c,255*d,255*e]},hsv:function(a){var b=a[0],e=a[1],c=a[2];100<=e+c?(a=0,e=100*e/(e+c)):(a=100-e/(1-c/100),e=100-c);return[b,a,e]},hsl:function(a){return d.hsl(e.hsv(a))}};a.hwb=
function(e){var b=e[0],c=e[1],d=e[2];e=a.hsl(e)[0];var f=1/255*Math.min(b,Math.min(c,d)),d=1-1/255*Math.max(b,Math.max(c,d));return[e,100*f,100*d]};d.hwb=function(a){var e=a[1],c=a[2];return[a[0],0===c?0:c*(1-e/100),100-c]};c.hwb=function(a){return d.hwb(c.hsv(a))}},{"./hsl":3,"./hsv":4,"./rgb":14}],8:[function(f,g,k){var a=f("./add-convertor");f={rgb:f("./rgb"),hsl:f("./hsl"),hsv:f("./hsv"),hwb:f("./hwb"),cmyk:f("./cmyk"),xyz:f("./xyz"),lab:f("./lab"),lchab:f("./lchab"),luv:f("./luv"),lchuv:f("./lchuv"),
husl:f("./husl"),huslp:f("./huslp")};Object.defineProperty(f,"add",{value:function(e){var b=e.name;if(!this[b]){var c,d;for(d in this)c=this[d],a(e,c),a(c,e);return this[b]=e}}});var d,c;for(c in f){k=f[c];for(var e in f)e!==c&&(d=f[e],a(k,d))}g.exports=f},{"./add-convertor":1,"./cmyk":2,"./hsl":3,"./hsv":4,"./husl":5,"./huslp":6,"./hwb":7,"./lab":9,"./lchab":10,"./lchuv":11,"./luv":12,"./rgb":14,"./xyz":15}],9:[function(f,g,k){f=f("./xyz");g.exports={name:"lab",min:[0,-100,-100],max:[100,100,100],
channel:["lightness","a","b"],alias:["cielab"],xyz:function(a){var d=a[0],c=a[1];a=a[2];var e,f,b;8>=d?(d=100*d/903.3,b=d/100*7.787+16/116):(d=100*Math.pow((d+16)/116,3),b=Math.pow(d/100,1/3));e=.008856>=e/95.047?e=95.047*(c/500+b-16/116)/7.787:95.047*Math.pow(c/500+b,3);f=.008859>=f/108.883?f=108.883*(b-a/200-16/116)/7.787:108.883*Math.pow(b-a/200,3);return[e,d,f]}};f.lab=function(a){var d=a[0],c=a[1];a=a[2];d/=95.047;c/=100;a/=108.883;d=.008856<d?Math.pow(d,1/3):7.787*d+16/116;c=.008856<c?Math.pow(c,
1/3):7.787*c+16/116;a=.008856<a?Math.pow(a,1/3):7.787*a+16/116;return[116*c-16,500*(d-c),200*(c-a)]}},{"./xyz":15}],10:[function(f,g,k){var a=f("./xyz"),d=f("./lab"),c=g.exports={name:"lchab",min:[0,0,0],max:[100,100,360],channel:["lightness","chroma","hue"],alias:["cielch","lch"],xyz:function(a){return d.xyz(c.lab(a))},lab:function(a){var c=a[0],b=a[1],d;d=a[2]/360*2*Math.PI;a=b*Math.cos(d);b*=Math.sin(d);return[c,a,b]}};d.lchab=function(a){var c=a[0],b=a[1],d=a[2];a=360*Math.atan2(d,b)/2/Math.PI;
0>a&&(a+=360);b=Math.sqrt(b*b+d*d);return[c,b,a]};a.lchab=function(c){return d.lchab(a.lab(c))}},{"./lab":9,"./xyz":15}],11:[function(f,g,k){var a=f("./luv"),d=f("./xyz"),c=g.exports={name:"lchuv",channel:["lightness","chroma","hue"],alias:["cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(a){var c=a[0],b=a[1],d;d=a[2]/360*2*Math.PI;a=b*Math.cos(d);b*=Math.sin(d);return[c,a,b]},xyz:function(e){return a.xyz(c.luv(e))}};a.lchuv=function(a){var c=a[0],b=a[1],d=a[2];a=Math.sqrt(b*b+d*d);b=360*Math.atan2(d,
b)/2/Math.PI;0>b&&(b+=360);return[c,a,b]};d.lchuv=function(c){return a.lchuv(d.luv(c))}},{"./luv":12,"./xyz":15}],12:[function(f,g,k){var a=f("./xyz");g.exports={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["cieluv"],xyz:function(d,c,e){var f,b,h,g;h=d[0];f=d[1];b=d[2];if(0===h)return[0,0,0];c=c||"D65";e=e||2;g=a.whitepoint[e][c][0];d=a.whitepoint[e][c][1];c=a.whitepoint[e][c][2];f=f/(13*h)+4*g/(g+15*d+3*c)||0;b=b/(13*h)+9*d/(g+15*d+3*c)||0;h=8<h?d*Math.pow((h+
16)/116,3):d*h*.0011070564598794539;return[9*h*f/(4*b)||0,h,h*(12-3*f-20*b)/(4*b)||0]}};a.luv=function(d,c,e){var f,b,h,g;c=c||"D65";e=e||2;g=a.whitepoint[e][c][0];b=a.whitepoint[e][c][1];e=a.whitepoint[e][c][2];c=4*g/(g+15*b+3*e);g=9*b/(g+15*b+3*e);f=d[0];e=d[1];h=d[2];d=4*f/(f+15*e+3*h)||0;f=9*e/(f+15*e+3*h)||0;b=e/b;b=.008856451679035631>=b?903.2962962962961*b:116*Math.pow(b,1/3)-16;return[b,13*b*(d-c),13*b*(f-g)]}},{"./xyz":15}],13:[function(f,g,k){(function(){var a,d,c,e,f,b,h,k,q,r,x,y,s,n,
p,v,m,w,t;s={R:[3.240969941904521,-1.537383177570093,-.498610760293],G:[-.96924363628087,1.87596750150772,.041555057407175],B:[.055630079696993,-.20397695888897,1.056971514242878]};a=[.41239079926595,.35758433938387,.18048078840183];d=[.21263900587151,.71516867876775,.072192315360733];c=[.019330818715591,.11919477979462,.95053215224966];r=function(a){var c,b,d,e,f,g,h,l,k,m,q,r,n,p;f=Math.pow(a+16,3)/1560896;g=.0088564516<f?f:a/903.2962962;f=[];n=["R","G","B"];k=0;for(q=n.length;k<q;k++)for(b=n[k],
e=s[b],b=e[0],d=e[1],e=e[2],p=[0,1],m=0,r=p.length;m<r;m++)c=p[m],h=(284517*b-94839*e)*g,l=(838422*e+769860*d+731718*b)*a*g-769860*c*a,c=(632260*e-126452*d)*g+126452*c,f.push([h/c,l/c]);return f};x=function(a,c){return(a[1]-c[1])/(c[0]-a[0])};h=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2))};y=function(a,c){var b;b=c[0];b=c[1]/(Math.sin(a)-b*Math.cos(a));return 0>b?null:b};p=function(a){var c,b,d,e,f,g;b=[];g=r(a);e=0;for(f=g.length;e<f;e++)c=g[e],a=c[0],c=c[1],d=x([a,c],[-1/a,0]),
b.push(h([d,c+d*a]));return Math.min.apply(Math,b)};n=function(a,c){var b,d,e,f,g,h;b=c/360*Math.PI*2;e=[];h=r(a);f=0;for(g=h.length;f<g;f++)d=h[f],d=y(b,d),null!==d&&e.push(d);return Math.min.apply(Math,e)};k=function(a,c){var b,d,e,f;b=e=d=0;for(f=a.length-1;0<=f?e<=f:e>=f;b=0<=f?++e:--e)d+=a[b]*c[b];return d};w=function(a,c){var b;b=Math.pow(10,c);return Math.round(a*b)/b};q=function(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055};t=function(a){return.04045<a?Math.pow((a+.055)/1.055,
2.4):a/12.92};v=function(a){var c,b,d,e;e=[];b=0;for(d=a.length;b<d;b++)c=a[b],e.push(w(c,3));a=e;b=0;for(d=a.length;b<d;b++)if(c=a[b],-1E-4>c||1.0001<c)throw Error("Illegal rgb value: "+c);e=[];b=0;for(d=a.length;b<d;b++)c=a[b],e.push(Math.round(255*c));return e};b={xyz:{},luv:{},lch:{},husl:{},huslp:{},rgb:{},hex:{}};b.xyz.rgb=function(a){var c,b;b=q(k(s.R,a));c=q(k(s.G,a));a=q(k(s.B,a));return[b,c,a]};b.rgb.xyz=function(b){var e,f;f=b[0];e=b[1];b=b[2];b=[t(f),t(e),t(b)];e=k(a,b);f=k(d,b);b=k(c,
b);return[e,f,b]};f=function(a){return.0088564516>=a?a/1*903.2962962:116*Math.pow(a/1,1/3)-16};e=function(a){return 8>=a?1*a/903.2962962:1*Math.pow((a+16)/116,3)};b.xyz.luv=function(a){var b,c,d;c=a[0];b=a[1];d=a[2];a=4*c/(c+15*b+3*d);c=9*b/(c+15*b+3*d);b=f(b);return 0===b?[0,0,0]:[b,13*b*(a-.19783000664283),13*b*(c-.46831999493879)]};b.luv.xyz=function(a){var b,c;b=a[0];c=a[1];a=a[2];if(0===b)return[0,0,0];c=c/(13*b)+.19783000664283;a=a/(13*b)+.46831999493879;b=e(b);c=0-9*b*c/((c-4)*a-c*a);return[c,
b,(9*b-15*a*b-a*c)/(3*a)]};b.luv.lch=function(a){var b,c,d;c=a[0];b=a[1];d=a[2];a=Math.pow(Math.pow(b,2)+Math.pow(d,2),.5);b=360*Math.atan2(d,b)/2/Math.PI;0>b&&(b=360+b);return[c,a,b]};b.lch.luv=function(a){var b,c,d;d=a[0];b=a[1];c=a[2]/360*2*Math.PI;a=Math.cos(c)*b;b*=Math.sin(c);return[d,a,b]};b.husl.lch=function(a){var b,c,d;b=a[0];c=a[1];a=a[2];if(99.9999999<a)return[100,0,b];if(1E-8>a)return[0,0,b];d=n(a,b);return[a,d/100*c,b]};b.lch.husl=function(a){var b,c,d;c=a[0];b=a[1];a=a[2];if(99.9999999<
c)return[a,0,100];if(1E-8>c)return[a,0,0];d=n(c,a);return[a,b/d*100,c]};b.huslp.lch=function(a){var b,c,d;b=a[0];c=a[1];a=a[2];if(99.9999999<a)return[100,0,b];if(1E-8>a)return[0,0,b];d=p(a);return[a,d/100*c,b]};b.lch.huslp=function(a){var b,c,d;c=a[0];b=a[1];a=a[2];if(99.9999999<c)return[a,0,100];if(1E-8>c)return[a,0,0];d=p(c);return[a,b/d*100,c]};b.rgb.hex=function(a){var b,c,d,e;c="#";a=v(a);d=0;for(e=a.length;d<e;d++)b=a[d],b=b.toString(16),1===b.length&&(b="0"+b),c+=b;return c};b.hex.rgb=function(a){var b,
c,d,e;"#"===a.charAt(0)&&(a=a.substring(1,7));c=a.substring(0,2);b=a.substring(2,4);a=a.substring(4,6);d=[c,b,a];e=[];c=0;for(a=d.length;c<a;c++)b=d[c],e.push(parseInt(b,16)/255);return e};b.lch.rgb=function(a){return b.xyz.rgb(b.luv.xyz(b.lch.luv(a)))};b.rgb.lch=function(a){return b.luv.lch(b.xyz.luv(b.rgb.xyz(a)))};b.husl.rgb=function(a){return b.lch.rgb(b.husl.lch(a))};b.rgb.husl=function(a){return b.lch.husl(b.rgb.lch(a))};b.huslp.rgb=function(a){return b.lch.rgb(b.huslp.lch(a))};b.rgb.huslp=
function(a){return b.lch.huslp(b.rgb.lch(a))};m={fromRGB:function(a,c,d){return b.rgb.husl([a,c,d])},fromHex:function(a){return b.rgb.husl(b.hex.rgb(a))},toRGB:function(a,c,d){return b.husl.rgb([a,c,d])},toHex:function(a,c,d){return b.rgb.hex(b.husl.rgb([a,c,d]))},p:{}};m.p.toRGB=function(a,c,d){return b.xyz.rgb(b.luv.xyz(b.lch.luv(b.huslp.lch([a,c,d]))))};m.p.toHex=function(a,c,d){return b.rgb.hex(b.xyz.rgb(b.luv.xyz(b.lch.luv(b.huslp.lch([a,c,d])))))};m.p.fromRGB=function(a,c,d){return b.lch.huslp(b.luv.lch(b.xyz.luv(b.rgb.xyz([a,
c,d]))))};m.p.fromHex=function(a){return b.lch.huslp(b.luv.lch(b.xyz.luv(b.rgb.xyz(b.hex.rgb(a)))))};m._conv=b;m._round=w;m._rgbPrepare=v;m._getBounds=r;m._maxChromaForLH=n;m._maxSafeChromaForL=p;"undefined"!==typeof g&&null!==g||"undefined"!==typeof jQuery&&null!==jQuery||"undefined"!==typeof requirejs&&null!==requirejs||(this.HUSL=m);"undefined"!==typeof g&&null!==g&&(g.exports=m);"undefined"!==typeof jQuery&&null!==jQuery&&(jQuery.husl=m)}).call(this)},{}],14:[function(f,g,k){g.exports={name:"rgb",
min:[0,0,0],max:[255,255,255],channel:["red","green","blue"]}},{}],15:[function(f,g,k){f=f("./rgb");g.exports={name:"xyz",min:[0,0,0],max:[96,100,109],channel:["lightness","u","v"],alias:["ciexyz"],whitepoint:{2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,
116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}},rgb:function(a){var d=a[0]/100,c=a[1]/100,e=a[2]/100,f;a=3.240969941904521*d+-1.537383177570093*c+-.498610760293*e;f=-.96924363628087*d+1.87596750150772*c+.041555057407175*e;d=.055630079696993*d+-.20397695888897*c+1.056971514242878*e;a=.0031308<a?1.055*Math.pow(a,1/2.4)-.055:a*=12.92;f=.0031308<f?1.055*Math.pow(f,
1/2.4)-.055:f*=12.92;d=.0031308<d?1.055*Math.pow(d,1/2.4)-.055:d*=12.92;a=Math.min(Math.max(0,a),1);f=Math.min(Math.max(0,f),1);d=Math.min(Math.max(0,d),1);return[255*a,255*f,255*d]}};f.xyz=function(a){var d=a[0]/255,c=a[1]/255;a=a[2]/255;d=.04045<d?Math.pow((d+.055)/1.055,2.4):d/12.92;c=.04045<c?Math.pow((c+.055)/1.055,2.4):c/12.92;a=.04045<a?Math.pow((a+.055)/1.055,2.4):a/12.92;return[100*(.41239079926595*d+.35758433938387*c+.18048078840183*a),100*(.21263900587151*d+.71516867876775*c+.072192315360733*
a),100*(.019330818715591*d+.11919477979462*c+.95053215224966*a)]}},{"./rgb":14}]},{},[8])(8)});

View File

@@ -0,0 +1,105 @@
/**
* @module color-space/hsl
*/
var rgb = require('./rgb');
module.exports = {
name: 'hsl',
min: [0,0,0],
max: [360,100,100],
channel: ['hue', 'saturation', 'lightness'],
rgb: function(hsl) {
var h = hsl[0] / 360,
s = hsl[1] / 100,
l = hsl[2] / 100,
t1, t2, t3, rgb, val;
if (s === 0) {
val = l * 255;
return [val, val, val];
}
if (l < 0.5) {
t2 = l * (1 + s);
}
else {
t2 = l + s - l * s;
}
t1 = 2 * l - t2;
rgb = [0, 0, 0];
for (var i = 0; i < 3; i++) {
t3 = h + 1 / 3 * - (i - 1);
if (t3 < 0) {
t3++;
}
else if (t3 > 1) {
t3--;
}
if (6 * t3 < 1) {
val = t1 + (t2 - t1) * 6 * t3;
}
else if (2 * t3 < 1) {
val = t2;
}
else if (3 * t3 < 2) {
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
}
else {
val = t1;
}
rgb[i] = val * 255;
}
return rgb;
}
};
//extend rgb
rgb.hsl = function(rgb) {
var r = rgb[0]/255,
g = rgb[1]/255,
b = rgb[2]/255,
min = Math.min(r, g, b),
max = Math.max(r, g, b),
delta = max - min,
h, s, l;
if (max === min) {
h = 0;
}
else if (r === max) {
h = (g - b) / delta;
}
else if (g === max) {
h = 2 + (b - r) / delta;
}
else if (b === max) {
h = 4 + (r - g)/ delta;
}
h = Math.min(h * 60, 360);
if (h < 0) {
h += 360;
}
l = (min + max) / 2;
if (max === min) {
s = 0;
}
else if (l <= 0.5) {
s = delta / (max + min);
}
else {
s = delta / (2 - max - min);
}
return [h, s * 100, l * 100];
};

View File

@@ -0,0 +1,115 @@
/**
* @module color-space/hsv
*/
var rgb = require('./rgb');
var hsl = require('./hsl');
module.exports = {
name: 'hsv',
min: [0,0,0],
max: [360,100,100],
channel: ['hue', 'saturation', 'value'],
alias: ['hsb'],
rgb: function(hsv) {
var h = hsv[0] / 60,
s = hsv[1] / 100,
v = hsv[2] / 100,
hi = Math.floor(h) % 6;
var f = h - Math.floor(h),
p = 255 * v * (1 - s),
q = 255 * v * (1 - (s * f)),
t = 255 * v * (1 - (s * (1 - f)));
v *= 255;
switch(hi) {
case 0:
return [v, t, p];
case 1:
return [q, v, p];
case 2:
return [p, v, t];
case 3:
return [p, q, v];
case 4:
return [t, p, v];
case 5:
return [v, p, q];
}
},
hsl: function(hsv) {
var h = hsv[0],
s = hsv[1] / 100,
v = hsv[2] / 100,
sl, l;
l = (2 - s) * v;
sl = s * v;
sl /= (l <= 1) ? l : 2 - l;
sl = sl || 0;
l /= 2;
return [h, sl * 100, l * 100];
}
};
//append rgb
rgb.hsv = function(rgb) {
var r = rgb[0],
g = rgb[1],
b = rgb[2],
min = Math.min(r, g, b),
max = Math.max(r, g, b),
delta = max - min,
h, s, v;
if (max === 0) {
s = 0;
}
else {
s = (delta/max * 1000)/10;
}
if (max === min) {
h = 0;
}
else if (r === max) {
h = (g - b) / delta;
}
else if (g === max) {
h = 2 + (b - r) / delta;
}
else if (b === max) {
h = 4 + (r - g) / delta;
}
h = Math.min(h * 60, 360);
if (h < 0) {
h += 360;
}
v = ((max / 255) * 1000) / 10;
return [h, s, v];
};
//extend hsl
hsl.hsv = function(hsl) {
var h = hsl[0],
s = hsl[1] / 100,
l = hsl[2] / 100,
sv, v;
l *= 2;
s *= (l <= 1) ? l : 2 - l;
v = (l + s) / 2;
sv = (2 * s) / (l + s) || 0;
return [h, sv * 100, v * 100];
};

View File

@@ -0,0 +1,35 @@
/**
* A uniform wrapper for husl.
* // http://www.boronine.com/husl/
*
* @module color-space/husl
*/
var xyz = require('./xyz');
var lchuv = require('./lchuv');
var _husl = require('husl');
module.exports = {
name: 'husl',
min: [0,0,0],
max: [360,100,100],
channel: ['hue', 'saturation', 'lightness'],
lchuv: _husl._conv.husl.lch,
xyz: function(arg){
return lchuv.xyz(_husl._conv.husl.lch(arg));
},
//a shorter way to convert to huslp
huslp: function(arg){
return _husl._conv.lch.huslp( _husl._conv.husl.lch(arg));
}
};
//extend lchuv, xyz
lchuv.husl = _husl._conv.lch.husl;
xyz.husl = function(arg){
return _husl._conv.lch.husl(xyz.lchuv(arg));
};

View File

@@ -0,0 +1,29 @@
/**
* A uniform wrapper for huslp.
* // http://www.boronine.com/husl/
*
* @module color-space/huslp
*/
var xyz = require('./xyz');
var lchuv = require('./lchuv');
var _husl = require('husl');
module.exports = {
name: 'huslp',
min: [0,0,0],
max: [360,100,100],
channel: ['hue', 'saturation', 'lightness'],
lchuv: _husl._conv.huslp.lch,
xyz: function(arg){return lchuv.xyz(_husl._conv.huslp.lch(arg));},
//a shorter way to convert to husl
husl: function(arg){
return _husl._conv.lch.husl( _husl._conv.huslp.lch(arg));
}
};
//extend lchuv, xyz
lchuv.huslp = _husl._conv.lch.huslp;
xyz.huslp = function(arg){return _husl._conv.lch.huslp(xyz.lchuv(arg));};

View File

@@ -0,0 +1,109 @@
/**
* @module color-space/hwb
*/
var rgb = require('./rgb');
var hsv = require('./hsv');
var hsl = require('./hsl');
var hwb = module.exports = {
name: 'hwb',
min: [0,0,0],
max: [360,100,100],
channel: ['hue', 'whiteness', 'blackness'],
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
rgb: function(hwb) {
var h = hwb[0] / 360,
wh = hwb[1] / 100,
bl = hwb[2] / 100,
ratio = wh + bl,
i, v, f, n;
var r, g, b;
// wh + bl cant be > 1
if (ratio > 1) {
wh /= ratio;
bl /= ratio;
}
i = Math.floor(6 * h);
v = 1 - bl;
f = 6 * h - i;
//if it is even
if ((i & 0x01) !== 0) {
f = 1 - f;
}
n = wh + f * (v - wh); // linear interpolation
switch (i) {
default:
case 6:
case 0: r = v; g = n; b = wh; break;
case 1: r = n; g = v; b = wh; break;
case 2: r = wh; g = v; b = n; break;
case 3: r = wh; g = n; b = v; break;
case 4: r = n; g = wh; b = v; break;
case 5: r = v; g = wh; b = n; break;
}
return [r * 255, g * 255, b * 255];
},
// http://alvyray.com/Papers/CG/HWB_JGTv208.pdf
hsv: function(arg){
var h = arg[0], w = arg[1], b = arg[2], s, v;
//if w+b > 100% - take proportion (how many times )
if (w + b >= 100){
s = 0;
v = 100 * w/(w+b);
}
//by default - take wiki formula
else {
s = 100-(w/(1-b/100));
v = 100-b;
}
return [h, s, v];
},
hsl: function(arg){
return hsv.hsl(hwb.hsv(arg));
}
};
//extend rgb
rgb.hwb = function(val) {
var r = val[0],
g = val[1],
b = val[2],
h = rgb.hsl(val)[0],
w = 1/255 * Math.min(r, Math.min(g, b));
b = 1 - 1/255 * Math.max(r, Math.max(g, b));
return [h, w * 100, b * 100];
};
//keep proper hue on 0 values (conversion to rgb loses hue on zero-lightness)
hsv.hwb = function(arg){
var h = arg[0], s = arg[1], v = arg[2];
return [h, v === 0 ? 0 : (v * (1-s/100)), 100 - v];
};
//extend hsl with proper conversions
hsl.hwb = function(arg){
return hsv.hwb(hsl.hsv(arg));
};

View File

@@ -0,0 +1,46 @@
/**
* @module color-space
*
* @todo to-source method, preparing the code for webworker
* @todo implement all side spaces from http://en.wikipedia.org/wiki/Category:Color_space yuv, yiq etc.
* @todo here are additional spaces http://www.jentronics.com/color.html ITU, REC709, SMTPE, NTSC, GREY
*
* @todo implement asm-js way to convert spaces (promises to be times faster)
*
*/
var addConvertor = require('./util/add-convertor');
/** Exported spaces */
var spaces = {
rgb: require('./rgb'),
hsl: require('./hsl'),
hsv: require('./hsv'),
hwb: require('./hwb'),
cmyk: require('./cmyk'),
xyz: require('./xyz'),
lab: require('./lab'),
lchab: require('./lchab'),
luv: require('./luv'),
lchuv: require('./lchuv'),
husl: require('./husl'),
huslp: require('./huslp')
};
//build absent convertors from each to every space
var fromSpace, toSpace;
for (var fromSpaceName in spaces) {
fromSpace = spaces[fromSpaceName];
for (var toSpaceName in spaces) {
if (toSpaceName !== fromSpaceName) {
toSpace = spaces[toSpaceName];
addConvertor(fromSpace, toSpace);
}
}
}
module.exports = spaces;

View File

@@ -0,0 +1,59 @@
/**
* CIE LAB space model
*
* @module color-space/lab
*/
var xyz = require('./xyz');
module.exports = {
name: 'lab',
min: [0,-100,-100],
max: [100,100,100],
channel: ['lightness', 'a', 'b'],
alias: ['cielab'],
xyz: function(lab) {
var l = lab[0],
a = lab[1],
b = lab[2],
x, y, z, y2;
if (l <= 8) {
y = (l * 100) / 903.3;
y2 = (7.787 * (y / 100)) + (16 / 116);
} else {
y = 100 * Math.pow((l + 16) / 116, 3);
y2 = Math.pow(y / 100, 1/3);
}
x = x / 95.047 <= 0.008856 ? x = (95.047 * ((a / 500) + y2 - (16 / 116))) / 7.787 : 95.047 * Math.pow((a / 500) + y2, 3);
z = z / 108.883 <= 0.008859 ? z = (108.883 * (y2 - (b / 200) - (16 / 116))) / 7.787 : 108.883 * Math.pow(y2 - (b / 200), 3);
return [x, y, z];
}
};
//extend xyz
xyz.lab = function(xyz){
var x = xyz[0],
y = xyz[1],
z = xyz[2],
l, a, b;
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116);
y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116);
z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116);
l = (116 * y) - 16;
a = 500 * (x - y);
b = 200 * (y - z);
return [l, a, b];
};

View File

@@ -0,0 +1,43 @@
/**
* Hunter-lab space.
*
* @module color-space/labh
*/
var xyz = require('./xyz');
module.exports = {
name: 'labh',
//mins/maxes are taken from colormine
//FIXME: check whether mins/maxes correct
min: [0,-128,-128],
max: [100,128,128],
channel: ['lightness', 'a', 'b'],
alias: ['hunter-lab', 'hlab'],
//maths are taken from EasyRGB
xyz: function(lab) {
var l = lab[0], a = lab[1], b = lab[2];
var _y = l / 10;
var _x = a / 17.5 * l / 10;
var _z = b / 7 * l / 10;
var y = _y * _y;
var x = ( _x + y ) / 1.02;
var z = -( _z - y ) / 0.847;
return [x,y,z];
}
};
//extend xyz
xyz.labh = function(xyz){
var x = xyz[0], y = xyz[1], z = xyz[2];
var l = 10 * Math.sqrt( y );
var a = y === 0 ? 0 : 17.5 * ((( 1.02 * x ) - y ) / Math.sqrt( y ) );
var b = y === 0 ? 0 : 7 * ( ( y - ( 0.847 * z ) ) / Math.sqrt( y ) );
return [l, a, b];
};

View File

@@ -0,0 +1,55 @@
/**
* Cylindrical LAB
*
* @module color-space/lchab
*/
var xyz = require('./xyz');
var lab = require('./lab');
//cylindrical lab
var lchab = module.exports = {
name: 'lchab',
min: [0,0,0],
max: [100,100,360],
channel: ['lightness', 'chroma', 'hue'],
alias: ['cielch', 'lch'],
xyz: function(arg) {
return lab.xyz(lchab.lab(arg));
},
lab: function(lch) {
var l = lch[0],
c = lch[1],
h = lch[2],
a, b, hr;
hr = h / 360 * 2 * Math.PI;
a = c * Math.cos(hr);
b = c * Math.sin(hr);
return [l, a, b];
}
};
//extend lab
lab.lchab = function(lab) {
var l = lab[0],
a = lab[1],
b = lab[2],
hr, h, c;
hr = Math.atan2(b, a);
h = hr * 360 / 2 / Math.PI;
if (h < 0) {
h += 360;
}
c = Math.sqrt(a * a + b * b);
return [l, c, h];
};
xyz.lchab = function(arg){
return lab.lchab(xyz.lab(arg));
};

View File

@@ -0,0 +1,50 @@
/**
* Cylindrical CIE LUV
*
* @module color-space/lchuv
*/
var luv = require('./luv');
var xyz = require('./xyz');
//cylindrical luv
var lchuv = module.exports = {
name: 'lchuv',
channel: ['lightness', 'chroma', 'hue'],
alias: ['cielchuv'],
min: [0,0,0],
max: [100,100,360],
luv: function(luv){
var l = luv[0],
c = luv[1],
h = luv[2],
u, v, hr;
hr = h / 360 * 2 * Math.PI;
u = c * Math.cos(hr);
v = c * Math.sin(hr);
return [l, u, v];
},
xyz: function(arg) {
return luv.xyz(lchuv.luv(arg));
},
};
luv.lchuv = function(luv){
var l = luv[0], u = luv[1], v = luv[2];
var c = Math.sqrt(u*u + v*v);
var hr = Math.atan2(v,u);
var h = hr * 360 / 2 / Math.PI;
if (h < 0) {
h += 360;
}
return [l,c,h]
};
xyz.lchuv = function(arg){
return luv.lchuv(xyz.luv(arg));
};

View File

@@ -0,0 +1,70 @@
/**
* A responsivity of cones color space.
* Used for CAT - chromatic adaptation transform.
*
* http://en.wikipedia.org/wiki/LMS_color_space
*
* @todo xyz -> lms
* @todo tests
*
* @module color-space/lms
*/
var xyz = require('./xyz');
var lms = module.exports = {
name: 'lms',
min: [0,0,0],
max: [100,100,100],
channel: ['long', 'medium', 'short'],
//transform matrices
transform: {
// huntpointerestevez
rlab: [
0.38971, 0.68898,-0.07868,
-0.22981, 1.18340, 0.04641,
0.00000, 0.00000, 1.00000],
rlabD65: [
0.4002, 0.7076, -0.0808,
-0.2263, 1.1653, 0.0457,
0.00000,0.00000, 0.9182],
cmccat97: [
0.8951, 0.2664,-0.1614,
-0.7502, 1.7135, 0.0367,
0.0389,-0.0686, 1.0296],
cat97: [
0.8562, 0.3372,-0.1934,
-0.8360, 1.8327, 0.0033,
0.0357,-0.00469,1.0112],
cat00: [
0.7982, 0.3389,-0.1371,
-0.5918, 1.5512, 0.0406,
0.0008, 0.0239, 0.9753],
cat02: [
0.7328, 0.4296,-0.1624,
-0.7036, 1.6975, 0.0061,
0.0030, 0.0136, 0.9834]
},
//m - a matrix
xyz: function(arg, m){
var x = arg[0], y = arg[1], z = arg[2];
if (!m) {
m = lms.transform[cat02];
}
return [
x * m[0] + y * m[1] + z * m[2],
x * m[3] + y * m[4] + z * m[5],
x * m[6] + y * m[7] + z * m[8]
];
}
};
xyz.lms = function(arg, i, o) {
//TODO
return [l, u, v];
};

View File

@@ -0,0 +1,99 @@
/**
* CIE LUV (C'est la vie)
*
* @module color-space/luv
*/
var xyz = require('./xyz');
module.exports = {
name: 'luv',
//NOTE: luv has no rigidly defined limits
//easyrgb fails to get proper coords
//boronine states no rigid limits
//colorMine refers this ones:
min: [0,-134,-140],
max: [100,224,122],
channel: ['lightness', 'u', 'v'],
alias: ['cieluv'],
xyz: function(arg, i, o){
var _u, _v, l, u, v, x, y, z, xn, yn, zn, un, vn;
l = arg[0], u = arg[1], v = arg[2];
if (l === 0) return [0,0,0];
//get constants
var e = 0.008856451679035631; //(6/29)^3
var k = 0.0011070564598794539; //(3/29)^3
//get illuminant/observer
i = i || 'D65';
o = o || 2;
xn = xyz.whitepoint[o][i][0];
yn = xyz.whitepoint[o][i][1];
zn = xyz.whitepoint[o][i][2];
un = (4 * xn) / (xn + (15 * yn) + (3 * zn));
vn = (9 * yn) / (xn + (15 * yn) + (3 * zn));
// un = 0.19783000664283;
// vn = 0.46831999493879;
_u = u / (13 * l) + un || 0;
_v = v / (13 * l) + vn || 0;
y = l > 8 ? yn * Math.pow( (l + 16) / 116 , 3) : yn * l * k;
//wikipedia method
x = y * 9 * _u / (4 * _v) || 0;
z = y * (12 - 3 * _u - 20 * _v) / (4 * _v) || 0;
//boronine method
//https://github.com/boronine/husl/blob/master/husl.coffee#L201
// x = 0 - (9 * y * _u) / ((_u - 4) * _v - _u * _v);
// z = (9 * y - (15 * _v * y) - (_v * x)) / (3 * _v);
return [x, y, z];
}
};
// http://www.brucelindbloom.com/index.html?Equations.html
// https://github.com/boronine/husl/blob/master/husl.coffee
//i - illuminant
//o - observer
xyz.luv = function(arg, i, o) {
var _u, _v, l, u, v, x, y, z, xn, yn, zn, un, vn;
//get constants
var e = 0.008856451679035631; //(6/29)^3
var k = 903.2962962962961; //(29/3)^3
//get illuminant/observer coords
i = i || 'D65';
o = o || 2;
xn = xyz.whitepoint[o][i][0];
yn = xyz.whitepoint[o][i][1];
zn = xyz.whitepoint[o][i][2];
un = (4 * xn) / (xn + (15 * yn) + (3 * zn));
vn = (9 * yn) / (xn + (15 * yn) + (3 * zn));
x = arg[0], y = arg[1], z = arg[2];
_u = (4 * x) / (x + (15 * y) + (3 * z)) || 0;
_v = (9 * y) / (x + (15 * y) + (3 * z)) || 0;
var yr = y/yn;
l = yr <= e ? k * yr : 116 * Math.pow(yr, 1/3) - 16;
u = 13 * l * (_u - un);
v = 13 * l * (_v - vn);
return [l, u, v];
};

View File

@@ -0,0 +1,53 @@
{
"name": "color-space",
"description": "Conversion functions and space data. Full list of spaces.",
"version": "1.1.2",
"author": "Deema Yvanow <dfcreative@gmail.com>",
"keywords": [
"color",
"colour",
"rgb",
"hsl",
"hsv",
"lab",
"lch",
"luv",
"lch",
"cie",
"husl",
"color-convert",
"gamut",
"color-conversions",
"color-space",
"color-translation",
"color-data"
],
"repository": {
"type": "git",
"url": "http://github.com/dfcreative/color-space.git"
},
"files": [
"*.js",
"util",
"dist"
],
"main": "./index.js",
"dependencies": {
"husl": ">=5.0"
},
"devDependencies": {
"mumath": "~0.x",
"mocha": "*",
"browserify": "~6.x",
"assert": "~1.x",
"closurecompiler": "~1.x",
"require-stub": "~1.x",
"query-relative": "~1.x"
},
"scripts": {
"test": "mocha",
"build": "browserify --standalone colorSpace ./index.js > dist/color-space.js",
"min": "ccjs dist/color-space.js --language_in=ECMASCRIPT5 > dist/color-space.min.js && cat dist/color-space.min.js | gzip-size | pretty-bytes",
"build-test": "browserify -r ./util/add-space:../util/add-space -r ./index:../index -r ./xyy:../xyy -r ./labh:../labh -r ./cmy:../cmy -r husl -r assert -r mumath -r query-relative > test/test.bundle.js"
}
}

View File

@@ -0,0 +1,12 @@
/**
* RGB space.
*
* @module color-space/rgb
*/
module.exports = {
name: 'rgb',
min: [0,0,0],
max: [255,255,255],
channel: ['red', 'green', 'blue']
};

View File

@@ -0,0 +1,44 @@
/**
* Add a convertor from one to another space via XYZ or RGB space as a medium.
*
* @module color-space/add-convertor
*/
var xyz = require('../xyz');
var rgb = require('../rgb');
module.exports = addConvertor;
/**
* Add convertor from space A to space B.
* So space A will be able to transform to B.
*/
function addConvertor(fromSpace, toSpace){
if (!fromSpace[toSpace.name]) {
fromSpace[toSpace.name] = getConvertor(fromSpace, toSpace);
}
return fromSpace;
}
/** return converter through xyz/rgb space */
function getConvertor(fromSpace, toSpace){
var toSpaceName = toSpace.name;
//create xyz converter, if available
if (fromSpace.xyz && xyz[toSpaceName]) {
return function(arg){
return xyz[toSpaceName](fromSpace.xyz(arg));
};
}
//create rgb converter
else if (fromSpace.rgb && rgb[toSpaceName]) {
return function(arg){
return rgb[toSpaceName](fromSpace.rgb(arg));
};
}
throw Error('Cant add convertor from ' + fromSpace.name + ' to ' + toSpaceName);
}

View File

@@ -0,0 +1,37 @@
/**
* Append a new color space to the set
* Bind all necessary conversions etc
*
* @module color-space/add-space
*/
var addConvertor = require('./add-convertor');
/**
* Appends a converter from every space in the set to a new space.
* Appends a converter from the new space to every space in the set.
*
* @param {object} space New space with basic xyz/rgb converters
* @param {object} spaces Set of color spaces
*
* @return {object} A new space
*/
module.exports = function(spaces, space){
var spaceName = space.name;
//ignore existing space
if (spaces[spaceName]) return;
//add convertors to every existing space
var otherSpace;
for (var otherSpaceName in spaces) {
otherSpace = spaces[otherSpaceName];
addConvertor(space, otherSpace);
addConvertor(otherSpace, space);
}
//save a new space
spaces[spaceName] = space;
return space;
};

View File

@@ -0,0 +1,45 @@
/**
* Transform set of spaces to source code.
* Useful to pass color-spaces source to web-worker, for example.
*
* @module color-space/to-source
*/
/**
* Return evaluable source code of spaces set.
*
* @param {object} spaces A (sub)set of color spaces to stringify. Normally - index.js.
*
* @return {string} source code
*/
module.exports = function(spaces){
var res = '(function(){\nvar space = {};\n';
var fnSrc, space;
for (var spaceName in spaces) {
space = spaces[spaceName];
res += '\nvar ' + spaceName + ' = space.' + spaceName + ' = {\n';
for (var prop in space) {
if (typeof space[prop] === 'function') {
fnSrc = space[prop].toString();
//replace medium converters refs
fnSrc = fnSrc.replace('[toSpaceName]', '.' + prop);
fnSrc = fnSrc.replace('fromSpace', spaceName);
res += prop + ':' + fnSrc + ',\n';
} else {
res += prop + ':' + JSON.stringify(space[prop]) + ',\n';
}
}
res += '}\n';
}
res += '\nreturn space;})()';
return res;
};

View File

@@ -0,0 +1,38 @@
/**
* Additional xyY space.
*
* @module color-space/xyy
*/
var xyz = require('./xyz');
module.exports = {
name: 'xyy',
min: [0,0,0],
max: [1,1,100],
channel: ['x','y','Y'],
alias: ['Yxy', 'xyY', 'yxy'],
// https://github.com/boronine/colorspaces.js/blob/master/colorspaces.js#L128
xyz: function(arg) {
var X, Y, Z, x, y;
x = arg[0], y = arg[1], Y = arg[2];
if (y === 0) {
return [0, 0, 0];
}
X = x * Y / y;
Z = (1 - x - y) * Y / y;
return [X, Y, Z];
}
};
//extend xyz
xyz.xyy = function(arg) {
var sum, X, Y, Z;
X = arg[0], Y = arg[1], Z = arg[2];
sum = X + Y + Z;
if (sum === 0) {
return [0, 0, Y];
}
return [X / sum, Y / sum, Y];
};

View File

@@ -0,0 +1,108 @@
/**
* CIE XYZ
*
* @module color-space/xyz
*/
var rgb = require('./rgb');
var xyz = module.exports = {
name: 'xyz',
min: [0,0,0],
max: [96,100,109],
channel: ['lightness','u','v'],
alias: ['ciexyz'],
//whitepoint with observer/illuminant
// http://en.wikipedia.org/wiki/Standard_illuminant
whitepoint: {
2: {
//incadescent
A:[109.85, 100, 35.585],
// B:[],
C: [98.074, 100, 118.232],
D50: [96.422, 100, 82.521],
D55: [95.682, 100, 92.149],
//daylight
D65: [95.045592705167, 100, 108.9057750759878],
D75: [94.972, 100, 122.638],
//flourescent
// F1: [],
F2: [99.187, 100, 67.395],
// F3: [],
// F4: [],
// F5: [],
// F6:[],
F7: [95.044, 100, 108.755],
// F8: [],
// F9: [],
// F10: [],
F11: [100.966, 100, 64.370],
// F12: [],
E: [100,100,100]
},
10: {
//incadescent
A:[111.144, 100, 35.200],
C: [97.285, 100, 116.145],
D50: [96.720, 100, 81.427],
D55: [95.799, 100, 90.926],
//daylight
D65: [94.811, 100, 107.304],
D75: [94.416, 100, 120.641],
//flourescent
F2: [103.280, 100, 69.026],
F7: [95.792, 100, 107.687],
F11: [103.866, 100, 65.627],
E: [100,100,100]
}
},
rgb: function(xyz) {
var x = xyz[0] / 100,
y = xyz[1] / 100,
z = xyz[2] / 100,
r, g, b;
// assume sRGB
// http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
r = (x * 3.240969941904521) + (y * -1.537383177570093) + (z * -0.498610760293);
g = (x * -0.96924363628087) + (y * 1.87596750150772) + (z * 0.041555057407175);
b = (x * 0.055630079696993) + (y * -0.20397695888897) + (z * 1.056971514242878);
r = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
: r = (r * 12.92);
g = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
: g = (g * 12.92);
b = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
: b = (b * 12.92);
r = Math.min(Math.max(0, r), 1);
g = Math.min(Math.max(0, g), 1);
b = Math.min(Math.max(0, b), 1);
return [r * 255, g * 255, b * 255];
}
};
//extend rgb
rgb.xyz = function(rgb) {
var r = rgb[0] / 255,
g = rgb[1] / 255,
b = rgb[2] / 255;
// assume sRGB
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
var x = (r * 0.41239079926595) + (g * 0.35758433938387) + (b * 0.18048078840183);
var y = (r * 0.21263900587151) + (g * 0.71516867876775) + (b * 0.072192315360733);
var z = (r * 0.019330818715591) + (g * 0.11919477979462) + (b * 0.95053215224966);
return [x * 100, y *100, z * 100];
};

22
node_modules/jibo-keyframes/package.json generated vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"name": "jibo-keyframes",
"version": "0.4.5",
"description": "APIs for runtime keyframe to animation genration",
"main": "lib/index.js",
"scripts": {
"test": "gulp test"
},
"author": "Avida Michaud",
"license": "SEE LICENSE IN LICENSE.txt",
"dependencies": {
"async": "^0.9.0",
"color-space": "1.1.2",
"eases": "^1.0.6",
"fs-extra": "^0.18.2",
"fs-plus": "^2.7.1",
"lodash": "^3.8.0",
"semver": "^5.0.3",
"three": "^0.71.0",
"uuid": "^2.0.1"
}
}