jakeandamir

Better Rainbow Text cr Matt Hedgecoe

Aug 19th, 2021 (edited)
158
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2.  
  3. /*
  4. RAINBOW TEXT Script by Matt Hedgecoe (c) 2002
  5. Featured on JavaScript Kit
  6. For this script, visit http://www.javascriptkit.com
  7. */
  8.  
  9. // ********** MAKE YOUR CHANGES HERE
  10.  
  11. var text="RAINBOW TEXT" // YOUR TEXT
  12. var speed=80 // SPEED OF FADE
  13.  
  14. // ********** LEAVE THE NEXT BIT ALONE!
  15.  
  16.  
  17. if (document.all||document.getElementById){
  18. document.write('<span id="highlight">' + text + '</span>')
  19. var storetext=document.getElementById? document.getElementById("highlight") : document.all.highlight
  20. }
  21. else
  22. document.write(text)
  23. var hex=new Array("00","14","28","3C","50","64","78","8C","A0","B4","C8","DC","F0")
  24. var r=1
  25. var g=1
  26. var b=1
  27. var seq=1
  28. function changetext(){
  29. rainbow="#"+hex[r]+hex[g]+hex[b]
  30. storetext.style.color=rainbow
  31. }
  32. function change(){
  33. if (seq==6){
  34. b--
  35. if (b==0)
  36. seq=1
  37. }
  38. if (seq==5){
  39. r++
  40. if (r==12)
  41. seq=6
  42. }
  43. if (seq==4){
  44. g--
  45. if (g==0)
  46. seq=5
  47. }
  48. if (seq==3){
  49. b++
  50. if (b==12)
  51. seq=4
  52. }
  53. if (seq==2){
  54. r--
  55. if (r==0)
  56. seq=3
  57. }
  58. if (seq==1){
  59. g++
  60. if (g==12)
  61. seq=2
  62. }
  63. changetext()
  64. }
  65. function starteffect(){
  66. if (document.all||document.getElementById)
  67. flash=setInterval("change()",speed)
  68. }
  69. starteffect()
  70. </script>
RAW Paste Data