Hello everyone!
I have a tumblr and a cool thing about it is that it's possbile to add a page to it. For example, if the url of tumblr is "http://processing.tumblr.com", additional page could be "http://processing.tubmlr.com/page1" and it can have a completely different source code. I wanted to have such a page that will consist completely of a processing sketch and the source code looks like this:
What I want is that the sketch size is set exactly to the browser window size automatically so that my sketch can use the "full potential" of a browser.
I hope I was clear about the thing I want and if the answer consists of javascript coding pleeease be specific about it because I really don't know javascript that much. I found some solutions that include javascript but I'm really nowhere near understanding it..
Thanks in advance, here's the result (for now) : http://patakk.tumblr.com/spir
I have a tumblr and a cool thing about it is that it's possbile to add a page to it. For example, if the url of tumblr is "http://processing.tumblr.com", additional page could be "http://processing.tubmlr.com/page1" and it can have a completely different source code. I wanted to have such a page that will consist completely of a processing sketch and the source code looks like this:
- <script src="https://github.com/downloads/processing-js/processing-js/
- processing-1.3.6.js"></script>
- <script type="text/processing" data-processing-target="mycanvas">
- float rad = 50;
- float alpha = 0;
- float odmak = rad/2;
- int rate = 60;
- float k=20;
- float xx=0;
- float rr = 127, gg = 195, bb = 81;
- float x, y;
- float vrim;
- float taj = 0;
- void setup() {
- size(screen.width - 20, screen.height - 192);
- background(0);
- stroke(255);
- noFill();
- smooth();
- frameRate(rate);
- }
- void draw() {
- fill(0, 0);
- rect(0, 0, width, height);
- fill(rr, gg, bb);
- alpha += k;
- odmak += rad/(360/k);
- k = 500/odmak;
- rad += xx;
- xx += 0;
- x = odmak*cos(radians(alpha));
- y = -odmak*sin(radians(alpha));
- vrim = millis() - taj;
- rr = 127 - 127*sin(0.000026*vrim);
- gg = 150 - 55*sin(0.000022*vrim - 1);
- bb = 127 + 50*sin(0.000046*vrim - 2);
- translate(width/2 + x, height/2 + y);
- ellipse(0, 0, rad, rad);
- }
- void mouseClicked() {
- background(0);
- rad = 50;
- alpha = 0;
- odmak = rad/2;
- rate = 60;
- k = 20;
- xx = 0;
- rr = 127;
- gg = 195;
- bb = 81;
- taj = millis();
- }
- </script>
- <canvas id="mycanvas"></canvas>
What I want is that the sketch size is set exactly to the browser window size automatically so that my sketch can use the "full potential" of a browser.
I hope I was clear about the thing I want and if the answer consists of javascript coding pleeease be specific about it because I really don't know javascript that much. I found some solutions that include javascript but I'm really nowhere near understanding it..
Thanks in advance, here's the result (for now) : http://patakk.tumblr.com/spir
1