New character base algorithm
authorAlyssa Rosenzweig <bobbybee@users.noreply.github.com>
Thu, 28 May 2015 13:47:15 +0000 (09:47 -0400)
committerAlyssa Rosenzweig <bobbybee@users.noreply.github.com>
Thu, 28 May 2015 13:47:15 +0000 (09:47 -0400)
DynImage.js
main.js

index 098db1e..978e9a8 100644 (file)
@@ -125,6 +125,22 @@ DynImage.prototype.pointRing = function(sx, sy, height, layerIntensity, intensit
        }               
 }
 
+DynImage.prototype.character2 = function(width, height) {
+       for(var x = 0; x < width; ++x) {
+               for(var y = 0; y < height; ++y) {
+                       var color = this.getColor(x, y);
+                       var mod = 150;
+                       var mult = Math.ceil(Math.random() * 120);
+
+                       this.setColor(x, y, 
+                                       Math.floor((color[0] * 0.5) + 128*Math.log(((x / width) * mod) + ((y / height) * mod))) & 255,
+                                       Math.floor((color[1] * 0.5) + 128*Math.log(((x / width) * mod) + ((y / height) * mod))) & 255,
+                                       Math.floor((color[2] * 0.5) + 128*Math.log(((x / width) * mod) + ((y / height) * mod))) & 255
+                               );
+               }
+       }
+}
+
 DynImage.prototype.punchImage = function(sx, sy, sw, sh, force, spread) {
        for(var i = -(sw / 2); i < (sw/2); ++i) {
                for(var j = (-(sh/2)); j < (sh/2); ++j) {
diff --git a/main.js b/main.js
index 8a8032e..7c989c4 100644 (file)
--- a/main.js
+++ b/main.js
@@ -33,11 +33,12 @@ function pretty(name, ired, igreen, iblue, ringConstant, stainConstant, stainSiz
 
        dynimage.punchWave(width / 2, height / 2, width * stainSize, height * stainSize, Math.floor(stainConstant), width / 3, waveConstant);
 
-       dynimage.pointRing(width / 2, height / 2, width, ringConstant, intensityConstant);
+       //dynimage.pointRing(width / 2, height / 2, width, ringConstant, intensityConstant);
+       dynimage.character2(width, height);
 
        dynimage.recontrast(contrastThreshold, Math.floor(Math.random() * 60));
 
-       dynimage.border(width, height, bred, bgreen, bblue, borderConstant);
+//     dynimage.border(width, height, bred, bgreen, bblue, borderConstant);
        
        var png = new Png(buffer, width, height, 'rgba');
        png.encode(function(image) {
This page took 0.02742 seconds and 4 git commands to generate.