Inverse of a Function
copy const expoIn = t => ( t== 0 ) ? 0 : Math .pow ( 2 , 10 * ( t - 1 ) ) const expoInInverse= t => ( t== 0 ) ? 0 : ( ( Math .log ( t) + 10 * Math .log ( 2 ) ) / Math .log ( 2 ) ) / 10 console.log ( expoIn( .35) + ' ' + expoInInverse( expoIn( .35) ) )
Try it out…
Very nice inverse function calculator by user fawad over at Wolfram Alpha . Was attempting to invert a standard “exponential in” easing function – after some futzing I resorted to the calculator 😀
Mangler
copy const lookupReplacements = { // entities (like ∑ or Θ - are safer // than just putting things inline like ∑ or ® 'a' : [ 'A' , 'Ä' , '∆' , 'á' ] , 'e' : [ 'é' , '∃' ] , 't' : [ '⊤' , 'Τ' ] , 'b' : [ 'β' ] , 'o' : [ '∅' , '_o_' ] } function mangle( s) { return s.split ``.map ( letter => { const chars = lookupReplacements[ letter] return chars ? chars[ Math .floor ( chars.length * Math .random ( ) ) ] : letter } ) .join `` } document.body .innerHTML = mangle( 'Been taking a break from making snippets... might start up again...<hr>' ) document.body .innerHTML += mangle( 'Been taking a break from making snippets... might start up again...<hr>' ) document.body .innerHTML += mangle( 'Been taking a break from making snippets... might start up again...<hr>' )
Try it out
Substitute some characters in a string with some random choices…
Pass a Class
copy function callMethods( evt) { const e = new evt e.one ( ) e.two ( ) } callMethods( class { one( ) { console.log ( 'one' ) } two( ) { console.log ( 'two' ) } } )
Try it out…
This is so tempting for something I want to do… but too strange to use probably… maybe…