Topic: 256b rubber effect in JavaScript (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=29845" title="Pages that link to Topic: 256b rubber effect in JavaScript (Page 1 of 1)" rel="nofollow" >Topic: 256b rubber effect in JavaScript <span class="small">(Page 1 of 1)</span>\

 
poi
Paranoid (IV) Inmate

From: Norway
Insane since: Jun 2002

posted posted 01-06-2008 16:11



Pouet.net's recent 256b Twister "war" on C64 intrigued me to the point of trying to write a similar effect, a rubber, in 256 bytes in JavaScript.

Hope you'll enjoy the result.

/!\ the effect looks a bit different in Firefox :\

argo navis
Bipolar (III) Inmate

From: Switzerland
Insane since: Jul 2007

posted posted 01-06-2008 16:29

Quickie : IE7, does not start. Op 9.25, looks funny. FF 2, looks great - and as interlaced as a C64 display
256 bites -> I hate you. <insert fake mad looks here>

iron_wallaby
Nervous Wreck (II) Inmate

From:
Insane since: Dec 2007

posted posted 01-06-2008 17:45

That's pretty rockin'. I'm impressed particularly by the clever use of borders -- that's a technique I havn't seen before, and must now play with.

poi
Paranoid (IV) Inmate

From: Norway
Insane since: Jun 2002

posted posted 01-06-2008 23:40

Thanks mates.

IW: He he, borders can be used and abused in so many ways. Have you heard about border slants ? I basically used this technique to make the 3D city effect in Neja. Also in october, someone implemented an idea I had a couple of years ago ( I thought there was some corner cases where it would not work or be too expensive ) to draw arbitrary triangles by subdivision into right triangles using border slants.

wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 01-06-2008 23:51

poi: Funky ^^ Though there is an odd 'flipping' effect in the shading for me (firefox on OSX).

Also, for the 3d, rather than 10 div's, couldn't you do it with one rectangular divs, and 3 right angled triangles to 'cut out' the difference? Sorry if there's an obvious reason why not, I'm a little sleepy :S

poi
Paranoid (IV) Inmate

From: Norway
Insane since: Jun 2002

posted posted 01-07-2008 01:06

wrayal: That'd work only if you want to draw a single triangle on a solid color backgrond which is a pretty limited use case
Also the 10 DIVs where just an example. The subdivision process can lead to different number of DIVs / right triangles.

As for the flipping effect, I believe that's an optical effect due to the persistence of vision. There's no flipping when slowing down the effect ( add O+=.1 outside the loop ), so the maths are correct.

Suho1004
Maniac (V) Mad Librarian

From: Seoul, Korea
Insane since: Apr 2002

posted posted 01-07-2008 01:50

You people just blow my mind.

wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 01-07-2008 03:24

Ah, ok ^_^
Sorry, I thought you could use z-index tricks - do the backmost triangle first, then just let the spares overlay or...something stupid. Sleepy brain finally sees why overlapping would prevent more than one at a time.

Suho: Indeed; IW, poi, argo...some of the people around here are much too clever :P But come join in our 20 liner contests, they're good fun ^_^

poi: I'd never thought about rubber before but...surely there's some dynamics fun to be had with manipulation of this in say...20 lines? ;p



(Edited by wrayal on 01-07-2008 03:25)



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu