/*!
 * face-cursor.js (github.com/matthias-vogt/face-cursor.js)
 * Copyright (c) 2016 Matthias Vogt (ISC License)
 */
!function(t,e,n,s){"use strict";var o="faceCursor",a={avertCursor:!1,perspective:"6rem",cacheElementData:!0},i=function(e,n){e===s&&(e={});var o=function(){this.destroy=r.destroy,this.init()};t.extend(r,{options:e,$elements:n}),t.extend(o.prototype,r);var a=new o;return a},r={get settings(){return delete this.settings,this.settings=t.extend(!0,{},a,this.options)},destroy:function(){this.$elements.off("."+o)},init:function(){var e=this;this.options.cacheElementData&&this.cacheElementData(),this.animFrameLoop(e),t(n).on("mousemove."+o,function(t){e.lastMouseCoords={x:t.pageX,y:t.pageY}})},lastMouseCoords:null,getElementData:function(e){var n=this;this.$elements.each(function(s,a){n.settings.cacheElementData&&t(a).data("."+o)?e(t(a).data("cachedData."+o),t(a)):e({w:t(a).outerWidth(),h:t(a).outerHeight(),offset:t(a).offset()},t(a))})},cacheElementData:function(){this.getElementData(function(t,e){e.data("cachedData."+o,t)})},animFrameLoop:function(t){e.requestAnimationFrame(function(){t.frame(),t.animFrameLoop(t)})},frame:function(){if(this.lastMouseCoords){var t=this;this.getElementData(function(e,n){var s=t.lastMouseCoords.x-(e.offset.left+e.w/2),o=t.lastMouseCoords.y-(e.offset.top+e.h/2),a=s/(e.w/2),i=o/(e.h/2);n.css("transform","perspective("+t.settings.perspective+")rotate3d("+(i*(t.settings.avertCursor?1:-1)).toFixed(2)+", "+(a*(t.settings.avertCursor?-1:1)).toFixed(2)+", 0, 1deg)")})}}};t.fn[o]=function(e){return this.each(function(){t(this).data("plugin_"+o)&&t(this).data("plugin_pluginName").destroy(),t(this).data("plugin_"+o,i(e,t(this)))})}}(jQuery,window,document);