Closed Thread Icon

Preserved Topic: Animated Color Transitions? Math? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18309" title="Pages that link to Preserved Topic: Animated Color Transitions? Math? (Page 1 of 1)" rel="nofollow" >Preserved Topic: Animated Color Transitions? Math? <span class="small">(Page 1 of 1)</span>\

 
Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 12-08-2001 05:38

I tried... I failed... I tried again... But I failed again

I'm just don't seem to have as good a grasp of maths that many of you do.

I want to set up a loop that will fade one colour to another using hex values. Say I give it #FF00AA and #0099FF want to display 20 progressive colours between those two values.

Did I mention I hated Hex values?

Or some good links on Javascript's Hexadecimal related functions should be enough to get the ball rolling for me.

Any Help would be muchly appreciated.

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 12-08-2001 10:04

Just take a look at the source code of Nifty Text...


InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 12-08-2001 13:13

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 12-08-2001 14:58

Actualy I figured out an even easier way to do it.


code:
function toHex(dec){			// Takes an integer
result = parseInt(dec).toString(16)
if (result.length == 1) result = ('0' + result)
retuen (result.toUpperCase()) // Returns a string
}


function toDec(hex){ // Takes a string
var result = parseInt(hex,10)
retuen (result) // Returns an integer
}




I keep forgeting about Netscapes old JS reference. It Comes in handy sometimes..

<edit>
Oh the if (result.length == 1) result = ('0' + result) is there bacause I only intend to return 2 digit hex values from it (0 - 255 base 10 decimal). If you wanted to use it for anything higher then you'd have alter that bit.
</edit>

[This message has been edited by Dracusis (edited 12-08-2001).]

« BackwardsOnwards »

Show Forum Drop Down Menu