Skip to content

Instantly share code, notes, and snippets.

@mattgperry
Created May 20, 2015 09:04
Show Gist options
  • Save mattgperry/524873718c900d99253b to your computer and use it in GitHub Desktop.
Save mattgperry/524873718c900d99253b to your computer and use it in GitHub Desktop.
requirebin sketch
var h = require('virtual-dom/h');
var diff = require('virtual-dom/diff');
var patch = require('virtual-dom/patch');
var createElement = require('virtual-dom/create-element');
var redshift = require('redshift');
var renderAction = redshift.newAction();
// 1: Create a function that declares what the DOM should look like
function render(count) {
return h('div', {
style: {
textAlign: 'center',
lineHeight: (100 + count) + 'px',
border: '1px solid red',
width: (100 + count) + 'px',
height: (100 + count) + 'px'
}
}, [String(count)]);
}
// 2: Initialise the document
var tree = render(0); // We need an initial tree
var rootNode = createElement(tree); // Create an initial root DOM node ...
document.body.appendChild(rootNode); // ... and it should be in the document
// 3: Use Redshift for our update logic
renderAction.play({
values: {
count: {
to: 500,
round: true
}
},
duration: 1000,
ease: 'backOut',
onFrame: function (output) {
var newTree = render(output.count);
var patches = diff(tree, newTree);
rootNode = patch(rootNode, patches);
tree = newTree;
}
});
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){module.exports=function split(undef){var nativeSplit=String.prototype.split,compliantExecNpcg=/()??/.exec("")[1]===undef,self;self=function(str,separator,limit){if(Object.prototype.toString.call(separator)!=="[object RegExp]"){return nativeSplit.call(str,separator,limit)}var output=[],flags=(separator.ignoreCase?"i":"")+(separator.multiline?"m":"")+(separator.extended?"x":"")+(separator.sticky?"y":""),lastLastIndex=0,separator=new RegExp(separator.source,flags+"g"),separator2,match,lastIndex,lastLength;str+="";if(!compliantExecNpcg){separator2=new RegExp("^"+separator.source+"$(?!\\s)",flags)}limit=limit===undef?-1>>>0:limit>>>0;while(match=separator.exec(str)){lastIndex=match.index+match[0].length;if(lastIndex>lastLastIndex){output.push(str.slice(lastLastIndex,match.index));if(!compliantExecNpcg&&match.length>1){match[0].replace(separator2,function(){for(var i=1;i<arguments.length-2;i++){if(arguments[i]===undef){match[i]=undef}}})}if(match.length>1&&match.index<str.length){Array.prototype.push.apply(output,match.slice(1))}lastLength=match[0].length;lastLastIndex=lastIndex;if(output.length>=limit){break}}if(separator.lastIndex===match.index){separator.lastIndex++}}if(lastLastIndex===str.length){if(lastLength||!separator.test("")){output.push("")}}else{output.push(str.slice(lastLastIndex))}return output.length>limit?output.slice(0,limit):output};return self}()},{}],2:[function(require,module,exports){"use strict";var OneVersionConstraint=require("individual/one-version");var MY_VERSION="7";OneVersionConstraint("ev-store",MY_VERSION);var hashKey="__EV_STORE_KEY@"+MY_VERSION;module.exports=EvStore;function EvStore(elem){var hash=elem[hashKey];if(!hash){hash=elem[hashKey]={}}return hash}},{"individual/one-version":4}],3:[function(require,module,exports){(function(global){"use strict";var root=typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};module.exports=Individual;function Individual(key,value){if(key in root){return root[key]}root[key]=value;return value}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],4:[function(require,module,exports){"use strict";var Individual=require("./index.js");module.exports=OneVersion;function OneVersion(moduleName,version,defaultValue){var key="__INDIVIDUAL_ONE_VERSION_"+moduleName;var enforceKey=key+"_ENFORCE_SINGLETON";var versionValue=Individual(enforceKey,version);if(versionValue!==version){throw new Error("Can only have one copy of "+moduleName+".\n"+"You already have version "+versionValue+" installed.\n"+"This means you cannot install version "+version)}return Individual(key,defaultValue)}},{"./index.js":3}],5:[function(require,module,exports){var nativeIsArray=Array.isArray;var toString=Object.prototype.toString;module.exports=nativeIsArray||isArray;function isArray(obj){return toString.call(obj)==="[object Array]"}},{}],6:[function(require,module,exports){"use strict";var EvStore=require("ev-store");module.exports=EvHook;function EvHook(value){if(!(this instanceof EvHook)){return new EvHook(value)}this.value=value}EvHook.prototype.hook=function(node,propertyName){var es=EvStore(node);var propName=propertyName.substr(3);es[propName]=this.value};EvHook.prototype.unhook=function(node,propertyName){var es=EvStore(node);var propName=propertyName.substr(3);es[propName]=undefined}},{"ev-store":2}],7:[function(require,module,exports){"use strict";module.exports=SoftSetHook;function SoftSetHook(value){if(!(this instanceof SoftSetHook)){return new SoftSetHook(value)}this.value=value}SoftSetHook.prototype.hook=function(node,propertyName){if(node[propertyName]!==this.value){node[propertyName]=this.value}}},{}],8:[function(require,module,exports){"use strict";var isArray=require("x-is-array");var VNode=require("../vnode/vnode.js");var VText=require("../vnode/vtext.js");var isVNode=require("../vnode/is-vnode");var isVText=require("../vnode/is-vtext");var isWidget=require("../vnode/is-widget");var isHook=require("../vnode/is-vhook");var isVThunk=require("../vnode/is-thunk");var parseTag=require("./parse-tag.js");var softSetHook=require("./hooks/soft-set-hook.js");var evHook=require("./hooks/ev-hook.js");module.exports=h;function h(tagName,properties,children){var childNodes=[];var tag,props,key,namespace;if(!children&&isChildren(properties)){children=properties;props={}}props=props||properties||{};tag=parseTag(tagName,props);if(props.hasOwnProperty("key")){key=props.key;props.key=undefined}if(props.hasOwnProperty("namespace")){namespace=props.namespace;props.namespace=undefined}if(tag==="INPUT"&&!namespace&&props.hasOwnProperty("value")&&props.value!==undefined&&!isHook(props.value)){props.value=softSetHook(props.value)}transformProperties(props);if(children!==undefined&&children!==null){addChild(children,childNodes,tag,props)}return new VNode(tag,props,childNodes,key,namespace)}function addChild(c,childNodes,tag,props){if(typeof c==="string"){childNodes.push(new VText(c))}else if(isChild(c)){childNodes.push(c)}else if(isArray(c)){for(var i=0;i<c.length;i++){addChild(c[i],childNodes,tag,props)}}else if(c===null||c===undefined){return}else{throw UnexpectedVirtualElement({foreignObject:c,parentVnode:{tagName:tag,properties:props}})}}function transformProperties(props){for(var propName in props){if(props.hasOwnProperty(propName)){var value=props[propName];if(isHook(value)){continue}if(propName.substr(0,3)==="ev-"){props[propName]=evHook(value)}}}}function isChild(x){return isVNode(x)||isVText(x)||isWidget(x)||isVThunk(x)}function isChildren(x){return typeof x==="string"||isArray(x)||isChild(x)}function UnexpectedVirtualElement(data){var err=new Error;err.type="virtual-hyperscript.unexpected.virtual-element";err.message="Unexpected virtual child passed to h().\n"+"Expected a VNode / Vthunk / VWidget / string but:\n"+"got:\n"+errorString(data.foreignObject)+".\n"+"The parent vnode is:\n"+errorString(data.parentVnode);"\n"+"Suggested fix: change your `h(..., [ ... ])` callsite.";err.foreignObject=data.foreignObject;err.parentVnode=data.parentVnode;return err}function errorString(obj){try{return JSON.stringify(obj,null," ")}catch(e){return String(obj)}}},{"../vnode/is-thunk":10,"../vnode/is-vhook":11,"../vnode/is-vnode":12,"../vnode/is-vtext":13,"../vnode/is-widget":14,"../vnode/vnode.js":16,"../vnode/vtext.js":17,"./hooks/ev-hook.js":6,"./hooks/soft-set-hook.js":7,"./parse-tag.js":9,"x-is-array":5}],9:[function(require,module,exports){"use strict";var split=require("browser-split");var classIdSplit=/([\.#]?[a-zA-Z0-9_:-]+)/;var notClassId=/^\.|#/;module.exports=parseTag;function parseTag(tag,props){if(!tag){return"DIV"}var noId=!props.hasOwnProperty("id");var tagParts=split(tag,classIdSplit);var tagName=null;if(notClassId.test(tagParts[1])){tagName="DIV"}var classes,part,type,i;for(i=0;i<tagParts.length;i++){part=tagParts[i];if(!part){continue}type=part.charAt(0);if(!tagName){tagName=part}else if(type==="."){classes=classes||[];classes.push(part.substring(1,part.length))}else if(type==="#"&&noId){props.id=part.substring(1,part.length)}}if(classes){if(props.className){classes.push(props.className)}props.className=classes.join(" ")}return props.namespace?tagName:tagName.toUpperCase()}},{"browser-split":1}],10:[function(require,module,exports){module.exports=isThunk;function isThunk(t){return t&&t.type==="Thunk"}},{}],11:[function(require,module,exports){module.exports=isHook;function isHook(hook){return hook&&(typeof hook.hook==="function"&&!hook.hasOwnProperty("hook")||typeof hook.unhook==="function"&&!hook.hasOwnProperty("unhook"))}},{}],12:[function(require,module,exports){var version=require("./version");module.exports=isVirtualNode;function isVirtualNode(x){return x&&x.type==="VirtualNode"&&x.version===version}},{"./version":15}],13:[function(require,module,exports){var version=require("./version");module.exports=isVirtualText;function isVirtualText(x){return x&&x.type==="VirtualText"&&x.version===version}},{"./version":15}],14:[function(require,module,exports){module.exports=isWidget;function isWidget(w){return w&&w.type==="Widget"}},{}],15:[function(require,module,exports){module.exports="2"},{}],16:[function(require,module,exports){var version=require("./version");var isVNode=require("./is-vnode");var isWidget=require("./is-widget");var isThunk=require("./is-thunk");var isVHook=require("./is-vhook");module.exports=VirtualNode;var noProperties={};var noChildren=[];function VirtualNode(tagName,properties,children,key,namespace){this.tagName=tagName;this.properties=properties||noProperties;this.children=children||noChildren;this.key=key!=null?String(key):undefined;this.namespace=typeof namespace==="string"?namespace:null;var count=children&&children.length||0;var descendants=0;var hasWidgets=false;var hasThunks=false;var descendantHooks=false;var hooks;for(var propName in properties){if(properties.hasOwnProperty(propName)){var property=properties[propName];if(isVHook(property)&&property.unhook){if(!hooks){hooks={}}hooks[propName]=property}}}for(var i=0;i<count;i++){var child=children[i];if(isVNode(child)){descendants+=child.count||0;if(!hasWidgets&&child.hasWidgets){hasWidgets=true}if(!hasThunks&&child.hasThunks){hasThunks=true}if(!descendantHooks&&(child.hooks||child.descendantHooks)){descendantHooks=true}}else if(!hasWidgets&&isWidget(child)){if(typeof child.destroy==="function"){hasWidgets=true}}else if(!hasThunks&&isThunk(child)){hasThunks=true}}this.count=count+descendants;this.hasWidgets=hasWidgets;this.hasThunks=hasThunks;this.hooks=hooks;this.descendantHooks=descendantHooks}VirtualNode.prototype.version=version;VirtualNode.prototype.type="VirtualNode"},{"./is-thunk":10,"./is-vhook":11,"./is-vnode":12,"./is-widget":14,"./version":15}],17:[function(require,module,exports){var version=require("./version");module.exports=VirtualText;function VirtualText(text){this.text=String(text)}VirtualText.prototype.version=version;VirtualText.prototype.type="VirtualText"},{"./version":15}],"virtual-dom/h":[function(require,module,exports){var h=require("./virtual-hyperscript/index.js");module.exports=h},{"./virtual-hyperscript/index.js":8}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";module.exports=function isObject(x){return typeof x==="object"&&x!==null}},{}],2:[function(require,module,exports){var nativeIsArray=Array.isArray;var toString=Object.prototype.toString;module.exports=nativeIsArray||isArray;function isArray(obj){return toString.call(obj)==="[object Array]"}},{}],3:[function(require,module,exports){var isVNode=require("./is-vnode");var isVText=require("./is-vtext");var isWidget=require("./is-widget");var isThunk=require("./is-thunk");module.exports=handleThunk;function handleThunk(a,b){var renderedA=a;var renderedB=b;if(isThunk(b)){renderedB=renderThunk(b,a)}if(isThunk(a)){renderedA=renderThunk(a,null)}return{a:renderedA,b:renderedB}}function renderThunk(thunk,previous){var renderedThunk=thunk.vnode;if(!renderedThunk){renderedThunk=thunk.vnode=thunk.render(previous)}if(!(isVNode(renderedThunk)||isVText(renderedThunk)||isWidget(renderedThunk))){throw new Error("thunk did not return a valid node")}return renderedThunk}},{"./is-thunk":4,"./is-vnode":6,"./is-vtext":7,"./is-widget":8}],4:[function(require,module,exports){module.exports=isThunk;function isThunk(t){return t&&t.type==="Thunk"}},{}],5:[function(require,module,exports){module.exports=isHook;function isHook(hook){return hook&&(typeof hook.hook==="function"&&!hook.hasOwnProperty("hook")||typeof hook.unhook==="function"&&!hook.hasOwnProperty("unhook"))}},{}],6:[function(require,module,exports){var version=require("./version");module.exports=isVirtualNode;function isVirtualNode(x){return x&&x.type==="VirtualNode"&&x.version===version}},{"./version":9}],7:[function(require,module,exports){var version=require("./version");module.exports=isVirtualText;function isVirtualText(x){return x&&x.type==="VirtualText"&&x.version===version}},{"./version":9}],8:[function(require,module,exports){module.exports=isWidget;function isWidget(w){return w&&w.type==="Widget"}},{}],9:[function(require,module,exports){module.exports="2"},{}],10:[function(require,module,exports){var version=require("./version");VirtualPatch.NONE=0;VirtualPatch.VTEXT=1;VirtualPatch.VNODE=2;VirtualPatch.WIDGET=3;VirtualPatch.PROPS=4;VirtualPatch.ORDER=5;VirtualPatch.INSERT=6;VirtualPatch.REMOVE=7;VirtualPatch.THUNK=8;module.exports=VirtualPatch;function VirtualPatch(type,vNode,patch){this.type=Number(type);this.vNode=vNode;this.patch=patch}VirtualPatch.prototype.version=version;VirtualPatch.prototype.type="VirtualPatch"},{"./version":9}],11:[function(require,module,exports){var isObject=require("is-object");var isHook=require("../vnode/is-vhook");module.exports=diffProps;function diffProps(a,b){var diff;for(var aKey in a){if(!(aKey in b)){diff=diff||{};diff[aKey]=undefined}var aValue=a[aKey];var bValue=b[aKey];if(aValue===bValue){continue}else if(isObject(aValue)&&isObject(bValue)){if(getPrototype(bValue)!==getPrototype(aValue)){diff=diff||{};diff[aKey]=bValue}else if(isHook(bValue)){diff=diff||{};diff[aKey]=bValue}else{var objectDiff=diffProps(aValue,bValue);if(objectDiff){diff=diff||{};diff[aKey]=objectDiff}}}else{diff=diff||{};diff[aKey]=bValue}}for(var bKey in b){if(!(bKey in a)){diff=diff||{};diff[bKey]=b[bKey]}}return diff}function getPrototype(value){if(Object.getPrototypeOf){return Object.getPrototypeOf(value)}else if(value.__proto__){return value.__proto__}else if(value.constructor){return value.constructor.prototype}}},{"../vnode/is-vhook":5,"is-object":1}],12:[function(require,module,exports){var isArray=require("x-is-array");var VPatch=require("../vnode/vpatch");var isVNode=require("../vnode/is-vnode");var isVText=require("../vnode/is-vtext");var isWidget=require("../vnode/is-widget");var isThunk=require("../vnode/is-thunk");var handleThunk=require("../vnode/handle-thunk");var diffProps=require("./diff-props");module.exports=diff;function diff(a,b){var patch={a:a};walk(a,b,patch,0);return patch}function walk(a,b,patch,index){if(a===b){return}var apply=patch[index];var applyClear=false;if(isThunk(a)||isThunk(b)){thunks(a,b,patch,index)}else if(b==null){if(!isWidget(a)){clearState(a,patch,index);apply=patch[index]}apply=appendPatch(apply,new VPatch(VPatch.REMOVE,a,b))}else if(isVNode(b)){if(isVNode(a)){if(a.tagName===b.tagName&&a.namespace===b.namespace&&a.key===b.key){var propsPatch=diffProps(a.properties,b.properties);if(propsPatch){apply=appendPatch(apply,new VPatch(VPatch.PROPS,a,propsPatch))}apply=diffChildren(a,b,patch,apply,index)}else{apply=appendPatch(apply,new VPatch(VPatch.VNODE,a,b));applyClear=true}}else{apply=appendPatch(apply,new VPatch(VPatch.VNODE,a,b));applyClear=true}}else if(isVText(b)){if(!isVText(a)){apply=appendPatch(apply,new VPatch(VPatch.VTEXT,a,b));applyClear=true}else if(a.text!==b.text){apply=appendPatch(apply,new VPatch(VPatch.VTEXT,a,b))}}else if(isWidget(b)){if(!isWidget(a)){applyClear=true}apply=appendPatch(apply,new VPatch(VPatch.WIDGET,a,b))}if(apply){patch[index]=apply}if(applyClear){clearState(a,patch,index)}}function diffChildren(a,b,patch,apply,index){var aChildren=a.children;var orderedSet=reorder(aChildren,b.children);var bChildren=orderedSet.children;var aLen=aChildren.length;var bLen=bChildren.length;var len=aLen>bLen?aLen:bLen;for(var i=0;i<len;i++){var leftNode=aChildren[i];var rightNode=bChildren[i];index+=1;if(!leftNode){if(rightNode){apply=appendPatch(apply,new VPatch(VPatch.INSERT,null,rightNode))}}else{walk(leftNode,rightNode,patch,index)}if(isVNode(leftNode)&&leftNode.count){index+=leftNode.count}}if(orderedSet.moves){apply=appendPatch(apply,new VPatch(VPatch.ORDER,a,orderedSet.moves))}return apply}function clearState(vNode,patch,index){unhook(vNode,patch,index);destroyWidgets(vNode,patch,index)}function destroyWidgets(vNode,patch,index){if(isWidget(vNode)){if(typeof vNode.destroy==="function"){patch[index]=appendPatch(patch[index],new VPatch(VPatch.REMOVE,vNode,null))}}else if(isVNode(vNode)&&(vNode.hasWidgets||vNode.hasThunks)){var children=vNode.children;var len=children.length;for(var i=0;i<len;i++){var child=children[i];index+=1;destroyWidgets(child,patch,index);if(isVNode(child)&&child.count){index+=child.count}}}else if(isThunk(vNode)){thunks(vNode,null,patch,index)}}function thunks(a,b,patch,index){var nodes=handleThunk(a,b);var thunkPatch=diff(nodes.a,nodes.b);if(hasPatches(thunkPatch)){patch[index]=new VPatch(VPatch.THUNK,null,thunkPatch)}}function hasPatches(patch){for(var index in patch){if(index!=="a"){return true}}return false}function unhook(vNode,patch,index){if(isVNode(vNode)){if(vNode.hooks){patch[index]=appendPatch(patch[index],new VPatch(VPatch.PROPS,vNode,undefinedKeys(vNode.hooks)))}if(vNode.descendantHooks||vNode.hasThunks){var children=vNode.children;var len=children.length;for(var i=0;i<len;i++){var child=children[i];index+=1;unhook(child,patch,index);if(isVNode(child)&&child.count){index+=child.count}}}}else if(isThunk(vNode)){thunks(vNode,null,patch,index)}}function undefinedKeys(obj){var result={};for(var key in obj){result[key]=undefined}return result}function reorder(aChildren,bChildren){var bChildIndex=keyIndex(bChildren);var bKeys=bChildIndex.keys;var bFree=bChildIndex.free;if(bFree.length===bChildren.length){return{children:bChildren,moves:null}}var aChildIndex=keyIndex(aChildren);var aKeys=aChildIndex.keys;var aFree=aChildIndex.free;if(aFree.length===aChildren.length){return{children:bChildren,moves:null}}var newChildren=[];var freeIndex=0;var freeCount=bFree.length;var deletedItems=0;for(var i=0;i<aChildren.length;i++){var aItem=aChildren[i];var itemIndex;if(aItem.key){if(bKeys.hasOwnProperty(aItem.key)){itemIndex=bKeys[aItem.key];newChildren.push(bChildren[itemIndex])}else{itemIndex=i-deletedItems++;newChildren.push(null)}}else{if(freeIndex<freeCount){itemIndex=bFree[freeIndex++];newChildren.push(bChildren[itemIndex])}else{itemIndex=i-deletedItems++;newChildren.push(null)}}}var lastFreeIndex=freeIndex>=bFree.length?bChildren.length:bFree[freeIndex];for(var j=0;j<bChildren.length;j++){var newItem=bChildren[j];if(newItem.key){if(!aKeys.hasOwnProperty(newItem.key)){newChildren.push(newItem)}}else if(j>=lastFreeIndex){newChildren.push(newItem)}}var simulate=newChildren.slice();var simulateIndex=0;var removes=[];var inserts=[];var simulateItem;for(var k=0;k<bChildren.length;){var wantedItem=bChildren[k];simulateItem=simulate[simulateIndex];while(simulateItem===null&&simulate.length){removes.push(remove(simulate,simulateIndex,null));simulateItem=simulate[simulateIndex]}if(!simulateItem||simulateItem.key!==wantedItem.key){if(wantedItem.key){if(simulateItem&&simulateItem.key){if(bKeys[simulateItem.key]!==k+1){removes.push(remove(simulate,simulateIndex,simulateItem.key));simulateItem=simulate[simulateIndex];if(!simulateItem||simulateItem.key!==wantedItem.key){inserts.push({key:wantedItem.key,to:k})}else{simulateIndex++}}else{inserts.push({key:wantedItem.key,to:k})}}else{inserts.push({key:wantedItem.key,to:k})}k++}else if(simulateItem&&simulateItem.key){removes.push(remove(simulate,simulateIndex,simulateItem.key))}}else{simulateIndex++;k++}}while(simulateIndex<simulate.length){simulateItem=simulate[simulateIndex];removes.push(remove(simulate,simulateIndex,simulateItem&&simulateItem.key))}if(removes.length===deletedItems&&!inserts.length){return{children:newChildren,moves:null}}return{children:newChildren,moves:{removes:removes,inserts:inserts}}}function remove(arr,index,key){arr.splice(index,1);return{from:index,key:key}}function keyIndex(children){var keys={};var free=[];var length=children.length;for(var i=0;i<length;i++){var child=children[i];if(child.key){keys[child.key]=i}else{free.push(i)}}return{keys:keys,free:free}}function appendPatch(apply,patch){if(apply){if(isArray(apply)){apply.push(patch)}else{apply=[apply,patch]}return apply}else{return patch}}},{"../vnode/handle-thunk":3,"../vnode/is-thunk":4,"../vnode/is-vnode":6,"../vnode/is-vtext":7,"../vnode/is-widget":8,"../vnode/vpatch":10,"./diff-props":11,"x-is-array":2}],"virtual-dom/diff":[function(require,module,exports){var diff=require("./vtree/diff.js");module.exports=diff},{"./vtree/diff.js":12}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){},{}],2:[function(require,module,exports){(function(global){var topLevel=typeof global!=="undefined"?global:typeof window!=="undefined"?window:{};var minDoc=require("min-document");if(typeof document!=="undefined"){module.exports=document}else{var doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"];if(!doccy){doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"]=minDoc}module.exports=doccy}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"min-document":1}],3:[function(require,module,exports){"use strict";module.exports=function isObject(x){return typeof x==="object"&&x!==null}},{}],4:[function(require,module,exports){var nativeIsArray=Array.isArray;var toString=Object.prototype.toString;module.exports=nativeIsArray||isArray;function isArray(obj){return toString.call(obj)==="[object Array]"}},{}],5:[function(require,module,exports){var isObject=require("is-object");var isHook=require("../vnode/is-vhook.js");module.exports=applyProperties;function applyProperties(node,props,previous){for(var propName in props){var propValue=props[propName];if(propValue===undefined){removeProperty(node,propName,propValue,previous)}else if(isHook(propValue)){removeProperty(node,propName,propValue,previous);if(propValue.hook){propValue.hook(node,propName,previous?previous[propName]:undefined)}}else{if(isObject(propValue)){patchObject(node,props,previous,propName,propValue)}else{node[propName]=propValue}}}}function removeProperty(node,propName,propValue,previous){if(previous){var previousValue=previous[propName];if(!isHook(previousValue)){if(propName==="attributes"){for(var attrName in previousValue){node.removeAttribute(attrName)}}else if(propName==="style"){for(var i in previousValue){node.style[i]=""}}else if(typeof previousValue==="string"){node[propName]=""}else{node[propName]=null}}else if(previousValue.unhook){previousValue.unhook(node,propName,propValue)}}}function patchObject(node,props,previous,propName,propValue){var previousValue=previous?previous[propName]:undefined;if(propName==="attributes"){for(var attrName in propValue){var attrValue=propValue[attrName];if(attrValue===undefined){node.removeAttribute(attrName)}else{node.setAttribute(attrName,attrValue)}}return}if(previousValue&&isObject(previousValue)&&getPrototype(previousValue)!==getPrototype(propValue)){node[propName]=propValue;return}if(!isObject(node[propName])){node[propName]={}}var replacer=propName==="style"?"":undefined;for(var k in propValue){var value=propValue[k];node[propName][k]=value===undefined?replacer:value}}function getPrototype(value){if(Object.getPrototypeOf){return Object.getPrototypeOf(value)}else if(value.__proto__){return value.__proto__}else if(value.constructor){return value.constructor.prototype}}},{"../vnode/is-vhook.js":13,"is-object":3}],6:[function(require,module,exports){var document=require("global/document");var applyProperties=require("./apply-properties");var isVNode=require("../vnode/is-vnode.js");var isVText=require("../vnode/is-vtext.js");var isWidget=require("../vnode/is-widget.js");var handleThunk=require("../vnode/handle-thunk.js");module.exports=createElement;function createElement(vnode,opts){var doc=opts?opts.document||document:document;var warn=opts?opts.warn:null;vnode=handleThunk(vnode).a;if(isWidget(vnode)){return vnode.init()}else if(isVText(vnode)){return doc.createTextNode(vnode.text)}else if(!isVNode(vnode)){if(warn){warn("Item is not a valid virtual dom node",vnode)}return null}var node=vnode.namespace===null?doc.createElement(vnode.tagName):doc.createElementNS(vnode.namespace,vnode.tagName);var props=vnode.properties;applyProperties(node,props);var children=vnode.children;for(var i=0;i<children.length;i++){var childNode=createElement(children[i],opts);if(childNode){node.appendChild(childNode)}}return node}},{"../vnode/handle-thunk.js":11,"../vnode/is-vnode.js":14,"../vnode/is-vtext.js":15,"../vnode/is-widget.js":16,"./apply-properties":5,"global/document":2}],7:[function(require,module,exports){var noChild={};module.exports=domIndex;function domIndex(rootNode,tree,indices,nodes){if(!indices||indices.length===0){return{}}else{indices.sort(ascending);return recurse(rootNode,tree,indices,nodes,0)}}function recurse(rootNode,tree,indices,nodes,rootIndex){nodes=nodes||{};if(rootNode){if(indexInRange(indices,rootIndex,rootIndex)){nodes[rootIndex]=rootNode}var vChildren=tree.children;if(vChildren){var childNodes=rootNode.childNodes;for(var i=0;i<tree.children.length;i++){rootIndex+=1;var vChild=vChildren[i]||noChild;var nextIndex=rootIndex+(vChild.count||0);if(indexInRange(indices,rootIndex,nextIndex)){recurse(childNodes[i],vChild,indices,nodes,rootIndex)}rootIndex=nextIndex}}}return nodes}function indexInRange(indices,left,right){if(indices.length===0){return false}var minIndex=0;var maxIndex=indices.length-1;var currentIndex;var currentItem;while(minIndex<=maxIndex){currentIndex=(maxIndex+minIndex)/2>>0;currentItem=indices[currentIndex];if(minIndex===maxIndex){return currentItem>=left&&currentItem<=right}else if(currentItem<left){minIndex=currentIndex+1}else if(currentItem>right){maxIndex=currentIndex-1}else{return true}}return false}function ascending(a,b){return a>b?1:-1}},{}],8:[function(require,module,exports){var applyProperties=require("./apply-properties");var isWidget=require("../vnode/is-widget.js");var VPatch=require("../vnode/vpatch.js");var render=require("./create-element");var updateWidget=require("./update-widget");module.exports=applyPatch;function applyPatch(vpatch,domNode,renderOptions){var type=vpatch.type;var vNode=vpatch.vNode;var patch=vpatch.patch;switch(type){case VPatch.REMOVE:return removeNode(domNode,vNode);case VPatch.INSERT:return insertNode(domNode,patch,renderOptions);case VPatch.VTEXT:return stringPatch(domNode,vNode,patch,renderOptions);case VPatch.WIDGET:return widgetPatch(domNode,vNode,patch,renderOptions);case VPatch.VNODE:return vNodePatch(domNode,vNode,patch,renderOptions);case VPatch.ORDER:reorderChildren(domNode,patch);return domNode;case VPatch.PROPS:applyProperties(domNode,patch,vNode.properties);return domNode;case VPatch.THUNK:return replaceRoot(domNode,renderOptions.patch(domNode,patch,renderOptions));default:return domNode}}function removeNode(domNode,vNode){var parentNode=domNode.parentNode;if(parentNode){parentNode.removeChild(domNode)}destroyWidget(domNode,vNode);return null}function insertNode(parentNode,vNode,renderOptions){var newNode=render(vNode,renderOptions);if(parentNode){parentNode.appendChild(newNode)}return parentNode}function stringPatch(domNode,leftVNode,vText,renderOptions){var newNode;if(domNode.nodeType===3){domNode.replaceData(0,domNode.length,vText.text);newNode=domNode}else{var parentNode=domNode.parentNode;newNode=render(vText,renderOptions);if(parentNode&&newNode!==domNode){parentNode.replaceChild(newNode,domNode)}}return newNode}function widgetPatch(domNode,leftVNode,widget,renderOptions){var updating=updateWidget(leftVNode,widget);var newNode;if(updating){newNode=widget.update(leftVNode,domNode)||domNode}else{newNode=render(widget,renderOptions)}var parentNode=domNode.parentNode;if(parentNode&&newNode!==domNode){parentNode.replaceChild(newNode,domNode)}if(!updating){destroyWidget(domNode,leftVNode)}return newNode}function vNodePatch(domNode,leftVNode,vNode,renderOptions){var parentNode=domNode.parentNode;var newNode=render(vNode,renderOptions);if(parentNode&&newNode!==domNode){parentNode.replaceChild(newNode,domNode)}return newNode}function destroyWidget(domNode,w){if(typeof w.destroy==="function"&&isWidget(w)){w.destroy(domNode)}}function reorderChildren(domNode,moves){var childNodes=domNode.childNodes;var keyMap={};var node;var remove;var insert;for(var i=0;i<moves.removes.length;i++){remove=moves.removes[i];node=childNodes[remove.from];if(remove.key){keyMap[remove.key]=node}domNode.removeChild(node)}var length=childNodes.length;for(var j=0;j<moves.inserts.length;j++){insert=moves.inserts[j];node=keyMap[insert.key];domNode.insertBefore(node,insert.to>=length++?null:childNodes[insert.to])}}function replaceRoot(oldRoot,newRoot){if(oldRoot&&newRoot&&oldRoot!==newRoot&&oldRoot.parentNode){oldRoot.parentNode.replaceChild(newRoot,oldRoot)}return newRoot}},{"../vnode/is-widget.js":16,"../vnode/vpatch.js":18,"./apply-properties":5,"./create-element":6,"./update-widget":10}],9:[function(require,module,exports){var document=require("global/document");var isArray=require("x-is-array");var domIndex=require("./dom-index");var patchOp=require("./patch-op");module.exports=patch;function patch(rootNode,patches){return patchRecursive(rootNode,patches)}function patchRecursive(rootNode,patches,renderOptions){var indices=patchIndices(patches);if(indices.length===0){return rootNode}var index=domIndex(rootNode,patches.a,indices);var ownerDocument=rootNode.ownerDocument;if(!renderOptions){renderOptions={patch:patchRecursive};if(ownerDocument!==document){renderOptions.document=ownerDocument}}for(var i=0;i<indices.length;i++){var nodeIndex=indices[i];rootNode=applyPatch(rootNode,index[nodeIndex],patches[nodeIndex],renderOptions)}return rootNode}function applyPatch(rootNode,domNode,patchList,renderOptions){if(!domNode){return rootNode}var newNode;if(isArray(patchList)){for(var i=0;i<patchList.length;i++){newNode=patchOp(patchList[i],domNode,renderOptions);if(domNode===rootNode){rootNode=newNode}}}else{newNode=patchOp(patchList,domNode,renderOptions);if(domNode===rootNode){rootNode=newNode}}return rootNode}function patchIndices(patches){var indices=[];for(var key in patches){if(key!=="a"){indices.push(Number(key))}}return indices}},{"./dom-index":7,"./patch-op":8,"global/document":2,"x-is-array":4}],10:[function(require,module,exports){var isWidget=require("../vnode/is-widget.js");module.exports=updateWidget;function updateWidget(a,b){if(isWidget(a)&&isWidget(b)){if("name"in a&&"name"in b){return a.id===b.id}else{return a.init===b.init}}return false}},{"../vnode/is-widget.js":16}],11:[function(require,module,exports){var isVNode=require("./is-vnode");var isVText=require("./is-vtext");var isWidget=require("./is-widget");var isThunk=require("./is-thunk");module.exports=handleThunk;function handleThunk(a,b){var renderedA=a;var renderedB=b;if(isThunk(b)){renderedB=renderThunk(b,a)}if(isThunk(a)){renderedA=renderThunk(a,null)}return{a:renderedA,b:renderedB}}function renderThunk(thunk,previous){var renderedThunk=thunk.vnode;
if(!renderedThunk){renderedThunk=thunk.vnode=thunk.render(previous)}if(!(isVNode(renderedThunk)||isVText(renderedThunk)||isWidget(renderedThunk))){throw new Error("thunk did not return a valid node")}return renderedThunk}},{"./is-thunk":12,"./is-vnode":14,"./is-vtext":15,"./is-widget":16}],12:[function(require,module,exports){module.exports=isThunk;function isThunk(t){return t&&t.type==="Thunk"}},{}],13:[function(require,module,exports){module.exports=isHook;function isHook(hook){return hook&&(typeof hook.hook==="function"&&!hook.hasOwnProperty("hook")||typeof hook.unhook==="function"&&!hook.hasOwnProperty("unhook"))}},{}],14:[function(require,module,exports){var version=require("./version");module.exports=isVirtualNode;function isVirtualNode(x){return x&&x.type==="VirtualNode"&&x.version===version}},{"./version":17}],15:[function(require,module,exports){var version=require("./version");module.exports=isVirtualText;function isVirtualText(x){return x&&x.type==="VirtualText"&&x.version===version}},{"./version":17}],16:[function(require,module,exports){module.exports=isWidget;function isWidget(w){return w&&w.type==="Widget"}},{}],17:[function(require,module,exports){module.exports="2"},{}],18:[function(require,module,exports){var version=require("./version");VirtualPatch.NONE=0;VirtualPatch.VTEXT=1;VirtualPatch.VNODE=2;VirtualPatch.WIDGET=3;VirtualPatch.PROPS=4;VirtualPatch.ORDER=5;VirtualPatch.INSERT=6;VirtualPatch.REMOVE=7;VirtualPatch.THUNK=8;module.exports=VirtualPatch;function VirtualPatch(type,vNode,patch){this.type=Number(type);this.vNode=vNode;this.patch=patch}VirtualPatch.prototype.version=version;VirtualPatch.prototype.type="VirtualPatch"},{"./version":17}],"virtual-dom/patch":[function(require,module,exports){var patch=require("./vdom/patch.js");module.exports=patch},{"./vdom/patch.js":9}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){},{}],2:[function(require,module,exports){(function(global){var topLevel=typeof global!=="undefined"?global:typeof window!=="undefined"?window:{};var minDoc=require("min-document");if(typeof document!=="undefined"){module.exports=document}else{var doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"];if(!doccy){doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"]=minDoc}module.exports=doccy}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"min-document":1}],3:[function(require,module,exports){"use strict";module.exports=function isObject(x){return typeof x==="object"&&x!==null}},{}],4:[function(require,module,exports){var isObject=require("is-object");var isHook=require("../vnode/is-vhook.js");module.exports=applyProperties;function applyProperties(node,props,previous){for(var propName in props){var propValue=props[propName];if(propValue===undefined){removeProperty(node,propName,propValue,previous)}else if(isHook(propValue)){removeProperty(node,propName,propValue,previous);if(propValue.hook){propValue.hook(node,propName,previous?previous[propName]:undefined)}}else{if(isObject(propValue)){patchObject(node,props,previous,propName,propValue)}else{node[propName]=propValue}}}}function removeProperty(node,propName,propValue,previous){if(previous){var previousValue=previous[propName];if(!isHook(previousValue)){if(propName==="attributes"){for(var attrName in previousValue){node.removeAttribute(attrName)}}else if(propName==="style"){for(var i in previousValue){node.style[i]=""}}else if(typeof previousValue==="string"){node[propName]=""}else{node[propName]=null}}else if(previousValue.unhook){previousValue.unhook(node,propName,propValue)}}}function patchObject(node,props,previous,propName,propValue){var previousValue=previous?previous[propName]:undefined;if(propName==="attributes"){for(var attrName in propValue){var attrValue=propValue[attrName];if(attrValue===undefined){node.removeAttribute(attrName)}else{node.setAttribute(attrName,attrValue)}}return}if(previousValue&&isObject(previousValue)&&getPrototype(previousValue)!==getPrototype(propValue)){node[propName]=propValue;return}if(!isObject(node[propName])){node[propName]={}}var replacer=propName==="style"?"":undefined;for(var k in propValue){var value=propValue[k];node[propName][k]=value===undefined?replacer:value}}function getPrototype(value){if(Object.getPrototypeOf){return Object.getPrototypeOf(value)}else if(value.__proto__){return value.__proto__}else if(value.constructor){return value.constructor.prototype}}},{"../vnode/is-vhook.js":8,"is-object":3}],5:[function(require,module,exports){var document=require("global/document");var applyProperties=require("./apply-properties");var isVNode=require("../vnode/is-vnode.js");var isVText=require("../vnode/is-vtext.js");var isWidget=require("../vnode/is-widget.js");var handleThunk=require("../vnode/handle-thunk.js");module.exports=createElement;function createElement(vnode,opts){var doc=opts?opts.document||document:document;var warn=opts?opts.warn:null;vnode=handleThunk(vnode).a;if(isWidget(vnode)){return vnode.init()}else if(isVText(vnode)){return doc.createTextNode(vnode.text)}else if(!isVNode(vnode)){if(warn){warn("Item is not a valid virtual dom node",vnode)}return null}var node=vnode.namespace===null?doc.createElement(vnode.tagName):doc.createElementNS(vnode.namespace,vnode.tagName);var props=vnode.properties;applyProperties(node,props);var children=vnode.children;for(var i=0;i<children.length;i++){var childNode=createElement(children[i],opts);if(childNode){node.appendChild(childNode)}}return node}},{"../vnode/handle-thunk.js":6,"../vnode/is-vnode.js":9,"../vnode/is-vtext.js":10,"../vnode/is-widget.js":11,"./apply-properties":4,"global/document":2}],6:[function(require,module,exports){var isVNode=require("./is-vnode");var isVText=require("./is-vtext");var isWidget=require("./is-widget");var isThunk=require("./is-thunk");module.exports=handleThunk;function handleThunk(a,b){var renderedA=a;var renderedB=b;if(isThunk(b)){renderedB=renderThunk(b,a)}if(isThunk(a)){renderedA=renderThunk(a,null)}return{a:renderedA,b:renderedB}}function renderThunk(thunk,previous){var renderedThunk=thunk.vnode;if(!renderedThunk){renderedThunk=thunk.vnode=thunk.render(previous)}if(!(isVNode(renderedThunk)||isVText(renderedThunk)||isWidget(renderedThunk))){throw new Error("thunk did not return a valid node")}return renderedThunk}},{"./is-thunk":7,"./is-vnode":9,"./is-vtext":10,"./is-widget":11}],7:[function(require,module,exports){module.exports=isThunk;function isThunk(t){return t&&t.type==="Thunk"}},{}],8:[function(require,module,exports){module.exports=isHook;function isHook(hook){return hook&&(typeof hook.hook==="function"&&!hook.hasOwnProperty("hook")||typeof hook.unhook==="function"&&!hook.hasOwnProperty("unhook"))}},{}],9:[function(require,module,exports){var version=require("./version");module.exports=isVirtualNode;function isVirtualNode(x){return x&&x.type==="VirtualNode"&&x.version===version}},{"./version":12}],10:[function(require,module,exports){var version=require("./version");module.exports=isVirtualText;function isVirtualText(x){return x&&x.type==="VirtualText"&&x.version===version}},{"./version":12}],11:[function(require,module,exports){module.exports=isWidget;function isWidget(w){return w&&w.type==="Widget"}},{}],12:[function(require,module,exports){module.exports="2"},{}],"virtual-dom/create-element":[function(require,module,exports){var createElement=require("./vdom/create-element.js");module.exports=createElement},{"./vdom/create-element.js":5}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var parseArgs=require("./parse-args.js"),Value=require("../types/value.js"),Repo=require("../types/repo.js"),Queue=require("./queue.js"),Process=require("../process/process.js"),processor=require("./processor.js"),routes=require("./routes.js"),defaultProps=require("../defaults/action-props.js"),defaultState=require("../defaults/action-state.js"),calc=require("../utils/calc.js"),utils=require("../utils/utils.js"),styler=require("../routes/css/styler.js"),namespace=function(key,space){return space&&space!==routes.defaultRoute?key+"."+space:key},Action=function(){var self=this;self.values={};defaultProps.scope=this;self.props=new Repo;self.props(defaultState);self.resetProps();self.data=new Repo;self.process=new Process(function(framestamp,frameDuration){if(self.isActive()){processor(self,framestamp,frameDuration)}});self.queue=new Queue;self.output={};self.set(parseArgs.generic.apply(self,arguments))};Action.prototype={play:function(){var props=parseArgs.play.apply(this,arguments);if(!this.isActive()){this.set(props,"to");this.start("play")}return this},set:function(props,defaultProp){var self=this;this.resetProps();this.clearOrder();this.props(props);defaultProp=defaultProp||"current";routes.shard(function(route,routeValues){var preprocessedValues={},valueBase={},value,base={route:route.name};for(var key in routeValues){if(routeValues.hasOwnProperty(key)){value=routeValues[key];if(!utils.isObj(value)){valueBase={name:key};valueBase[defaultProp]=value}else{valueBase=value;valueBase.name=key}valueBase=utils.merge(base,valueBase);if(!route.preprocess){self.setValue(key,valueBase,props,route.name,true)}else{preprocessedValues=route.preprocess(key,valueBase,self,props);for(var subKey in preprocessedValues){self.setValue(subKey,preprocessedValues[subKey],props,route.name,true)}}}}},props);self.resetOrigins();return self},resetOrigins:function(){var values=this.values,key="";for(key in values){if(values.hasOwnProperty(key)){values[key].origin=values[key].current}}},start:function(processType){var input=this.getProp("input");this.resetProgress();if(processType){this.props("rubix",processType)}if(processType!=="track"&&input&&input.stop){input.stop()}this.isActive(true);this.started=utils.currentTime()+this.props("delay");this.framestamp=this.started;this.firstFrame=true;this.process.start();return self},stop:function(){this.queue.clear();this.pause();return this},pause:function(){var self=this,input=this.getProp("input");self.isActive(false);self.process.stop();if(input&&input.stop){input.stop()}return self},resume:function(){var self=this;self.started=utils.currentTime();self.framestamp=self.started;self.isActive(true);self.process.start();return self},reset:function(){var self=this,values=self.values;self.resetProgress();for(var key in values){values[key].reset()}return self},resetProgress:function(){var props=this.props();props.progress=0;props.elapsed=props.playDirection===1?0:props.duration;props.started=utils.currentTime();return this},reverse:function(){var values=this.values,playDirection=this.props("playDirection");this.props("playDirection",playDirection*-1);for(var key in values){if(values.hasOwnProperty(key)){values[key].retarget()}}return this},flip:function(){var values=this.values,props=this.props();props.progress=calc.difference(props.progress,1);props.elapsed=calc.difference(props.elapsed,props.duration);for(var key in values){values[key].flip()}return this},toggle:function(){if(this.isActive()){this.pause()}else{this.resume()}return this},next:function(){var self=this,nexts=[{key:"loop",callback:self.reset},{key:"yoyo",callback:self.reverse},{key:"flip",callback:self.flip}],possibles=nexts.length,hasNext=false;for(var i=0;i<possibles;++i){if(self.checkNextStep(nexts[i].key,nexts[i].callback)){hasNext=true;break}}if(!hasNext&&!self.playNext()){self.stop()}else{self.isActive(true)}return self},checkNextStep:function(key,callback){var COUNT="Count",stepTaken=false,step=this.props(key),count=this.props(key+COUNT),forever=step===true;if(forever||utils.isNum(step)){++count;this.props(key+COUNT,count);if(forever||count<=step){callback.call(this);stepTaken=true}}return stepTaken},playNext:function(){var stepTaken=false,nextInQueue=this.queue.next(this.props("playDirection"));if(utils.isArray(nextInQueue)){this.set(parseArgs.generic.apply(this,nextInQueue),"to").reset();stepTaken=true}return stepTaken},setValue:function(key,value,inherit,space,reset){var existing=this.getValue(key,space);key=namespace(key,space);if(existing){if(reset){existing.resetProps()}existing.set(value,inherit)}else{this.values[key]=new Value(key,value,inherit,this)}return this},getValue:function(key,space){key=namespace(key,space);return this.values[key]},setProp:function(key,value){this.props(key,value);return this},getProp:function(key){return this.props(key)},resetProps:function(){this.props(defaultProps);return this},isActive:function(active){var isActive=active!==undefined?active:this.props("active");this.props("active",isActive);return isActive},updateOrder:function(key,moveToBack,orderName){var props=this.props(),pos,order;orderName=orderName||"order";order=props[orderName]=props[orderName]||[];pos=order.indexOf(key);if(pos===-1||moveToBack){order.push(key);if(pos!==-1){order.splice(pos,1)}}},clearOrder:function(){this.props("order",[])},style:function(name,props){var elementIsDefined=arguments.length===2,dom,returnVal;props=elementIsDefined?props:name;name=elementIsDefined?name:"dom";dom=this.props(name);if(dom){returnVal=styler(dom,props)}return returnVal===false?this:returnVal}};module.exports=Action},{"../defaults/action-props.js":11,"../defaults/action-state.js":12,"../process/process.js":19,"../routes/css/styler.js":32,"../types/repo.js":44,"../types/value.js":45,"../utils/calc.js":46,"../utils/utils.js":51,"./parse-args.js":2,"./processor.js":4,"./queue.js":5,"./routes.js":6}],2:[function(require,module,exports){"use strict";var utils=require("../utils/utils.js"),presets=require("./presets.js"),Pointer=require("../input/pointer.js"),STRING="string",NUMBER="number",OBJECT="object",generic=function(){var props={},playlist=[],base=arguments[0],override=arguments[1],playlistLength=0,argsAsArray=[].slice.call(arguments),i=1;if(typeof base==STRING){playlist=base.split(" ");playlistLength=playlist.length;props=presets.getDefined(playlist[0]);if(playlistLength>1){for(;i<playlistLength;i++){argsAsArray.shift();argsAsArray.unshift(playlist[i]);this.queue.add.apply(this.queue,argsAsArray)}}if(typeof override==OBJECT){props=utils.merge(props,override)}}else if(typeof base==OBJECT){props=base;if(this.isActive()){this.queue.add.apply(this.queue,argsAsArray)}}props.playDirection=1;return props};module.exports={play:function(){var props=generic.apply(this,arguments),argsLength=arguments.length,i=0,arg,typeofArg="";props.loopCount=props.yoyoCount=props.flipCount=0;for(;i<argsLength;i++){arg=arguments[i];typeofArg=typeof arg;if(typeofArg==STRING&&i!==0){props.ease=arg}else if(typeofArg==NUMBER){props.duration=arg}else if(utils.isFunc(arg)){props.onEnd=arg}}return props},track:function(){var props={},argsLength=arguments.length,inputIndex=argsLength-1,input=arguments[inputIndex];for(var i=0;i<inputIndex;i++){if(typeof arguments[i]===STRING){props=presets.getDefined(arguments[i])}else{props=utils.merge(props,arguments[i])}}input=!input.current?new Pointer(input):input;props.input=input;if(!props.inputOrigin){props.inputOrigin=input.get()}return props},generic:generic}},{"../input/pointer.js":16,"../utils/utils.js":51,"./presets.js":3}],3:[function(require,module,exports){"use strict";var utils=require("../utils/utils.js"),generateKeys=function(key){var keys=key.split(DOT),keysLength=keys.length,lastKey=keys[0],i=1;for(;i<keysLength;i++){keys[i]=lastKey+=DOT+keys[i]}return keys},presetStore={},DOT=".",Presets=function(){};Presets.prototype={add:function(name,preset){var presets={},key="";if(utils.isObj(name)){presets=name}else{presets[name]=preset}for(key in presets){if(presets.hasOwnProperty(key)){presetStore[key]=presets[key]}}},getDefined:function(key){var props={},thisProp={},keys=generateKeys(key),keysLength=keys.length,i=0;for(;i<keysLength;i++){thisProp=presetStore[keys[i]];if(thisProp){props=utils.merge(props,thisProp)}}return props}};module.exports=new Presets},{"../utils/utils.js":51}],4:[function(require,module,exports){"use strict";var Rubix=require("../core/rubix.js"),routes=require("./routes.js"),calc=require("../utils/calc.js");module.exports=function(action,framestamp,frameDuration){var props=action.props(),data=action.data(),values=action.values,rubix=Rubix[props.rubix],valueRubix=rubix,hasChanged=false,defaultRoute=routes.getName(),i=0,order=props.order=props.order||[],orderLength=order.length,key="",value,output;if(rubix.updateInput){rubix.updateInput(action,props,frameDuration)}if(action.firstFrame){routes.onStart(action.output,action,values,props,data);action.firstFrame=false}if(props.input){action.output.input=props.input.onFrame(framestamp)}for(;i<orderLength;i++){key=order[i];value=values[key];valueRubix=rubix;if(value.link){valueRubix=Rubix["link"]}output=valueRubix.process(key,value,values,props,action,frameDuration);if(valueRubix.limit){output=valueRubix.limit(output,value)}if(value.round){output=Math.round(output)}value.frameChange=calc.difference(value.current,output);if(!valueRubix.calculatesVelocity){value.velocity=calc.speedPerSecond(value.frameChange,frameDuration)}value.speed=Math.abs(value.velocity);if(value.current!=output){hasChanged=true}value.current=output;action.output[value.route]=action.output[value.route]||{};action.output[defaultRoute]=action.output[defaultRoute]||{};action.output[defaultRoute][key]=action.output[value.route][value.name]=value.unit?output+value.unit:output}routes.shard(function(route,output){if(route.onFrame){route.onFrame(output,action,values,props,data)}if(hasChanged&&route.onChange){route.onChange(output,action,values,props,data)}},action.output);if(rubix.hasEnded(action,hasChanged)){action.isActive(false);routes.onEnd(action.output,action,values,props,data);if(!action.isActive()&&props.rubix==="play"){action.next()}}action.framestamp=framestamp}},{"../core/rubix.js":9,"../utils/calc.js":46,"./routes.js":6}],5:[function(require,module,exports){"use strict";var Queue=function(){this.clear()};Queue.prototype={add:function(){this.queue.push([].slice.call(arguments))},next:function(direction){var queue=this.queue,returnVal=false,index=this.index;direction=arguments.length?direction:1;if(index>=0&&index<queue.length){returnVal=queue[index];this.index=index+direction}else{this.clear()}return returnVal},clear:function(){this.queue=[];this.index=0}};module.exports=Queue},{}],6:[function(require,module,exports){"use strict";var routes=require("../core/routes.js"),routeKeys=[],numRoutes,processes=["preprocess","onStart","onEnd"],has=function(name){return routeKeys.indexOf(name)>-1?true:false},process=function(processName){return function(sourceValues,action,values,props,data){var routeName="",route,i=0;for(;i<numRoutes;i++){routeName=routeKeys[i];route=routes[routeName];if(route.makeDefault||route[processName]&&props[processName]){route[processName](sourceValues[routeName],action,values,props,data)}}}},manager={add:function(name,route){routeKeys.push(name);numRoutes=routeKeys.length;if(route.makeDefault){this.defaultRoute=name}route.name=name;routes[name]=route;return this},shard:function(callback,props){var key="",i=0;for(;i<numRoutes;i++){key=routeKeys[i];if(props&&props[key]||!props){callback(routes[key],props[key])}}},getName:function(name){return name!==undefined&&has(name)?name:this.defaultRoute}};(function(){var processesLength=processes.length,processName="",i=0;for(;i<processesLength;i++){processName=processes[i];manager[processName]=process(processName)}})();module.exports=manager},{"../core/routes.js":8}],7:[function(require,module,exports){"use strict";var simulations=require("../core/simulations.js");module.exports=function(simulation,value,duration,started){var velocity=simulations[simulation](value,duration,started);return Math.abs(velocity)>=value.stopSpeed?velocity:0}},{"../core/simulations.js":10}],8:[function(require,module,exports){module.exports={}},{}],9:[function(require,module,exports){module.exports={}},{}],10:[function(require,module,exports){"use strict";var calc=require("../utils/calc.js"),utils=require("../utils/utils.js"),speedPerFrame=calc.speedPerFrame;module.exports={velocity:function(value,duration){return value.velocity-speedPerFrame(value.deceleration,duration)+speedPerFrame(value.acceleration,duration)},glide:function(value,duration,started){var timeUntilFinished=-utils.currentTime()-started,delta=-value.to*Math.exp(timeUntilFinished/value.timeConstant);return value.to+delta-value.current},friction:function(value,duration){var newVelocity=speedPerFrame(value.velocity,duration)*(1-value.friction);return calc.speedPerSecond(newVelocity,duration)},spring:function(value,duration){var distance=value.to-value.current;value.velocity+=distance*speedPerFrame(value.spring,duration);return this.friction(value,duration)},bounce:function(value){var distance=0,to=value.to,current=value.current,bounce=value.bounce;if(value.simulate==="glide"){distance=to-current;value.to=current-distance*bounce}return value.velocity*=-bounce},capture:function(value,target){value.to=target;value.simulate="spring";value.capture=value.min=value.max=undefined}}},{"../utils/calc.js":46,"../utils/utils.js":51}],11:[function(require,module,exports){module.exports={rubix:"play",amp:1,escapeAmp:0,delay:0,duration:400,ease:"easeInOut",dilate:1,maxInactiveFrames:3,loop:false,yoyo:false,flip:false,onStart:undefined,onChange:undefined,onFrame:undefined,onEnd:undefined}},{}],12:[function(require,module,exports){module.exports={active:false,progress:0,elapsed:0,inactiveFrames:0,playDirection:1,flipCount:0,loopCount:0,yoyoCount:0}},{}],13:[function(require,module,exports){module.exports={to:undefined,min:undefined,max:undefined,origin:0,hasRange:false,round:false,route:"values",name:"",unit:undefined,parent:"",unitName:"",link:undefined,mapLink:undefined,mapTo:undefined,simulate:"velocity",deceleration:0,acceleration:0,bounce:0,spring:80,timeConstant:395,stopSpeed:10,capture:false,friction:.05,duration:400,delay:0,stagger:0,ease:"easeInOut",steps:0,stepDirection:"end",escapeAmp:0}},{}],14:[function(require,module,exports){module.exports={current:0,speed:0,velocity:0,frameChange:0}},{}],15:[function(require,module,exports){"use strict";var calc=require("../utils/calc.js"),utils=require("../utils/utils.js"),History=require("../utils/history.js"),Input=function(){var pollPos=arguments.length-1;this.current={};this.offset={};this.velocity={};this.history=new History;this.update(arguments[0],arguments[1]);if(utils.isFunc(arguments[pollPos])){this.poll=arguments[pollPos]}};Input.prototype={maxInactiveFrames:2,inactiveFrames:0,get:function(prop){var latest=this.history.get(),val=prop!==undefined?latest[prop]:latest;return val},update:function(arg0,arg1){var values={};if(utils.isNum(arg1)){values[arg0]=arg1}else{values=arg0}this.history.add(utils.merge(this.current,values));return this},onFrame:function(timestamp){var latest,hasChanged;if(timestamp===this.lastFrame){return}latest=this.poll?this.poll():this.history.get();hasChanged=utils.hasChanged(this.current,latest);if(hasChanged){this.velocity=calc.offset(this.current,latest);this.current=latest;this.inactiveFrames=0}else if(this.inactiveFrames>=this.maxInactiveFrames){this.velocity=calc.offset(this.current,this.current)}else{this.inactiveFrames++}this.lastFrame=timestamp;return this}};module.exports=Input},{"../utils/calc.js":46,"../utils/history.js":48,"../utils/utils.js":51}],16:[function(require,module,exports){"use strict";var Input=require("./input.js"),currentPointer,TOUCHMOVE="touchmove",MOUSEMOVE="mousemove",eventToPoint=function(event,isTouchEvent){var touchChanged=isTouchEvent?event.changedTouches[0]:false;return{x:touchChanged?touchChanged.clientX:event.pageX,y:touchChanged?touchChanged.clientY:event.pageY}},getActualEvent=function(event){return event.originalEvent||event},Pointer=function(e){var event=getActualEvent(e),isTouch=event.touches?true:false,startPoint=eventToPoint(event,isTouch);this.update(startPoint);this.isTouch=isTouch;this.bindEvents()},proto=Pointer.prototype=new Input;proto.bindEvents=function(){this.moveEvent=this.isTouch?TOUCHMOVE:MOUSEMOVE;currentPointer=this;document.documentElement.addEventListener(this.moveEvent,this.onMove)};proto.unbindEvents=function(){document.documentElement.removeEventListener(this.moveEvent,this.onMove)};proto.onMove=function(e){var newPoint=eventToPoint(e,currentPointer.isTouch);e=getActualEvent(e);e.preventDefault();currentPointer.update(newPoint)};proto.stop=function(){this.unbindEvents()};module.exports=Pointer},{"./input.js":15}],17:[function(require,module,exports){"use strict";var Timer=require("./timer.js"),Loop=function(){this.timer=new Timer};Loop.prototype={isRunning:false,frame:function(){var self=this;requestAnimationFrame(function(){var framestamp=self.timer.update(),isActive=self.callback.call(self.scope,framestamp,self.timer.getElapsed());if(isActive){self.frame(true)}else{self.stop()}})},start:function(){if(!this.isRunning){this.timer.clock();this.isRunning=true;this.frame()}},stop:function(){this.isRunning=false},setCallback:function(scope,callback){this.scope=scope;this.callback=callback}};module.exports=new Loop},{"./timer.js":20}],18:[function(require,module,exports){"use strict";var theLoop=require("./loop.js"),ProcessManager=function(){this.all={};this.active=[];this.deactivateQueue=[];theLoop.setCallback(this,this.fireActive)};ProcessManager.prototype={processCounter:0,activeCount:0,getProcess:function(i){return this.all[i]},getActiveCount:function(){return this.activeCount},getActive:function(){return this.active},getQueueLength:function(){return this.deactivateQueue.length},fireActive:function(framestamp,elapsed){var process,activeCount=0,activeProcesses=[];this.purge();activeCount=this.getActiveCount();activeProcesses=this.getActive();for(var i=0;i<activeCount;i++){process=this.getProcess(activeProcesses[i]);if(process){process.fire(framestamp,elapsed)}}this.purge();activeCount=this.getActiveCount();return activeCount?true:false},register:function(process){var id=this.processCounter;this.all[id]=process;this.processCounter++;return id},activate:function(i){var queueIndex=this.deactivateQueue.indexOf(i),isQueued=queueIndex>-1,isActive=this.active.indexOf(i)>-1;if(isQueued){this.deactivateQueue.splice(queueIndex,1)}if(!isActive){this.active.push(i);this.activeCount++;theLoop.start(this)}},deactivate:function(i){this.deactivateQueue.push(i)},purge:function(){var activeIndex,queueLength=this.getQueueLength();while(queueLength--){activeIndex=this.active.indexOf(this.deactivateQueue[queueLength]);if(activeIndex>-1){this.active.splice(activeIndex,1);this.activeCount--}}this.deactivateQueue=[]},kill:function(id){delete this.all[id]}};module.exports=new ProcessManager},{"./loop.js":17}],19:[function(require,module,exports){"use strict";var manager=require("./manager.js"),Process=function(arg0,arg1){var hasScope=arg1!==undefined,callback=hasScope?arg1:arg0,scope=hasScope?arg0:this;this.setCallback(callback);this.setScope(scope);this.setId(manager.register(this))};Process.prototype={isActive:false,isKilled:false,fire:function(timestamp,elapsed){if(this.isActive){this.callback.call(this.scope,timestamp,elapsed)}if(this.isInterval){this.deactivate()}return this},setCallback:function(callback){this.callback=callback;return this},setScope:function(scope){this.scope=scope;return this},start:function(duration){var self=this;self.reset();self.activate();if(duration){self.stopTimer=setTimeout(function(){self.stop()},duration)}return self},stop:function(){this.reset();this.deactivate();return this},activate:function(){if(!this.isKilled){this.isActive=true;manager.activate(this.id)}return this},deactivate:function(){this.isActive=false;manager.deactivate(this.id);return this},every:function(interval){var self=this;self.reset();self.isInterval=true;self.intervalTimer=setInterval(function(){self.activate()},interval);return this},reset:function(){this.isInterval=false;clearTimeout(this.stopTimer);clearInterval(this.intervalTimer);return this},kill:function(){this.stop();this.isKilled=true;manager.kill(this.id)},setId:function(id){this.id=id;return this}};module.exports=Process},{"./manager.js":18}],20:[function(require,module,exports){"use strict";var utils=require("../utils/utils.js"),maxElapsed=33,Timer=function(){this.elapsed=16.7;this.current=utils.currentTime();this.update()};Timer.prototype={update:function(){this.prev=this.current;this.current=utils.currentTime();this.elapsed=Math.min(this.current-this.prev,maxElapsed);return this.current},getElapsed:function(){return this.elapsed},clock:function(){this.current=utils.currentTime()}};module.exports=Timer},{"../utils/utils.js":51}],21:[function(require,module,exports){"use strict";var Action=require("./action/action.js"),Input=require("./input/input.js"),Process=require("./process/process.js"),presets=require("./action/presets.js"),easing=require("./utils/easing.js"),calc=require("./utils/calc.js"),utils=require("./utils/utils.js"),route=require("./action/routes.js"),registerRubix=require("./register/register-rubix.js"),registerSimulation=require("./register/register-simulation.js");module.exports={newAction:function(){return new Action(arguments[0],arguments[1])},newInput:function(){return new Input(arguments[0],arguments[1])},newProcess:function(){return new Process(arguments[0],arguments[1])},addPreset:function(){presets.add.apply(presets,arguments);return this},addBezier:function(){easing.add.apply(easing,arguments);return this},addRoute:function(){route.add.apply(route,arguments);return this},addSimulation:function(){registerSimulation.apply(this,arguments);return this},addRubix:function(){registerRubix.apply(this,arguments);return this},calc:calc,utils:utils}},{"./action/action.js":1,"./action/presets.js":3,"./action/routes.js":6,"./input/input.js":15,"./process/process.js":19,"./register/register-rubix.js":22,"./register/register-simulation.js":23,"./utils/calc.js":46,"./utils/easing.js":47,"./utils/utils.js":51}],22:[function(require,module,exports){"use strict";var actionPrototype=require("../action/action.js").prototype,parseArgs=require("../action/parse-args.js"),rubix=require("../core/rubix.js");module.exports=function(name,newRubix){var parser=parseArgs[name]||parseArgs.generic;if(!newRubix.surpressMethod&&!actionPrototype[name]){actionPrototype[name]=function(){this.set(parser.apply(this,arguments));return this.start(name)}}rubix[name]=newRubix}},{"../action/action.js":1,"../action/parse-args.js":2,"../core/rubix.js":9}],23:[function(require,module,exports){"use strict";var simulations=require("../core/simulations.js");module.exports=function(name,simulation){simulations[name]=simulation}},{"../core/simulations.js":10}],24:[function(require,module,exports){"use strict";module.exports={onChange:function(output,action,values,props){var dom=props.dom;if(dom){for(var key in output){dom.setAttribute(key,output[key])}}}}},{}],25:[function(require,module,exports){"use strict";var build=require("./css/build.js"),split=require("./css/split.js"),css="css",cssOrder=css+"Order",cssCache=css+"Cache";module.exports={preprocess:function(key,value,action){var values=split(key,value);action.updateOrder(key,false,cssOrder);return values},onChange:function(output,action,values,props){
props[cssCache]=props[cssCache]||{};action.style(build(output,props[cssOrder],props[cssCache],values))}}},{"./css/build.js":26,"./css/split.js":30}],26:[function(require,module,exports){"use strict";var dictionary=require("./dictionary.js"),templates=require("./templates.js"),lookup=require("./lookup.js"),TRANSFORM="transform",TRANSLATE_Z="translateZ",generateRule=function(key,output,transformProp){var templateKey=transformProp?TRANSFORM:lookup[key],template=templates[templateKey];return template?template(key,output):output[key]};module.exports=function(output,order,cache){var css={},numRules=order.length,hasZ=false,transformProp=dictionary.transformProps,i=0,rule="",key="",transform="";for(;i<numRules;i++){key=order[i],rule=generateRule(key,output,transformProp[key]);if(transformProp[key]){transform+=rule+" ";hasZ=key===TRANSLATE_Z?true:hasZ}else if(cache[key]!==rule){css[key]=rule;cache[key]=rule}}if(transform!=""&&transform!=cache[TRANSFORM]){if(!hasZ){transform+=" "+TRANSLATE_Z+"(0px)"}css[TRANSFORM]=cache[TRANSFORM]=transform}return css}},{"./dictionary.js":28,"./lookup.js":29,"./templates.js":33}],27:[function(require,module,exports){"use strict";var color={min:0,max:255,round:true},opacity={min:0,max:1},angle={unit:"deg"},scale={},defaults={base:{unit:"px"},color:color,Red:color,Green:color,Blue:color,Alpha:opacity,opacity:opacity,scale:scale,scaleX:scale,scaleY:scale,scaleZ:scale,skew:angle,skewX:angle,skewY:angle,rotate:angle,rotateX:angle,rotateY:angle,rotateZ:angle};module.exports=defaults},{}],28:[function(require,module,exports){"use strict";var X="X",Y="Y",TRANSFORM_PERSPECTIVE="transformPerspective",SCALE="scale",ROTATE="rotate",terms={colors:["Red","Green","Blue","Alpha"],positions:[X,Y,"Z"],dimensions:["Top","Right","Bottom","Left"],shadow:[X,Y,"Radius","Spread","Color"],valueProps:["current","to","start","min","max"],transformFuncs:["translate",SCALE,ROTATE,"skew",TRANSFORM_PERSPECTIVE],transformProps:{}};(function(){var transformFuncs=terms.transformFuncs,transformProps=terms.transformProps,numOfTransformFuncs=transformFuncs.length,i=0,createProps=function(funcName){var typeTerms=terms.positions,j=0;if(typeTerms){for(;j<typeTerms.length;j++){transformProps[funcName+typeTerms[j]]=true}}};transformProps[ROTATE]=transformProps[SCALE]=transformProps[TRANSFORM_PERSPECTIVE]=true;for(;i<numOfTransformFuncs;i++){createProps(transformFuncs[i])}})();module.exports=terms},{}],29:[function(require,module,exports){"use strict";var COLOR="colors",POSITIONS="positions",TRANSFORM="transform",DIMENSIONS="dimensions",SHADOW="shadow";module.exports={color:COLOR,backgroundColor:COLOR,borderColor:COLOR,borderTopColor:COLOR,borderRightColor:COLOR,borderBottomColor:COLOR,borderLeftColor:COLOR,outlineColor:COLOR,fill:COLOR,stroke:COLOR,margin:DIMENSIONS,padding:DIMENSIONS,backgroundPosition:POSITIONS,perspectiveOrigin:POSITIONS,transformOrigin:POSITIONS,skew:TRANSFORM,translate:TRANSFORM,rotate:TRANSFORM,scale:TRANSFORM,textShadow:SHADOW,boxShadow:SHADOW}},{}],30:[function(require,module,exports){"use strict";var defaultProperty=require("./default-property.js"),dictionary=require("./dictionary.js"),splitLookup=require("./lookup.js"),splitters=require("./splitters.js"),utils=require("../../utils/utils.js"),valueProperties=dictionary.valueProps,valuePropertyCount=valueProperties.length,buildProperty=function(value,parentKey,unitKey,parent,assignDefault){var property=defaultProperty[parentKey+unitKey]||defaultProperty[unitKey]||defaultProperty[parentKey]||defaultProperty.base;assignDefault=assignDefault||valueProperties[0];if(parent){property=utils.merge(parent,property)}if(utils.isObj(value)){property=utils.merge(property,value)}else{property[assignDefault]=value}property.name=unitKey?parentKey+unitKey:parentKey;return property},split=function(key,value,splitter){var splitValue={},splitProperty={},newValue={},valueKey="",unitKey="",i=0;if(utils.isObj(value)){for(;i<valuePropertyCount;i++){valueKey=valueProperties[i];if(value.hasOwnProperty(valueKey)){splitProperty=splitter(value[valueKey]);for(unitKey in splitProperty){splitValue[unitKey]=splitValue[unitKey]||{};splitValue[unitKey][valueKey]=splitProperty[unitKey]}}}}else{splitValue=splitter(value)}for(unitKey in splitValue){newValue[key+unitKey]=buildProperty(splitValue[unitKey],key,unitKey,value)}return newValue};module.exports=function(key,value){var splitterID=splitLookup[key],splitter=splitters[splitterID],values=splitter?split(key,value,splitter):{};if(!splitter){values[key]=buildProperty(value,key)}return values}},{"../../utils/utils.js":51,"./default-property.js":27,"./dictionary.js":28,"./lookup.js":29,"./splitters.js":31}],31:[function(require,module,exports){"use strict";var dictionary=require("./dictionary.js"),utils=require("../../utils/utils.js"),splitCommaDelimited=function(value){return utils.isString(value)?value.split(/,\s*/):[value]},splitSpaceDelimited=function(value){return utils.isString(value)?value.split(" "):[value]},functionBreak=function(value){return value.substring(value.indexOf("(")+1,value.lastIndexOf(")"))},hex=function(prop){var r,g,b;if(prop.length>4){r=prop.substr(1,2);g=prop.substr(3,2);b=prop.substr(5,2)}else{r=prop.substr(1,1);g=prop.substr(2,1);b=prop.substr(3,1);r+=r;g+=g;b+=b}return[parseInt(r,16),parseInt(g,16),parseInt(b,16),1]},isColor=function(prop){return prop.indexOf("#")>-1||prop.indexOf("rgb")>-1},splitters={array:function(prop){var list=prop.indexOf(",")>-1?splitCommaDelimited(prop):splitSpaceDelimited(prop),listLength=list.length,i=0,arrayProps={};for(;i<listLength;i++){arrayProps[i]=list[i]}return arrayProps},colors:function(prop){var colors=prop.indexOf("#")>-1?hex(prop):splitCommaDelimited(functionBreak(prop)),numColors=colors.length,terms=dictionary.colors,i=0,rgba={};for(;i<numColors;i++){rgba[terms[i]]=colors[i]}return rgba},dimensions:function(prop){var dimensions=splitSpaceDelimited(prop),numDimensions=dimensions.length,terms=dictionary.dimensions,jumpBack=numDimensions!==1?2:1,i,j=i=0,dimensionProps={};for(;i<4;i++){dimensionProps[terms[i]]=dimensions[j];j++;j=j===numDimensions?j-jumpBack:j}return dimensionProps},positions:function(prop){var positions=splitSpaceDelimited(prop),numPositions=positions.length,positionProps={X:positions[0],Y:numPositions>1?positions[1]:positions[0]};if(numPositions>2){positionProps.Z=positions[2]}return positionProps},shadow:function(prop){var bits=splitSpaceDelimited(prop),bitsLength=bits.length,terms=dictionary.shadow,reachedColor,colorProp="",bit,color,i=0,unit,shadowProps={};for(;i<bitsLength;i++){bit=bits[i];if(reachedColor||isColor(bit)){reachedColor=true;colorProp+=bit}else{shadowProps[terms[i]]=bit}}color=splitters.colors(colorProp);for(var unit in color){shadowProps[unit]=color[unit]}return shadowProps},perspective:function(prop){return this.array(prop)}};module.exports=splitters},{"../../utils/utils.js":51,"./dictionary.js":28}],32:[function(require,module,exports){"use strict";var cssStyler=function(){var testElement,prefixes=["Webkit","Moz","O","ms",""],prefixesLength=prefixes.length,cache={},testPrefix=function(key){cache[key]=key;for(var i=0;i<prefixesLength;i++){var prefixed=prefixes[i]+key.charAt(0).toUpperCase()+key.slice(1);if(testElement.style.hasOwnProperty(prefixed)){cache[key]=prefixed}}return cache[key]};return function(element,prop){testElement=testElement||document.getElementsByTagName("body")[0];if(typeof prop==="string"){return window.getComputedStyle(element,null)[cache[prop]||testPrefix(prop)]}else{for(var key in prop){if(prop.hasOwnProperty(key)){element.style[cache[key]||testPrefix(key)]=prop[key]}}return false}}};module.exports=new cssStyler},{}],33:[function(require,module,exports){"use strict";var dictionary=require("./dictionary.js"),defaultValues={Alpha:1},functionCreate=function(value,prefix){return prefix+"("+value+")"},createSpaceDelimited=function(key,object,terms){return createDelimitedString(key,object,terms," ")},createCommaDelimited=function(key,object,terms){return createDelimitedString(key,object,terms,", ").slice(0,-2)},createDelimitedString=function(key,object,terms,delimiter){var string="",propKey="",termsLength=terms.length;for(var i=0;i<termsLength;i++){propKey=key+terms[i];if(object[propKey]!==undefined){string+=object[propKey]}else{if(defaultValues[terms[i]]!==undefined){string+=defaultValues[terms[i]]}}string+=delimiter}return string},templates={colors:function(key,values){return functionCreate(createCommaDelimited(key,values,dictionary.colors),"rgba")},dimensions:function(key,values){return createSpaceDelimited(key,values,dictionary.dimensions)},positions:function(key,values){return createSpaceDelimited(key,values,dictionary.positions)},shadow:function(key,values){var shadowTerms=dictionary.shadow.slice(0,4);return createSpaceDelimited(key,values,shadowTerms)+templates.colors(key,values)},transform:function(key,values){return key+"("+values[key]+")"}};module.exports=templates},{"./dictionary.js":28}],34:[function(require,module,exports){"use strict";var createStyles=require("./path/builder.js");module.exports={onStart:function(output,action,values,props){if(props.dom){props.pathLength=props.dom.getTotalLength()}},onChange:function(output,action,values,props){action.style(createStyles(output,props.pathLength))}}},{"./path/builder.js":35}],35:[function(require,module,exports){"use strict";var lookup=require("./lookup.js"),percentToPixels=function(percentage,length){return parseFloat(percentage)/100*length+"px"};module.exports=function(props,pathLength){var hasArray=false,svgProperty="",arrayStyles={length:0,spacing:pathLength+"px"},pathStyles={};for(var key in props){if(props.hasOwnProperty(key)){svgProperty=lookup[key];switch(key){case"length":case"spacing":hasArray=true;arrayStyles[key]=percentToPixels(props[key],pathLength);break;case"offset":pathStyles[svgProperty]=percentToPixels(-props[key],pathLength);break;default:pathStyles[svgProperty]=props[key]}}}if(hasArray){pathStyles[lookup.length]=arrayStyles.length+" "+arrayStyles.spacing}return pathStyles}},{"./lookup.js":36}],36:[function(require,module,exports){var STROKE="stroke",DASH=STROKE+"-dash",DASH_ARRAY=DASH+"array";module.exports={opacity:STROKE+"-opacity",width:STROKE+"-width",offset:DASH+"offset",length:DASH_ARRAY,spacing:DASH_ARRAY,miterlimit:STROKE+"-miterlimit"}},{}],37:[function(require,module,exports){"use strict";var fireCallback=function(name,bucket,action,values,props,data){if(props[name]){props[name].call(props.scope,bucket,data)}};module.exports={makeDefault:true,onStart:function(action,values,props,data){if(props.start){props.start.call(props.scope,data)}},onFrame:function(bucket,action,values,props,data){fireCallback("onFrame",bucket,action,values,props,data)},onChange:function(bucket,action,values,props,data){fireCallback("onChange",bucket,action,values,props,data)},onEnd:function(bucket,action,values,props,data){fireCallback("onEnd",bucket,action,values,props,data)}}},{}],38:[function(require,module,exports){"use strict";module.exports={process:function(key,value){return value.current},hasEnded:function(){return true}}},{}],39:[function(require,module,exports){"use strict";var calc=require("../utils/calc.js"),STRING="string",findMappedValue=function(newValue,linkedValue,toValue,mapLink,mapTo){var mapLength=mapLink.length,i=1,lastLinkValue,thisLinkValue,lastToValue,thisToValue;for(;i<mapLength;i++){lastLinkValue=typeof mapLink[i-1]===STRING?linkedValue[mapLink[i-1]]:mapLink[i-1];thisLinkValue=typeof mapLink[i]===STRING?linkedValue[mapLink[i]]:mapLink[i];lastToValue=typeof mapTo[i-1]===STRING?toValue[mapTo[i-1]]:mapTo[i-1];thisToValue=typeof mapTo[i]===STRING?toValue[mapTo[i]]:mapTo[i];if(newValue<thisLinkValue||i===mapLength-1){newValue=calc.value(calc.restricted(calc.progress(newValue,lastLinkValue,thisLinkValue),0,1),lastToValue,thisToValue)}}return newValue};module.exports={surpressMethod:true,process:function(key,value,values,props,action){var newValue=value.current,linkKey=value.link,linkedValue=values[linkKey]?values[linkKey]:{},inputOffset=action.inputOffset;if(inputOffset&&inputOffset.hasOwnProperty(linkKey)){newValue=value.origin+inputOffset[linkKey]}else if(linkedValue.current!==undefined&&key!==linkKey){newValue=linkedValue.current}if(value.mapLink&&value.mapTo){newValue=findMappedValue(newValue,linkedValue,value,value.mapLink,value.mapTo)}return newValue},limit:function(output,value){return calc.restricted(output,value.min,value.max)}}},{"../utils/calc.js":46}],40:[function(require,module,exports){"use strict";var calc=require("../utils/calc.js"),easing=require("../utils/easing.js"),utils=require("../utils/utils.js"),CURRENT="current",HAS_ENDED="hasEnded";module.exports={updateInput:function(action,props,frameDuration){props.elapsed+=frameDuration*props.dilate*props.playDirection;action[HAS_ENDED]=true},process:function(key,value,values,props,action){var target=value.to,newValue=value[CURRENT],progress,progressTarget;if(target!==undefined){progress=calc.restricted(calc.progress(props.elapsed-value.delay,value.duration)-value.stagger,0,1);progressTarget=props.playDirection===1?1:0;if(progress!==progressTarget){action[HAS_ENDED]=false}else{value.to=undefined}if(value.steps){progress=utils.stepProgress(progress,value.steps,value.stepDirection)}newValue=easing.withinRange(progress,value.origin,target,value.ease)}return newValue},hasEnded:function(action){return action[HAS_ENDED]}}},{"../utils/calc.js":46,"../utils/easing.js":47,"../utils/utils.js":51}],41:[function(require,module,exports){"use strict";var calc=require("../utils/calc.js"),simulate=require("../action/simulate.js");module.exports={calculatesVelocity:true,process:function(key,value,values,props,action,frameDuration){value.velocity=simulate(value.simulate,value,frameDuration,action.started);return value.current+calc.speedPerFrame(value.velocity,frameDuration)},hasEnded:function(action,hasChanged){var props=action.props();props.inactiveFrames=hasChanged?0:props.inactiveFrames+1;return props.inactiveFrames>props.maxInactiveFrames},limit:function(output,value){var isOutsideMax=output>=value.max,isOutsideMin=output<=value.min,isOutsideRange=isOutsideMax||isOutsideMin;if(isOutsideRange){output=calc.restricted(output,value.min,value.max);if(value.bounce){value.velocity=simulate("bounce",value)}else if(value.capture){simulate("capture",value,isOutsideMax?value.max:value.min)}}return output}}},{"../action/simulate.js":7,"../utils/calc.js":46}],42:[function(require,module,exports){"use strict";var calc=require("../utils/calc.js"),CURRENT="current",INPUT_OFFSET="inputOffset";module.exports={updateInput:function(action,props){action[INPUT_OFFSET]=calc.offset(props.inputOrigin,props.input[CURRENT])},process:function(key,value,values,props,action){return action[INPUT_OFFSET].hasOwnProperty(key)?value.origin+action[INPUT_OFFSET][key]:value[CURRENT]},hasEnded:function(){return false}}},{"../utils/calc.js":46}],43:[function(require,module,exports){(function(global){"use strict";var NEWTON_ITERATIONS=8,NEWTON_MIN_SLOPE=.001,SUBDIVISION_PRECISION=1e-7,SUBDIVISION_MAX_ITERATIONS=10,K_SPLINE_TABLE_SIZE=11,K_SAMPLE_STEP_SIZE=1/(K_SPLINE_TABLE_SIZE-1),FLOAT_32_SUPPORTED="Float32Array"in global,A=function(a1,a2){return 1-3*a2+3*a1},B=function(a1,a2){return 3*a2-6*a1},C=function(a1){return 3*a1},getSlope=function(t,a1,a2){return 3*A(a1,a2)*t*t+2*B(a1,a2)*t+C(a1)},calcBezier=function(t,a1,a2){return((A(a1,a2)*t+B(a1,a2))*t+C(a1))*t},Bezier=function(mX1,mY1,mX2,mY2){var sampleValues=FLOAT_32_SUPPORTED?new Float32Array(K_SPLINE_TABLE_SIZE):new Array(K_SPLINE_TABLE_SIZE),_precomputed=false,binarySubdivide=function(aX,aA,aB){var currentX,currentT,i=0;do{currentT=aA+(aB-aA)/2;currentX=calcBezier(currentT,mX1,mX2)-aX;if(currentX>0){aB=currentT}else{aA=currentT}}while(Math.abs(currentX)>SUBDIVISION_PRECISION&&++i<SUBDIVISION_MAX_ITERATIONS);return currentT},newtonRaphsonIterate=function(aX,aGuessT){var i=0,currentSlope=0,currentX;for(;i<NEWTON_ITERATIONS;++i){currentSlope=getSlope(aGuessT,mX1,mX2);if(currentSlope===0){return aGuessT}currentX=calcBezier(aGuessT,mX1,mX2)-aX;aGuessT-=currentX/currentSlope}return aGuessT},calcSampleValues=function(){for(var i=0;i<K_SPLINE_TABLE_SIZE;++i){sampleValues[i]=calcBezier(i*K_SAMPLE_STEP_SIZE,mX1,mX2)}},getTForX=function(aX){var intervalStart=0,currentSample=1,lastSample=K_SPLINE_TABLE_SIZE-1,dist=0,guessForT=0,initialSlope=0;for(;currentSample!=lastSample&&sampleValues[currentSample]<=aX;++currentSample){intervalStart+=K_SAMPLE_STEP_SIZE}--currentSample;dist=(aX-sampleValues[currentSample])/(sampleValues[currentSample+1]-sampleValues[currentSample]);guessForT=intervalStart+dist*K_SAMPLE_STEP_SIZE;initialSlope=getSlope(guessForT,mX1,mX2);if(initialSlope>=NEWTON_MIN_SLOPE){return newtonRaphsonIterate(aX,guessForT)}else if(initialSlope===0){return guessForT}else{return binarySubdivide(aX,intervalStart,intervalStart+K_SAMPLE_STEP_SIZE)}},precompute=function(){_precomputed=true;if(mX1!=mY1||mX2!=mY2){calcSampleValues()}},f=function(aX){var returnValue;if(!_precomputed){precompute()}if(mX1===mY1&&mX2===mY2){returnValue=aX}else if(aX===0){returnValue=0}else if(aX===1){returnValue=1}else{returnValue=calcBezier(getTForX(aX),mY1,mY2)}return returnValue};return f};module.exports=Bezier}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],44:[function(require,module,exports){"use strict";var utils=require("../utils/utils.js"),get=function(key){return key!==undefined?this[key]:this},set=function(data,prop){var multiArg=arguments.length>1,toSet=multiArg?{}:data,key="";if(multiArg){toSet[data]=prop}for(key in toSet){if(toSet.hasOwnProperty(key)){this[key]=toSet[key]}}},Repo=function(context){var store={};return function(){var argsLength=arguments.length;if(!argsLength||argsLength===1&&utils.isString(arguments[0])){return get.apply(store,arguments)}else{set.apply(store,arguments);return context}}};module.exports=Repo},{"../utils/utils.js":51}],45:[function(require,module,exports){"use strict";var defaultProps=require("../defaults/value-props.js"),defaultState=require("../defaults/value-state.js"),resolve=require("../utils/resolve.js"),utils=require("../utils/utils.js"),CURRENT="current",ORIGIN="origin",FORCE_NUMBER=[CURRENT,ORIGIN,"to","start"],parseSetArgs=function(arg0,arg1){var newProps={};if(arguments.length===1){newProps[CURRENT]=arg0}else{newProps[arg0]=arg1}return newProps},Value=function(key,props,inherit,action){this.key=key;this.action=action;this.scope=action.getProp("scope");if(props.start){props.current=props.start}this._set(defaultProps);this._set(defaultState);this.set(props,inherit)};Value.prototype={set:function(){this._set.apply(this,arguments);this.action.updateOrder(this.key,utils.isString(this.link));return this},_set:function(){var multiVal=utils.isObj(arguments[0]),newProps=multiVal?arguments[0]:parseSetArgs.apply(self,arguments),inherit=multiVal?arguments[1]:false,toSet={},key="";if(inherit){for(key in inherit){if(defaultProps.hasOwnProperty(key)){toSet[key]=inherit[key]}}}for(key in newProps){toSet[key]=newProps[key]}for(key in toSet){this[key]=resolve(toSet[key],this[key],this,this.scope);if(FORCE_NUMBER.indexOf(key)>-1){this[key]=parseFloat(this[key])}if(key==="to"){this.target=this.to}}this.hasRange=utils.isNum(this.min)&&utils.isNum(this.max)?true:false;return this},reset:function(){this._set("to",this.target);return this._set(CURRENT,this[ORIGIN])},resetProps:function(){this.set(defaultProps)},flip:function(){var newTo=this[ORIGIN],newOrigin=this.target!==undefined?this.target:this[CURRENT];return this.set({to:newTo,origin:newOrigin})},retarget:function(target){target=target!==undefined?target:this.target;return this.set("to",target)}};module.exports=Value},{"../defaults/value-props.js":13,"../defaults/value-state.js":14,"../utils/resolve.js":49,"../utils/utils.js":51}],46:[function(require,module,exports){"use strict";var utils=require("./utils.js"),calc={angle:function(pointA,pointB){var from=pointB?pointA:{x:0,y:0},to=pointB||pointA,point={x:difference(from.x,to.x),y:difference(from.y,to.y)};return this.angleFromCenter(point.x,point.y)},angleFromCenter:function(x,y){return this.radiansToDegrees(Math.atan2(y,x))},degreesToRadians:function(degrees){return degrees*Math.PI/180},difference:function(a,b){return b-a},dilate:function(a,b,dilation){return a+(b-a)*dilation},distance:function(pointA,pointB){return typeof pointA==="number"?this.distance1D(pointA,pointB):this.distance2D(pointA,pointB)},distance1D:function(pointA,pointB){var bIsNum=typeof pointB==="number",from=bIsNum?pointA:0,to=bIsNum?pointB:pointA;return absolute(difference(from,to))},distance2D:function(pointA,pointB){var bIsObj=typeof pointB==="object",from=bIsObj?pointA:{x:0,y:0},to=bIsObj?pointB:pointA,point={x:absolute(difference(from.x,to.x)),y:absolute(difference(from.y,to.y))};return this.hypotenuse(point.x,point.y)},hypotenuse:function(a,b){var a2=a*a,b2=b*b,c2=a2+b2;return Math.sqrt(c2)},offset:function(a,b){var offset={};for(var key in b){if(b.hasOwnProperty(key)){if(a.hasOwnProperty(key)){offset[key]=difference(a[key],b[key])}else{offset[key]=0}}}if(isNum(offset.x)&&isNum(offset.y)){offset.angle=this.angle(a,b);offset.distance=this.distance2D(a,b)}return offset},pointFromAngleAndDistance:function(origin,angle,distance){var point={};point.x=distance*Math.cos(angle)+origin.x;point.y=distance*Math.sin(angle)+origin.y;return point},progress:function(value,limitA,limitB){var bIsNum=typeof limitB==="number",from=bIsNum?limitA:0,to=bIsNum?limitB:limitA,range=difference(from,to),progress=(value-from)/range;return progress},radiansToDegrees:function(radians){return radians*180/Math.PI},random:function(min,max){min=isNum(min)?min:0;max=isNum(max)?max:1;return Math.random()*(max-min)+min},relativeValue:function(current,rel){var newValue=current,equation=rel.split("="),operator=equation[0],splitVal=utils.splitValUnit(equation[1]);switch(operator){case"+":newValue+=splitVal.value;break;case"-":newValue-=splitVal.value;break;case"*":newValue*=splitVal.value;break;case"/":newValue/=splitVal.value;break}if(splitVal.unit){newValue+=splitVal.unit}return newValue},restricted:function(value,min,max){var restricted=min!==undefined?Math.max(value,min):value;restricted=max!==undefined?Math.min(restricted,max):restricted;return restricted},speedPerFrame:function(xps,frameDuration){return isNum(xps)?xps/(1e3/frameDuration):0},speedPerSecond:function(velocity,frameDuration){return velocity*(1e3/frameDuration)},timeRemaining:function(progress,duration){return(1-progress)*duration},value:function(progress,limitA,limitB){var bIsNum=typeof limitB==="number",from=bIsNum?limitA:0,to=bIsNum?limitB:limitA;return-progress*from+progress*to+from},valueEased:function(progress,from,to,easing){var easedProgress=easing(progress);return this.value(easedProgress,from,to)}},isNum=utils.isNum,difference=calc.difference,absolute=Math.abs;module.exports=calc},{"./utils.js":51}],47:[function(require,module,exports){"use strict";var calc=require("./calc.js"),Bezier=require("../types/bezier.js"),INVALID_EASING=": Not defined",EASE_IN="In",EASE_OUT="Out",EASE_IN_OUT=EASE_IN+EASE_OUT,powerEasing=["ease","cubic","quart","quint"],generatePowerEasing=function(power){return function(progress){return Math.pow(progress,power)}},baseEasing={circ:function(progress){return 1-Math.sin(Math.acos(progress))},back:function(progress){var strength=1.5;return progress*progress*((strength+1)*progress-strength)}},mirrorEasing=function(progress,method){return progress<=.5?method(2*progress)/2:(2-method(2*(1-progress)))/2},reverseEasing=function(progress,method){return 1-method(1-progress)},generateVariations=function(name,method,isBaseIn){var easeIn=name+EASE_IN,easeOut=name+EASE_OUT,easeInOut=name+EASE_IN_OUT,baseName=isBaseIn?easeIn:easeOut,reverseName=isBaseIn?easeOut:easeIn;easing[baseName]=method;easing[reverseName]=function(progress){return reverseEasing(progress,easing[baseName])};easing[easeInOut]=function(progress){return mirrorEasing(progress,easing[baseName])}},easing={get:function(name){var easing=this[name];if(!easing){throw name+INVALID_EASING}return easing},add:function(name,x1,y1,x2,y2){if(!this[name]){this[name]=new Bezier(x1,y1,x2,y2)}},withinRange:function(progress,from,to,ease,escapeAmp){var progressLimited=calc.restricted(progress,0,1);if(progressLimited!==progress&&escapeAmp){ease="linear";progressLimited=progressLimited+calc.difference(progressLimited,progress)*escapeAmp}return calc.valueEased(progressLimited,from,to,this.get(ease))},linear:function(progress){return progress}};(function(){var i=0,key="";for(;i<4;i++){baseEasing[powerEasing[i]]=generatePowerEasing(i+2)}for(key in baseEasing){if(baseEasing.hasOwnProperty(key)){generateVariations(key,baseEasing[key],true)}}})();module.exports=easing},{"../types/bezier.js":43,"./calc.js":46}],48:[function(require,module,exports){"use strict";var maxHistorySize=3,History=function(obj,max){this.max=max||maxHistorySize;this.entries=[];this.add(obj)};History.prototype={add:function(obj){var currentSize=this.getSize();this.entries.push(obj);if(currentSize>=this.max){this.entries.shift()}},get:function(i){i=typeof i==="number"?i:this.getSize()-1;return this.entries[i]},getPrevious:function(){return this.get(this.getSize()-2)},getSize:function(){return this.entries.length}};module.exports=History},{}],49:[function(require,module,exports){"use strict";var calc=require("./calc.js"),utils=require("./utils.js");module.exports=function(newValue,currentValue,parent,scope){var splitValueUnit={};currentValue=currentValue||0;if(typeof newValue=="function"){newValue=newValue.call(scope,currentValue)}if(newValue&&newValue.indexOf&&newValue.indexOf("=")>0){newValue=calc.relativeValue(currentValue,newValue)}if(typeof newValue==="string"){splitValueUnit=utils.splitValUnit(newValue);if(!isNaN(splitValueUnit.value)){newValue=splitValueUnit.value;parent.unit=splitValueUnit.unit}}return newValue}},{"./calc.js":46,"./utils.js":51}],50:[function(require,module,exports){"use strict";var lastTime=0,vendors=["ms","moz","webkit","o"],vendorsLength=vendors.length;for(var x=0;x<vendorsLength&&!window.requestAnimationFrame;x++){window.requestAnimationFrame=window[vendors[x]+"RequestAnimationFrame"]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(callback){var currTime=(new Date).getTime(),timeToCall=Math.max(0,16-(currTime-lastTime)),id=window.setTimeout(function(){callback(currTime+timeToCall)},timeToCall);lastTime=currTime+timeToCall;return id}}},{}],51:[function(require,module,exports){"use strict";var protectedProperties=["scope","dom"],isProtected=function(key){return protectedProperties.indexOf(key)!==-1};module.exports={hasChanged:function(a,b){var hasChanged=false,key="";for(key in b){if(a.hasOwnProperty(key)&&b.hasOwnProperty(key)){if(a[key]!==b[key]){hasChanged=true}}else{hasChanged=true}}return hasChanged},isNum:function(num){return typeof num==="number"},isObj:function(obj){return typeof obj==="object"},isFunc:function(obj){return this.varType(obj)==="Function"},isString:function(str){return typeof str==="string"},isRelativeValue:function(value){return value&&value.indexOf&&value.indexOf("=")>0},isArray:function(arr){return this.varType(arr)==="Array"},isInRange:function(value,min,max){return value>=min&&value<=max},copy:function(base){return this.isArray(base)?this.copyArray(base):this.copyObject(base)},copyObject:function(base){var newObject={};for(var key in base){if(base.hasOwnProperty(key)){newObject[key]=this.isObj(base[key])&&!isProtected(key)?this.copy(base[key]):base[key]}}return newObject},copyArray:function(base){var newArray=[],length=base.length,i=0;for(var i=0;i<length;i++){newArray[i]=this.isObj(base[i])?this.copy(base[i]):base[i]}return newArray},merge:function(base,overwrite){return this.isArray(base)?this.copyArray(overwrite):this.mergeObject(base,overwrite)},mergeObject:function(base,overwrite){var hasBase=this.isObj(base),newObject=hasBase?this.copy(base):this.copy(overwrite),key="";if(hasBase){for(key in overwrite){if(overwrite.hasOwnProperty(key)){newObject[key]=this.isObj(overwrite[key])&&!isProtected(key)?this.merge(base[key],overwrite[key]):overwrite[key]}}}return newObject},splitValUnit:function(value){var splitVal=value.match(/(-?\d*\.?\d*)(.*)/);return{value:parseFloat(splitVal[1]),unit:splitVal[2]}},stepProgress:function(progress,steps){var steppedProgress=0,progressSegment=1/steps,valueSegment=1/(steps-1),i=1;for(;i<=steps+1;i++){if(progress<progressSegment*i){steppedProgress=valueSegment*(i-1);break}}return steppedProgress},varType:function(variable){return Object.prototype.toString.call(variable).slice(8,-1)},currentTime:function(){return typeof performance!=="undefined"?performance.now():(new Date).getTime()}}},{}],redshift:[function(require,module,exports){"use strict";var redshift=require("../redshift.js");redshift.addRubix("fire",require("../rubix/fire.js")).addRubix("link",require("../rubix/link.js")).addRubix("play",require("../rubix/play.js")).addRubix("run",require("../rubix/run.js")).addRubix("track",require("../rubix/track.js")).addRoute("values",require("../routes/values.js")).addRoute("css",require("../routes/css.js")).addRoute("attr",require("../routes/attr.js")).addRoute("path",require("../routes/path.js"));require("../utils/shim.js");module.exports=redshift},{"../redshift.js":21,"../routes/attr.js":24,"../routes/css.js":25,"../routes/path.js":34,"../routes/values.js":37,"../rubix/fire.js":38,"../rubix/link.js":39,"../rubix/play.js":40,"../rubix/run.js":41,"../rubix/track.js":42,"../utils/shim.js":50}]},{},[]);var h=require("virtual-dom/h");var diff=require("virtual-dom/diff");var patch=require("virtual-dom/patch");var createElement=require("virtual-dom/create-element");var redshift=require("redshift");var renderAction=redshift.newAction();function render(count){return h("div",{style:{textAlign:"center",lineHeight:100+count+"px",border:"1px solid red",width:100+count+"px",height:100+count+"px"}},[String(count)])}var tree=render(0);var rootNode=createElement(tree);document.body.appendChild(rootNode);renderAction.play({values:{count:{to:500,round:true}},duration:1e3,ease:"backOut",onFrame:function(output){var newTree=render(output.count);var patches=diff(tree,newTree);rootNode=patch(rootNode,patches);tree=newTree}});
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"virtual-dom": "2.0.1",
"redshift": "1.1.1"
}
}
<!-- contents of this file will be placed inside the <body> -->
<!-- contents of this file will be placed inside the <head> -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment