Let's play a game

Challenge:
You will have 3 functions:
getRed(i, j)
getGreen(i, j)
getBlue(i, j)
Where i and j are the xy coordinate where the pixel color will be.
Your goal is to write the code of the 3 functions that will return a number which represent the amount of the given color present in the pixel. You can also change the size of the image.

Here is the html file where all you need is in there: pastebin.com/LhxUSFuX

Pic related:
red: return (i + j) & j;
green: return (255 + i - j) & i;
blue: return (i + j) & (255 + i - j);

Show me your best

Attached: art.png (500x500, 44K)

Another example:
Red:
return Math.cos(i * 28 / j) * 255;

Green:
return Math.cos(i * 28 / j - 14) * 255;

Blue:
return Math.cos(i * 28 / j - 28) * 255;

Attached: rainbow.png (600x600, 345K)

A really simple one:
Red:
return i;

Green:
return j;

Blue:
return 255;

Attached: simple.png (256x256, 2K)

Fractal !

getRed: function(i, j) {
var a=0,b=0,d,n=0;
for(;a*a+(d=b*b)

Attached: fractal.png (1200x1200, 930K)

Red:
return i * j
Green:
return Math.sin(i * j) * 255;
Blue:
return Math.cos(i * j) * 255;

Attached: random.png (256x256, 156K)

red: return i * i * j;
green: return i * i * j;
blue: return i * i * j * j;

Attached: pixel.png (256x256, 74K)

I dont get it. Do you want someone to do your homework for you...?

Just want to see the Veeky Forums creativity

Red: return (i+j)/3;
Green: return (i+2*j)/3;
Blue: return (2*i+j)/3;

Attached: colorful.png (1024x1024, 49K)

So, fragment shaders? Why not just make it in shadertoy?
For example: shadertoy_com/view/4sVcR1

Attached: download.png (256x256, 12K)

Math.sqrt(i*j);
Math.log(i*j);
Math.sqrt(i*j)*4;

Attached: rows.png (1024x1024, 336K)

I don't understand what you're asking

Attached: d27[1].png (645x729, 75K)

(j - i) * j;
(j+i);

var a;
for(i = 0; i < 255; i++){
a = (i * Math.random()) + j;
}
return a;

Attached: image.png (701x701, 1.25M)

sin, cos, and lots of modulus

Attached: dots.png (1024x1024, 62K)

show your work bitchboi

looks like pixel shaders

where am i supposed to enter this type of data, what even mathematics is this using

get the html file on the pastebin link from the OP, then write the content of the three functions in a way that makes a cool picture

>get the html file on the pastebin link from the OP
And do what with it, make a website?

run it in any browser

Attached: download (1).png (1024x1024, 411K)

>make a website
kek

return (Math.pow(i - this.size / 2, 2) + Math.pow(j - this.size / 2, 2) - Math.pow(20, 2));

return (Math.pow(i - this.size / 2, 2) + Math.pow(j - this.size / 2, 2) - Math.pow(10, 2));

return (Math.pow(i - this.size / 2, 2) + Math.pow(j - this.size / 2, 2) - Math.pow(50, 2));

Attached: circle.png (1024x1024, 36K)

bump

return (Math.pow(i - this.size / 2, 2) + Math.pow(j - this.size / 2, 2) - Math.pow(20, 2)) / 100;

return (Math.pow(i - this.size / 2, 2) + Math.pow(j - this.size / 2, 2) - Math.pow(40, 2)) / 100;

return (Math.pow(Math.sin(i) * i - this.size / 2, 2) + Math.pow(j - this.size / 2, 2) - Math.pow(60, 2)) / 100;

Attached: circ.png (1024x1024, 753K)

var def = {
versace: 10000.0,
size: 512,
fuck: function(i, j) {
return Math.sin((i * j) / this.versace) * 255;
},
getRed: function(i, j) {
return Math.max(this.fuck(i, i), this.fuck(j, j));
},

getGreen: function(i, j) {
return Math.max(this.fuck(i, i/3.0), this.fuck(j, j/3.0));
},

getBlue: function(i, j) {
return Math.max(this.fuck(i/2.0, i), this.fuck(j/2.0, j));
},
}

Attached: download.png (512x512, 40K)

go back to /g/

var def = {
size: 512,
getRed: function(i, j) {
return (j + i) * ((j + i) % 3) * 255/ 1024 * 2;
},

getGreen: function(i, j) {
return 2.0 * this.getRed(i, j);
},

getBlue: function(i, j) {
return 4.0 * this.getRed(i, j);
},
}

Attached: download.png (512x512, 56K)

red:
return (Math.abs(Math.pow(i % 178 - 55, 2) + Math.pow(j % 178 - 55, 2) - Math.pow(50, 2)) < Math.pow(24, 2)) ? 255 : ((this.size - i - j) / this.size * 200 | (i - j) / this.size * 200) + ((this.size - i - this.size + j) / this.size * 200 | (i - this.size + j) / this.size * 200);

green:
return (Math.abs(Math.pow(i % 178 - 55, 4) + Math.pow(j % 178 - 55, 4) - Math.pow(25, 4)) < Math.pow(20, 4)) ? 255 : ((this.size - i - this.size + j) / this.size * 200 | (this.size - i - j) / this.size * 200)

blue:
return (Math.abs(Math.pow(i % 178 - 144, 2) + Math.pow(j % 178 - 144, 2) - Math.pow(30, 2)) < Math.pow(15, 2)) ? 255 : ((i - this.size + j) / this.size * 200 | (i - j) / this.size * 200);

Attached: circles.png (1000x1000, 300K)

Funky

need to try some bitwise functions now

Attached: result.png (511x511, 462K)

I some alphamasks ages ago

Attached: alphamask (59).png (1024x1024, 910K)

Attached: download.png (512x512, 46K)

Attached: download (1).png (1024x1024, 246K)

Attached: download (2).png (1024x1024, 137K)

This is a good thread.
Thanks, OP

Tried to see what would happen if I just threw functions at the wall... Pretty pleased with the results.

Attached: Screen Shot 2018-03-16 at 2.52.19 PM.png (1592x1578, 3.6M)