Pressure.js Test
How do I make an pressure.js test?
What is a pressure.js test? How do you make a pressure.js test? This script and codes were developed by Oliver Britton on 27 August 2022, Saturday.
Pressure.js Test - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pressure.js Test</title> <link rel='stylesheet prefetch' href='http://pastebin.com/raw/4tUusXmL'> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="background"></div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Pressure.js Test - Script Codes CSS Codes
@import url(https://fonts.googleapis.com/css?family=Montserrat|Roboto:400,500,300,400italic|Fira+Sans:400,500,300);
body { text-align: center; font-family: "Roboto"; padding: 0; margin: 0;
}
#background { width: 100%; height: 100vw; background: #E91E63;
}
.state-1 { background: #FFD34E !important;
}
.state-2 { background: #468966 !important;
}
Pressure.js Test - Script Codes JS Codes
// Pressure v1.0.1 | Created By Stuart Yamartino | MIT License | 2015-Present
!function(e,t){"use strict";function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,s,n){return s&&e(t.prototype,s),n&&e(t,n),t}}(),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},u={set:function(e,t,s){v(e,t,s)},config:function(e){p.set(e)},map:function(e,t,s,n,i){return k(e,t,s,n,i)}};if(e===!1)return void console.warn("Pressure requires a window with a document");if("undefined"!=typeof u)if("function"==typeof define&&define.amd){var c=u;define(["pressure"],function(e){return e})}else if("object"===("undefined"==typeof module?"undefined":r(module))&&module.exports){var c=u;module.exports=c}else e.Pressure=u;var l=function(){function e(t,s,n){i(this,e),this.element=t,this.block=s,this.type=p.get("only",n),this.options=n,this.routeEvents()}return o(e,[{key:"routeEvents",value:function(){y.mobile!==!1||"force"!==this.type&&"3d"===this.type?y.mobile!==!0||"3d"!==this.type&&"force"===this.type?this.instantFail():new a(this):new f(this)}},{key:"instantFail",value:function(){var e=this;this.element.addEventListener(y.mobile?"touchstart":"mousedown",function(){return P(e.block,"unsupported",e.element)},!1)}}]),e}(),h=function(){function e(t){i(this,e),this.element=t,this.el=t.element,this.block=t.block,this.pressed=!1,this.deepPressed=!1}return o(e,[{key:"add",value:function(e,t){this.el.addEventListener(e,t,!1)}},{key:"remove",value:function(e,t){this.el.removeEventListener(e,t)}},{key:"setPressed",value:function(e){this.pressed=e}},{key:"setDeepPressed",value:function(e){this.deepPressed=e}},{key:"failOrPolyfill",value:function(e){y.didFail(),p.get("polyfill",this.element.options)===!0?this.polyfill=new d(this.element,e):P(this.block,"unsupported",this.el)}},{key:"preventDefault",value:function(e){p.get("preventDefault",this.element.options)===!0&&(e.preventDefault(),this.el.style.webkitTouchCallout="none",this.el.style.userSelect="none",this.el.style.webkitUserSelect="none",this.el.style.MozUserSelect="none")}}]),e}(),a=function(e){function t(e){i(this,t);var n=s(this,Object.getPrototypeOf(t).call(this,e));return n.$support(),n.$start(),n.$change(),n.$end(),n}return n(t,e),o(t,[{key:"$support",value:function(){this.supportMethod=this.middleMan.bind(this),this.add("touchstart",this.supportMethod)}},{key:"middleMan",value:function(e){this.setPressed(!0),this.forceValueTest=e.touches[0].force,this.supportCallback(0,e)}},{key:"supportCallback",value:function(e,t){y.hasRun!==!1||this.polyfill instanceof d?y.forPressure||this.polyfill instanceof d?this.remove("touchstart",this.supportMethod):this.failOrPolyfill(t):t.touches[0].force!==this.forceValueTest?(this.preventDefault(t),y.didSucceed("3d"),this.remove("touchstart",this.supportMethod),P(this.block,"start",this.el,t),this.changeLogic(t)):10>=e&&this.pressed?(e+=1,setTimeout(this.supportCallback.bind(this),10,e,t)):this.pressed&&this.failOrPolyfill(t)}},{key:"$start",value:function(){var e=this;this.add("touchstart",function(t){y.forPressure&&(e.setPressed(!0),e.preventDefault(t),P(e.block,"start",e.el,t))})}},{key:"$change",value:function(){this.add("touchstart",this.changeLogic.bind(this))}},{key:"changeLogic",value:function(e){y.forPressure&&this.pressed&&(this.setPressed(!0),this.runForce(e))}},{key:"$end",value:function(){var e=this;this.add("touchend",function(){y.forPressure&&(e.endDeepPress(),e.setPressed(!1),P(e.block,"end",e.el))})}},{key:"startDeepPress",value:function(e){this.deepPressed===!1&&P(this.block,"startDeepPress",this.el,e),this.setDeepPressed(!0)}},{key:"endDeepPress",value:function(){this.deepPressed===!0&&P(this.block,"endDeepPress",this.el),this.setDeepPressed(!1)}},{key:"runForce",value:function(e){this.pressed&&(this.touch=this.selectTouch(e),setTimeout(this.runForce.bind(this),10,e),P(this.block,"change",this.el,this.touch.force,e))}},{key:"selectTouch",value:function(e){if(1===e.touches.length)return this.returnTouch(e.touches[0],e);for(var t=0;t<e.touches.length;t++)if(e.touches[t].target===this.el)return this.returnTouch(e.touches[t],e)}},{key:"returnTouch",value:function(e,t){return e.force>=.5?this.startDeepPress(t):this.endDeepPress(),e}}]),t}(h),f=function(e){function t(e){i(this,t);var n=s(this,Object.getPrototypeOf(t).call(this,e));return n.$support(),n.$start(),n.$change(),n.$startDeepPress(),n.$endDeepPress(),n.$end(),n}return n(t,e),o(t,[{key:"$support",value:function(){this.add("webkitmouseforcewillbegin",this.forceTouchEnabled),this.add("mousedown",this.supportCallback.bind(this))}},{key:"forceTouchEnabled",value:function(e){e.preventDefault(),y.didSucceed("force")}},{key:"supportCallback",value:function(e){y.forPressure===!0||this.polyfill instanceof d?(this.remove("webkitmouseforcewillbegin",this.forceTouchEnabled),this.preventDefault(e)):this.failOrPolyfill(e)}},{key:"$start",value:function(){var e=this;this.add("mousedown",function(t){y.forPressure&&(e.setPressed(!0),P(e.block,"start",e.el,t))})}},{key:"$change",value:function(){var e=this;this.add("webkitmouseforcechanged",function(t){y.forPressure&&0!==t.webkitForce&&e.pressed&&P(e.block,"change",e.el,e.normalizeForce(t.webkitForce),t)})}},{key:"$end",value:function(){var e=this;this.add("mouseup",function(){y.forPressure&&(e.setPressed(!1),P(e.block,"end",e.el))}),this.add("mouseleave",function(){y.forPressure&&(e.pressed&&P(e.block,"end",e.el),e.setPressed(!1))})}},{key:"$startDeepPress",value:function(){var e=this;this.add("webkitmouseforcedown",function(t){y.forPressure&&(e.setDeepPressed(!0),P(e.block,"startDeepPress",e.el,t))})}},{key:"$endDeepPress",value:function(){var e=this;this.add("webkitmouseforceup",function(){y.forPressure&&(e.setDeepPressed(!1),P(e.block,"endDeepPress",e.el))}),this.add("mouseleave",function(){y.forPressure&&(e.deepPressed&&P(e.block,"endDeepPress",e.el),e.setDeepPressed(!1))})}},{key:"normalizeForce",value:function(e){return this.reachOne(k(e,1,3,0,1))}},{key:"reachOne",value:function(e){return e>.999?1:e}}]),t}(h),d=function(e){function t(e,n){i(this,t);var o=s(this,Object.getPrototypeOf(t).call(this,e));return o.$start(),o.$change(),o.$end(),o.force=0,o.increment=.01,o.firstRun(n),o}return n(t,e),o(t,[{key:"firstRun",value:function(e){this.preventDefault(e),this.startLogic(e),this.changeLogic(e)}},{key:"$start",value:function(){var e=this;this.add(y.mobile?"touchstart":"mousedown",function(t){e.startLogic(t)})}},{key:"startLogic",value:function(e){this.setPressed(!0),P(this.block,"start",this.el,e)}},{key:"$change",value:function(){this.add(y.mobile?"touchstart":"mousedown",this.changeLogic.bind(this))}},{key:"changeLogic",value:function(e){this.pressed&&(this.setPressed(!0),this.runForce(e))}},{key:"$end",value:function(){var e=this;this.add(y.mobile?"touchend":"mouseup",function(){e.endDeepPress(),e.setPressed(!1),P(e.block,"end",e.el),e.force=0}),this.add("mouseleave",function(){e.endDeepPress(),e.pressed&&P(e.block,"end",e.el),e.setPressed(!1),e.force=0})}},{key:"startDeepPress",value:function(e){this.deepPressed===!1&&P(this.block,"startDeepPress",this.el,e),this.setDeepPressed(!0)}},{key:"endDeepPress",value:function(){this.deepPressed===!0&&P(this.block,"endDeepPress",this.el),this.setDeepPressed(!1)}},{key:"runForce",value:function(e){this.pressed&&(P(this.block,"change",this.el,this.force,e),this.force>=.5?this.startDeepPress(e):this.endDeepPress(),this.force=this.force+this.increment>1?1:this.force+this.increment,setTimeout(this.runForce.bind(this),10,e))}}]),t}(h),p={preventDefault:!0,only:null,polyfill:!1,get:function(e,t){return t.hasOwnProperty(e)?t[e]:this[e]},set:function(e){for(var t in e)e.hasOwnProperty(t)&&this.hasOwnProperty(t)&&"get"!=t&&"set"!=t&&(this[t]=e[t])}},y={hasRun:!1,forPressure:!1,type:!1,mobile:"ontouchstart"in t,didFail:function(){this.hasRun=!0,this.forPressure=!1},didSucceed:function(e){this.hasRun=!0,this.forPressure=!0,this.type=e}},v=function(e,s){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if("string"==typeof e||e instanceof String)for(var i=t.querySelectorAll(e),o=0;o<i.length;o++)new l(i[o],s,n);else if(b(e))new l(e,s,n);else for(var o=0;o<e.length;o++)new l(e[o],s,n)},b=function(e){return"object"===("undefined"==typeof HTMLElement?"undefined":r(HTMLElement))?e instanceof HTMLElement:e&&"object"===("undefined"==typeof e?"undefined":r(e))&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName},P=function(e,t,s){e.hasOwnProperty(t)&&e[t].apply(s||this,Array.prototype.slice.call(arguments,3))},k=function(e,t,s,n,i){return(e-t)*(i-n)/(s-t)+n}}("undefined"!=typeof window?window:!1,"undefined"!=typeof window?window.document:!1);
Pressure.set('#background', { change: function(force){ if(force > 0.5) { $('#background').addClass('state-1'); } else { $('#background').removeClass('state-1'); $('#background').removeClass('state-2'); if(force > 0.7) { $('#background').removeClass('state-1'); $('#background').addClass('state-2'); } else { return; } } }
});
Developer | Oliver Britton |
Username | ollybritton |
Uploaded | August 27, 2022 |
Rating | 3 |
Size | 5,029 Kb |
Views | 40,480 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
The Zombie Apocalypse. | 3,937 Kb |
Bad Translator Version 2.0 | 5,273 Kb |
Pushy Button Mixin | 3,978 Kb |
Linear Buttons | 3,430 Kb |
Reversi-Scroll | 3,289 Kb |
How To Rickroll In An Input. | 3,052 Kb |
Inspirational Lorem Ispum | 3,644 Kb |
Pushy 3d Buttons | 3,286 Kb |
Google GV Header | 2,999 Kb |
A Pen by Oliver Britton | 3,325 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Console fun | Dviate | 1,500 Kb |
Filtre ile Arama Kutusu - Search Box with Filter | AyhanALTINOK | 3,448 Kb |
Product item | Mymahesh11 | 2,256 Kb |
Responsive scrolling text | Ashdurham | 2,259 Kb |
Flexbox playground | Enxaneta | 5,418 Kb |
Progressively reveal dots on a Bezier curve | GreenSock | 2,489 Kb |
Ionic - Wordpress REST API starter | Superpikar | 2,961 Kb |
Starfield using KineticJS | Asp | 3,512 Kb |
Atom | Bhlaird | 1,932 Kb |
Nested flexbox layout for library catalog | Boycetrus | 3,271 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!