var delau1 = null; var delau2 = null; var delau3 = null; $(document).ready(function (){ try{ var canvas = document.getElementById('canvas'); var context = canvas.getContext('2d'); var canvas2 = document.getElementById('canvas2'); var context2 = canvas2.getContext('2d'); var canvas3 = document.getElementById('canvas3'); var context3 = canvas3.getContext('2d'); var bool = Math.floor( Math.random()*2 ); var ran = Math.floor( Math.random()*40 ); delau1 = new Delaunays(canvas, context, 180 + ran, 180 + ran); ran = Math.floor( Math.random()*20 ); delau2 = new Delaunays(canvas2, context2, 60 + ran , 60 + ran); ran = Math.floor( Math.random()*20 ); delau3 = new Delaunays(canvas3, context3, 30 + ran, 30 + ran); if(bool == 0){ delau2.pointColor = "#bc0606" }else{ delau3.pointColor = "#bc0606" } $("#canvas").mousedown(function (e){ delau1._down = !delau1._down; if(delau1._down == true) delau1.reset(); }); $("#canvas2").mousedown(function (e){ delau2._down = !delau2._down; if(delau2._down == true) delau2.reset(); }); $("#canvas3").mousedown(function (e){ delau3._down = !delau3._down; if(delau3._down == true) delau3.reset(); }); }catch(e){ $("#visual_bg").find("#canvas").css({"display":"block", "margin-top":"50px"}); } }); var Delaunays = function($canvas, $ctx, $width, $height){ this._total = 9; this._total2 = 9; this._speed = 0.015; this._canvas = $canvas; this._context = $ctx; this._txtArr = []; this._h_arrays = []; this._m_arrays = []; this._b_arrays = []; this._t_arrays = []; this._fishbodys = 20; this._stageWidth = $width; this._stageHeight = $height; this._down = Math.floor(Math.random()*2) == 1 ? true : false; this._down = false; if($($canvas).attr("down") == "true"){ this._down = true; } this.__target = {x:0, y:0} this._index = 0; this.minDist = 100; this.springAmount = 0.001; this.vertices = new Array(2048); this.pointColor = null; this.___aaa = false; this.init(); } Delaunays.prototype.reClick = function (){ this._down = !this._down; if(this._down == true) this.reset(); } var _length = 0; var _opacity = 1; var timerBool = false; var radian = 0; Delaunays.prototype.drawCtx = function (){ var ctx = this._context; var canvas = this._canvas; var vertices = this.vertices; ctx.clearRect(0, 0, canvas.width, canvas.height); vertices.length = 0; this.loop2(); if(this.___aaa == true && this._down == false){ this.reset(); } var len = this._down == false ? this._total2 : this._h_arrays.length; for (var i = 0; i