Inspired by the effect on Android when you switch the screen off
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// port from GLSL code base on https://github.com/ashima/webgl-noise/blob/master/src/noise2D.glsl | |
//JS SNOISE PORT | |
function snoise2d(x, y) { | |
var C0 = 0.211324865405187; | |
var C1 = -0.577350269189626; | |
var C2 = 1.79284291400159; | |
var OVER_289 = 1 / 289; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toEs6(script) { | |
return script.replace(/var/g, 'let'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toTS(script) { | |
return script.replace(/ =/g, ':any ='); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(Modernizr, win){ | |
Modernizr.addTest('csstransformspreserve3d', function () { | |
var prop = Modernizr.prefixed('transformStyle'); | |
var val = 'preserve-3d'; | |
var computedStyle; | |
if(!prop) return false; | |
prop = prop.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// vertex shader | |
attribute float a_eyeOffset; | |
varying float v_eyeOffset; | |
... | |
vec4 mvPosition = modelViewPosition * vec4(position, 1.0); | |
mvPosition.x -= a_eyeOffset; | |
gl_Position = projectionMatrix * mvPosition; | |
gl_Position.x = gl_Position.x * 0.5 + sign(a_eyeOffset) * 0.5 * gl_Position.w; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
Modernizr.addTest('customfilter', function () { | |
var prop = 'filter'; | |
var prefixedProp = ['WebkitFilter', 'MozFilter', 'msFilter', 'OFilter', 'filter']; | |
var prefixCSS = ['-webkit-filter', '-moz-filter', '-ms-filter', '-o-filter', 'filter']; | |
var val = 'custom(url(data:text/plain;base64,))'; | |
var computedStyle; | |
for(var i = 0, len = prefixCSS.length; i < len; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){var a=prompt("Enter the url: ","//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js");if(a.length>0){var b=document.createElement("script"),c=document.getElementsByTagName("script")[0];b.src=a,c.parentNode.insertBefore(b,c)}})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* modernizr-test_position_fixed_ios.js | |
* Original by Daniel Ott (https://gist.github.com/1333800) | |
* 3 March 2011 | |
* Updated by Philipp Söhnlein 3 November 2011 | |
* Custom Tests using Modernizr's addTest API | |
*/ | |
/* iOS | |
* There may be times when we need a quick way to reference whether iOS is in play or not. | |
* While a primative means, will be helpful for that. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function(Modernizr, window) { | |
Modernizr.addTest('positionfixed', function () { | |
var test = document.createElement('div'), | |
control = test.cloneNode(false), | |
fake = false, | |
root = document.body || (function () { | |
fake = true; | |
return document.documentElement.appendChild(document.createElement('body')); | |
}()); |
NewerOlder