Created
March 8, 2019 13:21
-
-
Save kb10uy/91bd07c64722a4127b63ba2f9ec4fcaa to your computer and use it in GitHub Desktop.
jQuery Erect - Erect elements with jQuery!
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 ($) { | |
if (!window.requestAnimationFrame || !window.performance) { | |
console.log('Sorry, jQuery Erect is unsupported on this environment.'); | |
$.fn.erect = function () {}; | |
return; | |
} | |
var defaultErection = { | |
time: 500, | |
angle: 45, | |
scale: 1.3 | |
}; | |
var defaultPenis = { | |
diameter: 100, | |
length: 400, | |
glansSize: 100, | |
color: '#edd5b1', | |
glansColor: '#ffbdaa', | |
}; | |
/** | |
* 勃起させる。 | |
* options.time 時間 (ms) | |
* options.angle 勃起角度 (deg) | |
* options.scale 倍率 | |
*/ | |
$.fn.erect = function (options) { | |
var fulfilled = $.extend({}, defaultErection, options); | |
var updateErection = function (target, started, options) { | |
var callback = function (now) { | |
var elapsed = now - started; | |
var ratio = Math.min(1.0, elapsed / options.time); | |
var currentAngle = ratio * options.angle; | |
var currentScale = (1.0 - ratio) * 1.0 + ratio * options.scale; | |
var transformRotation = 'rotateZ(-' + currentAngle + 'deg)'; | |
var transformScale = 'scale(' + currentScale + ', ' + currentScale + ')'; | |
target.css('transform', [transformRotation, transformScale].join(' ')); | |
if (elapsed < options.time) { | |
window.requestAnimationFrame(callback); | |
} | |
}; | |
return callback; | |
}; | |
var erectionStarted = performance.now(); | |
this.css('transform-origin', 'top left'); | |
window.requestAnimationFrame(updateErection(this, erectionStarted, fulfilled)); | |
return this; | |
}; | |
/** | |
* ペニスにする。 | |
* options.diameter 直径 (px) | |
* options.length 長さ (px) | |
* options.color 色 | |
*/ | |
$.fn.penisify = function (options) { | |
var fulfilled = $.extend({}, defaultPenis, options); | |
var pos = this.css('position'); | |
if (pos == '' || pos === 'static') { | |
this.css('position', 'relative'); | |
} | |
this.width(fulfilled.length); | |
this.height(fulfilled.diameter); | |
this.css('background-color', fulfilled.color); | |
var glansSize = typeof fulfilled.glaglansSizens === 'number' ? | |
fulfilled.glansSize + 'px' : | |
fulfilled.glansSize; | |
var glans = $(document.createElement('div')) | |
.css({ | |
position: 'absolute', | |
top: 0, | |
right: 0, | |
width: glansSize, | |
height: '100%', | |
backgroundColor: fulfilled.glansColor, | |
zIndex: this.css('z-index') + 1 | |
}); | |
this.append(glans); | |
return this; | |
}; | |
/** | |
* 修正する。 | |
*/ | |
$.fn.censor = function () { | |
var pos = this.css('position'); | |
if (pos == '' || pos === 'static') { | |
this.css('position', 'relative'); | |
} | |
var black = $(document.createElement('div')) | |
.css({ | |
position: 'absolute', | |
top: '-10%', | |
left: '75%', | |
width: '15%', | |
height: '120%', | |
backgroundColor: '#000', | |
zIndex: this.css('z-index') + 10 | |
}); | |
this.append(black); | |
return this; | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment