»
EnglishFrenchVietnamese

Print - Shrinking Text effect - JavaScriptBank.com

Full version: jsB@nk » Text » Animation » Shrinking Text effect
URL: https://www.javascriptbank.com/shrinking-text-effect.html

Shrinking Text effect © JavaScriptBank.comShrinking Text will display your text with the size grow up, then shrink off it.

Full version: jsB@nk » Text » Animation » Shrinking Text effect
URL: https://www.javascriptbank.com/shrinking-text-effect.html



JavaScript
<script language="JavaScript">var speed = 5; //speed of text can be changedvar count = 10;var direction = 1;var firstLine = "Text growing";var fontStyle = [ "serif", "sans-serif", "monospace", "dolphin" ]; //style of text can be changedvar fontStylecount = 0;function start()  //start function{  window.setInterval( "run()", 100 );}function run()  //run function{  count += speed;  if ( ( count % 200) == 0) {speed*= -1;direction = !direction; // this changed the color if text is shrinking instead of growingpText.style.color =   ( speed < 0 ) ? "red" : "blue" ; // colors can be changed red is the shrinking blue is growing textfirstLine = ( speed < 0 ) ? "Text shrinking" : "Text growing";pText.style.fontFamily = fontStyle[ ++fontStylecount % 3 ];}pText.style.fontSize = count / 3;pText.style.left = count;//pText.innerHTML = firstLine + "<br> Font size: " + count + "px"; // prints out size of text I have it commented out but left it for designing purposes you may impliment it if you wish}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<body onload="start()"><p id="pText" style="position: relative; color: blue;">JavaScriptBank.com - Bank of over 2000+ free JavaScripts</p></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->