JS1k, 1k Javascript demo contest
category: code [glöplog]
po1: your entry is unbelieveable. Awesome.
THANKS!
rez: A bit ? I'll try to help you 112 bytes and more! Can you send me a link or script at my nick @opera.com ?
rez: A bit ? I'll try to help you 112 bytes and more! Can you send me a link or script at my nick @opera.com ?
p01 won.
p01: Unbelievable indeed!
p01: WTF
Now, when do we vote? :)
Now, when do we vote? :)
awesomely great
@p01: mail sent :)
rotating 3D wireframe cube + oldschool fire effect
http://js1k.com/demo/76
http://js1k.com/demo/76
p01
rez: Looking at it...
Applying these simple techniques will trim a solid 400 bytes to the code you sent me.
Also running your code more or less as is through Google Closure Compiler does bring it under the 1k.
Hope the tips above will help you and others write nice and tiny prods ;)
- :\ you didn't use the template page provided on the contest page. The HTML markup is FIXED, and your JS code is shoved directly into a SCRIPT tag. No need for onload or other stuff like that.
- check the code of a couple of entries to see how people get a hold of the canvas, width and height of the page, etc...
- you wrote many functions that are either used only once, or in single context, or simply replicating the exact behavior of the native JavaScript functions.
- use alias variables for things like Math, Math.sin, ...
- the first argument of setTimeout and setInterval is either a function handle or a string of JavaScript code to parse and evaluate. That means that things like: setInterval( "functionName()", 10 ); are just bad and should be replaced by setInterval( functionName, 10 ); or setInterval( "/* a shit load of code */", 10 ); if you run out of space for the contest and need to save the few bytes used for the function declaration.
- use and abuse one letter variable and function names
- don't even use a variable for things you use only once, just shove the expression directly where you actually need the result.
Applying these simple techniques will trim a solid 400 bytes to the code you sent me.
Also running your code more or less as is through Google Closure Compiler does bring it under the 1k.
Hope the tips above will help you and others write nice and tiny prods ;)
Thanks guys! Such feedback is motivating!
Zplex: So far the jury is made of 3 web developers, and the JS1K contest is not about the demoscene but about javascript demo. So god knows what the jury will go for. I REALLY really hope they won't fall for something super cheesy or that was done 8 years ago at the5k or the 256b.htm contests or that has been done in 256b or less.
Zplex: So far the jury is made of 3 web developers, and the JS1K contest is not about the demoscene but about javascript demo. So god knows what the jury will go for. I REALLY really hope they won't fall for something super cheesy or that was done 8 years ago at the5k or the 256b.htm contests or that has been done in 256b or less.
I predict the mario one will win ;)
p01 - i think your fractal is too technical to impress. anyone not knowning what it is will take it as a moving turd. that said, you're awesome :)
rasmus: True! I got much much much better feedback from demoscene savvy people than from the more general crowd.
p01: was it a rule to go fullscreen? i think most people of the "general crowd" won't like the blurry low-resolution look. maybe using 1:1 monitor resolution by downsizing the output canvas would help... ?
don't get me wrong btw: it's my clear winner by a long shot!
doesn't run in firefox 3.6 here: "p is null"
yeah, when p01 touches your code it only runs on opera ;)
Hey, i have seen that by MrDoob on asm tv. Great product!
rez: but you completely overlooked the 1st, 3rd and 4th tips I gave above. u______U
Your alias variable for window is unecessary since window is the global scope.
-> 13 bytes saved
(...)
xernobyl: Thanks, but I touched the code yesterday when looking at it and it worked in all four browsers and was 400 bytes smaller. But then there's no point passing that to Rez like this because it actually became MY code. I'd much rather give him hints and tips to optimize his code.
Sorry if I sound sour but I'm in a rush right now and I have a feeling I wasted my time analyzing the code last night :(
Code:
can be replaced by function mc(e){return m.cos(e)}function ms(e){return m.sin(e)}function mr(e){return m.ceil(e)}function mu(){return m.random(0,1)}
Code:
-> 122 bytes savedC=m.cos;S=m.sin;R=m.ceil;U=m.random
Your alias variable for window is unecessary since window is the global scope.
-> 13 bytes saved
(...)
xernobyl: Thanks, but I touched the code yesterday when looking at it and it worked in all four browsers and was 400 bytes smaller. But then there's no point passing that to Rez like this because it actually became MY code. I'd much rather give him hints and tips to optimize his code.
Sorry if I sound sour but I'm in a rush right now and I have a feeling I wasted my time analyzing the code last night :(
po1: ho, I read everything and use ALL your advice to reduce the size :(
just i didn't know that it was possible to replace m.cos too :|
and for the "window", i copy them from another compo entry (one of your advice), i will remove it :)
just i didn't know that it was possible to replace m.cos too :|
and for the "window", i copy them from another compo entry (one of your advice), i will remove it :)
well, PLASMA updated!
969 bytes and working under firefox now :)
I added the <body> tag to make it working...
969 bytes and working under firefox now :)
I added the <body> tag to make it working...
UPDATED a last time, 895 bytes!
Thank a lot for your help here (p01!) and on irc (LLB,Msk,Kernel_error...) ^_^
Thank a lot for your help here (p01!) and on irc (LLB,Msk,Kernel_error...) ^_^
I've played with Rez plasma and managed to shrink it to 763 bytes using some dirty tricks. I haven't read contest rules, so no idea if it's valid or not. I have tested it on Firefox and Opera.
http://www.ctrl-alt-test.fr/misc/plasma.html
(Rez, feel free to copy/reuse my optimizations)
http://www.ctrl-alt-test.fr/misc/plasma.html
(Rez, feel free to copy/reuse my optimizations)