"Better" / Bruteforce Cubic Bezier Approximations for Robert Penner Easing Equations
node compare_curve.jsSample Output
| function Histogram() { | |
| this.reset(); | |
| } | |
| Histogram.prototype.reset = function() { | |
| this.counts = []; | |
| this.types = {}; | |
| }; |
| var c = document.createElement('canvas'); | |
| c.width = innerWidth; | |
| c.height = innerHeight; | |
| var ctx = c.getContext('2d'); | |
| document.body.appendChild(c); | |
| var last = performance.now(); | |
| var delay = 0; |
| var c = document.createElement('canvas'); | |
| c.width = innerWidth; | |
| c.height = innerHeight; | |
| var ctx = c.getContext('2d'); | |
| document.body.appendChild(c); | |
| var last = performance.now(); | |
| var delay = 0; |
| // TODO Use the DOM Mutation API! | |
| (function switchText(node) { | |
| var nodes = node.childNodes; | |
| for (var n = 0; n < nodes.length; n++) { | |
| if (nodes[n].nodeName.match(/(script|style)/i)); else | |
| if (nodes[n].nodeType == 3) { | |
| if (!/^\s+$/.test(nodes[n].value)) { | |
| nodes[n].data = nodes[n].data.replace(/[a-zA-Z]+/g, function(w) { | |
| return (w.match(/^(the|on|are|if|is|and|or|you|your|a|an)$/i)) | |
| ? w |
| // Simple Undo / Redo System | |
| /* | |
| * @author joshua koo / http://joshuakoo.com | |
| * | |
| * There are usually 2 different ways to handle undo / redo | |
| * 1. you snapshot and store the states, so you can load them anytime | |
| * 2. you store the deltas, actions, events or commands between save points. | |
| * | |
| * Method 1 is simplistic. But it works. It's a lot like git. |
| /* | |
| @author twitter.com/blurspline | |
| */ | |
| function handleDrag(element, ondown, onmove, onup, down_criteria) { | |
| var pointer = null; | |
| var bounds = element.getBoundingClientRect(); | |
| element.addEventListener('mousedown', onMouseDown); |
| function stretch(args) { | |
| for (var i = 0, il = args.length; i<il; i++) { | |
| var c = args[i]; | |
| args[i] += new Array(200).slice(c.length).join(' '); | |
| } | |
| return args; | |
| } | |
"Better" / Bruteforce Cubic Bezier Approximations for Robert Penner Easing Equations
node compare_curve.jsSample Output
| <html> | |
| <head> | |
| <script> | |
| GSS_CONFIG = { | |
| worker: "bower_components/gss/dist/worker.js", | |
| verticalScroll: !false | |
| }; | |
| // also see https://raygun.io/blog/2014/06/next-gen-constraint-layouts-browser-grid-style-sheets/ |
| body { | |
| } |