From 9e516a7d700491bfea2efe1e331f190956a433b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Wed, 16 Dec 2015 23:04:34 +0100 Subject: [PATCH] :ledger: Remove worker --- scripts/chaos.js | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 scripts/chaos.js diff --git a/scripts/chaos.js b/scripts/chaos.js deleted file mode 100644 index bfb7f16..0000000 --- a/scripts/chaos.js +++ /dev/null @@ -1,38 +0,0 @@ -/*jslint plusplus: true */ -/*globals self, importScripts, utils */ - -(function () { - 'use strict'; - - importScripts('utils.js'); - - function getRandomPoint(w, h) { - return [utils.getRandomArbitary(0, 1) * w, utils.getRandomArbitary(0, 1) * h]; - } - - self.addEventListener('message', function (e) { - var points = [], vertices = e.data[2], size = e.data[1], point, pointSkip = 100, - i = parseInt(e.data[0], 10) + pointSkip, j, length = vertices.length, - frac = e.data[3], cvert, numvertex, correction; - - correction = 1 / frac - 1; // make points fit in the container - point = getRandomPoint(size[0], size[1]); - - do { - numvertex = utils.getRandomInt(0, vertices.length - 1); - cvert = vertices[numvertex]; - point = [(cvert[0] + point[0]) * (frac), (cvert[1] + point[1]) * (frac)]; - - if (i > pointSkip) { // skip the first few points - points.push([ - [ - point[0] * correction, - point[1] * correction - ], numvertex - ]); - } - } while (i--); - - self.postMessage(points); - }, false); -}()); \ No newline at end of file