Advertisement
dnwmfilms

↳ ❝ [bubble] ¡! ❞

Nov 6th, 2021
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. <style>
  2. #bubble {
  3. color:#EBF0FF;
  4. font-family:Times;
  5. font-size:45px;
  6. font-weight:bold;
  7.  
  8. }
  9.  
  10. </style>
  11.  
  12. <span id="bubble">bubble</span>
  13. <script type="text/javascript">
  14. // <![CDATA[
  15. var bgcolour="#D6E1FF"; // background colour
  16. var fgcolour="#B8CBFF"; // foreground colour
  17. var speed=80; // speed of bubbling, lower is faster
  18. var shades=12; // number of shades of bubble
  19.  
  20. /****************************
  21. * Bubbling Text Effect *
  22. *(c)2003-13 mf2fm web-design*
  23. * http://www.mf2fm.com/rv *
  24. * DON'T EDIT BELOW THIS BOX *
  25. ****************************/
  26. var bubbcol=new Array();
  27. var bubbshd;
  28. var bubbler, bubbtxt;
  29. var bubbchr=new Array();
  30.  
  31. function addLoadEvent(funky) {
  32. var oldonload=window.onload;
  33. if (typeof(oldonload)!='function') window.onload=funky;
  34. else window.onload=function() {
  35. if (oldonload) oldonload();
  36. funky();
  37. }
  38. }
  39.  
  40. addLoadEvent(bubbagump);
  41.  
  42. function bubbagump() { if (document.getElementById) {
  43. var i, fg, bg, col;
  44. for (bubbler=0; bubbler<=shades; bubbler++) {
  45. col="#";
  46. for (i=1; i<6; i+=2) {
  47. bg=parseInt(bgcolour.substring(i,i+2),16);
  48. fg=parseInt(fgcolour.substring(i,i+2),16);
  49. col+=dechex(bg+(fg-bg)*(bubbler/shades));
  50. }
  51. bubbcol[bubbler+1]=col;
  52. if (bubbler==Math.floor(shades/2)) bubbshd=col;
  53. }
  54. bubbler=document.getElementById("bubble");
  55. bubbtxt=bubbler.firstChild.nodeValue;
  56. while (bubbler.childNodes.length) bubbler.removeChild(bubbler.childNodes[0]);
  57. for (i=0; i<bubbtxt.length; i++) {
  58. fg=document.createElement("span");
  59. fg.setAttribute("id", "bubb"+i);
  60. fg.style.textShadow=bubbshd+" 0px 0px 2px";
  61. fg.appendChild(document.createTextNode(bubbtxt.charAt(i)));
  62. bubbler.appendChild(fg);
  63. }
  64. bubbler=setInterval("bubbling()", speed);
  65. }}
  66.  
  67. function dechex(dec) {
  68. dec=Math.floor(dec);
  69. return ((dec<16)?'0':'')+dec.toString(16);
  70. }
  71.  
  72. function bubbling() {
  73. var i, bubby;
  74. for (i=0; i<bubbtxt.length; i++) {
  75. bubby=document.getElementById("bubb"+i);
  76. if (bubbchr[i]) {
  77. bubby.style.color=bubbcol[bubbchr[i]];
  78. bubbchr[i]=(bubbchr[i]+1)%bubbcol.length;
  79. }
  80. else if (Math.random()<7.5/(shades*bubbtxt.length)) bubbchr[i]=1;
  81. }
  82. }
  83. // ]]>
  84. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement