Oppai
by HYEONGJINKIM
HTML
<p><input type="button" id="btn" value="Debug mode" /></p>
<div id="container">
<canvas id="cv"></canvas>
<canvas id="cv2"></canvas>
<canvas id="face"></canvas>
<!-- <p class="char"><img src="http://jsrun.it/assets/w/y/x/d/wyxdz.jpg" alt="" /></p> -->
<p class="char"><img src="http://24.media.tumblr.com/tumblr_md9pbsh6b81qdwh13o1_500.jpg" alt="" /></p>
<!-- /#container --></div>
CSS
body {
background: #111;
}
div, p {
margin: 0;
padding: 0;
}
#container {
position: absolute;
left: 50px;
top: 50px;
}
#cv,
#cv2,
#face{
cursor: pointer;
position: absolute;
z-index: 10;
}
.char {
position: absolute;
left: 0;
top: 0;
}
JavaScript
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
(function(win, doc, exports) {
var ARC, EventHandler, M22, MeshMgr, Oppai, UvData, Vertex, abs, atan2, ceil, cos, max, requestAnimFrame, sin, sqrt;
sqrt = Math.sqrt, atan2 = Math.atan2, max = Math.max, cos = Math.cos, sin = Math.sin, abs = Math.abs, ceil = Math.ceil;
ARC = Math.PI * 2;
requestAnimFrame = (function() {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback, element) {
return window.setTimeout(callback, 1000 / 60);
};
})();
EventHandler = (function() {
function EventHandler() {}
EventHandler.prototype.handleEvent = function(evt) {
var _name;
return typeof this[_name = evt.type] === "function" ? this[_name](evt) : void 0;
};
return EventHandler;
})();
Oppai = (function(_super) {
__extends(Oppai, _super);
Oppai.prototype.mesh = 10;
function Oppai(settings) {
this.onload = __bind(this.onload, this);
var s;
for (s in settings) {
this[s] = settings[s];
}
this.center = {
x: ~~((this.rect[2] - this.rect[0]) / 2),
y: ~~((this.rect[3] - this.rect[1]) / 2)
};
this.cursors = {};
this.g = this.cv.getContext('2d');
this._img = new Image();
this._img.onload = this.onload;
this._img.src = this.src;
this.left = this.rect[0];
this.top = this.rect[1];
this.width = this.rect[2] - this.left;
this.height = this.rect[3] - this.top;
...