OZONE Asylum
Forums
DHTML/Javascript
20 liners - a holiday special
This page's ID:
29806
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
[url=http://www.beyondwonderland.com/knowledge/javascript/20liners/December_2007/index.html]Am through with the Swiss cheese so I got bored[/url] ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- (a couple of hours later..) Okay, send in master Suho. I have a BAD addiction problem now - I can't, for the love of me, sit still and watch a darn movie or do anything but get back to these snowflakes. OR, send in an exorcist. I may be possessed by the spirit of poi :) Or send both. Either cases I need help. [url=http://www.beyondwonderland.com/knowledge/javascript/20liners/December_2007/index.html]Beta 0.8 is up and running.[/url] Some tips and tricks and technicalities for further reference : - I have declared all my globals as items of an array named "globals". I feel this is legit, contradict me as needed : two integers, two array pointers to store references. - I have used the "for" constructs in a now famous way, and crammed one extra instruction inside each one of those. - I have used a bunch of "multiple assignments" like var = stuff = 0. But that's as far as it gets for the packing and bypassing "laws of readable programming" :) For the speed optimisations : - Static image snowflakes rather than Flash is good (since version 0.4 that is). - Alpha blended, png "flakes" are slower to animate than simple gif or 8 bit png (makes sense : all the blending is calculated at runtime afaik, adds some overhead). - My pc is the same crap laptop I have been using for years so it's a centrino from way back, with 512MB ram - it should work faster on your pc. - Other than that, with succesful tests including 64 sprites that are zooming, rotating, and moving in 3d, I am a happy man. - I used bitwise operators, with the modulo trick : "% 8" became bitwise "& (8-1)" at some point. Currently it is "% 4" but reads "& 3" ,) Go ask Alice for details. - I used bitwise operators for some mults also : << 2 should read "multiply by 4". The rest will get some cos/sin lookup tables, some valid xhtml and strict mode, and that should be it for speed improvements. Once I am through with those, I will be left with... 4 lines of sound javascript to play with :D Like : 25% of the code currently in use. @Wrayal : the "sprite rotate trick" could certainly be used in your entry in some way, but I probably won't have time to include it myself. Now, some stats... ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Background image + all anims =~ 200KBs of jpg/png data, respectively. Well, what do you mean, "heavy"?-) It's a high res picture and a png 24 transparent picture containing a full animation!! Bite me. There are 48 stars, I have made tests with 64, I can get it up to 96 : maybe more, it all depends on removing those nasty "Math.cos" and "parseInt" constructs and how much speed that will gain. ...Warming up was fun. Anybody else dares to submit something or have I scared you all into hibernation already? :cool: [small](Edited by [url=http://www.ozoneasylum.com/user/6553]argo navis[/url] on 12-27-2007 23:29)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »