Showing posts with label Fun With Script. Show all posts
Showing posts with label Fun With Script. Show all posts

Thursday, 7 July 2011

Disco Lights Javascript





Color Changing JavaScript Copy The Below JavaScript code in Notepad and save the file with .html extension. And You are Done. Open The file with browser and see the magic.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Animated Transparent PNG Bubbles in JavaScript</title>
<style type="text/css">
html, body {
    background: #000;
    color: #FFF;
    height: 100%;
}
body {
    margin: 0;
    overflow: hidden;
    padding: 0;
    position: relative;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
    empty-cells: show;
    height: 100%;
    width: 100%;
}
p, address {
    background: rgba(0, 0, 0, 0.25);
    font-family: Georgia;
    font-style: normal;
    margin: 0;
    padding: 5px;
    position: absolute;
}
p {
    left: 5px;
    max-width: 50%;
    top: 5px;
}
address {
    bottom: 5px;
    right: 5px;
    text-align: right;
}
td {
    /* border: 1px solid #000; */
    min-height: 0;
}
td img {
    border: 0;
    display:block;
    height: 100%;
    width: 100%;
    image-rendering: optimizeSpeed; /* Firefox 3.6 */
    -ms-interpolation-mode: nearest-neighbor; /* IE 7+ */
}
a{color:#FFF;}
a:hover{color:#06F;}
</style>
</head>
<body>


<script type="text/javascript">


var gridWidth = 3, gridHeight = 2;
var cellCount = gridWidth * gridHeight;


var w = Math.ceil(100 / gridWidth);
var h = Math.ceil(100 / gridHeight);
document.write('<table border="0" cellpadding="0" cellspacing="0">');
for (var r = 0; r < gridHeight; r++)
{
    document.write("<tr>");
    for (var c = 0; c < gridWidth; c++)
    {
        document.write('<td style="width:' + w + '%;height:' + h + '%"><img src="disco-floor.png"></td>');
    }
    document.write("</tr>");
}
document.write("</table>");


var elements = document.getElementsByTagName("TD");
var cells = new Array(elements.length);
// Copy the element collection into an array because it is faster
for (var i = 0; i < cells.length; i++)
{
    cells[i] = elements[i];
}


function colorFromHue(hue)
{
    var ramp = [255, 255 - Math.round(hue % 1 * 255), 0, 0, Math.round(hue % 1 * 255), 255];
    var i = Math.floor(hue % 6);
    return "rgb(" +
        ramp[ i         ] + "," +
        ramp[(i + 4) % 6] + "," +
        ramp[(i + 2) % 6] + ")";
}


var discoFloorHue = 0;
function animate()
{
    for (var i = cellCount; i--; )
    {
        //var i = Math.floor(Math.random() * cellCount);
        cells[i].style.backgroundColor = colorFromHue(discoFloorHue + Math.random() * 2);
    }
    discoFloorHue = (discoFloorHue + 0.5) % 6;
    window.setTimeout(animate, 1000 / 2);
}


animate();


</script>


<p>The idea was to create a nice full screen animation with very low CPU usage.
Firefox calculates the cell height a bit different.
<a href="#" onclick="this.parentNode.style.display='none';return false">Hide&nbsp;this&nbsp;text</a>.</p>


</body>
</html>

Color Changing On Text On Image JavaScript



Color Changing JavaScript Copy The Below JavaScript code in Notepad and save the file with .html extension. And You are Done. Open The file with browser and see the magic.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 


Transitional//EN" 


"http://www.w3.org/TR/html4/loose.dtd"> 
<html lang="de"> 
<head> 
<title>CSS2 Crosshairs Effect - Table Column and 


Row Hover for CSS2 Browsers</title> 
<style type="text/css"> 

body{
font-family:Georgia;
}
h1{
margin-top:0;
}
address{
font-style:normal;
text-align:right;
}

td:hover{
background:#F0F;
}
tr:hover{
background:#F00;
}
col:hover{
background:#00F;
}
.col2{
background:#FF0;
}

</style> 
</head> 
<body> 

        <h1>CSS&thinsp;2 Crosshairs Effect</h1> 

        <p>Table Column and Row Hover for CSS2 


Browsers</p> 

        <p>Uses <code>&lt;col&gt;</code> and 


<code>col:hover</code> to hover
            the columns. Although this is CSS2, it 


does not work with actual
            browsers (but will in the future).</p> 

        <table border="1" cellspacing="0" 


width="100%"> 
            <colgroup> 
                <col class="col1" /> 
                <col class="col2" /> 
                <col class="col3" /> 
                <col class="col4" /> 
                <col class="col5" /> 
            </colgroup> 
            <tr> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
            </tr> 
            <tr> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
            </tr> 
            <tr> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
            </tr> 
            <tr> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
            </tr> 
            <tr> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
                <td>Some Table Data</td> 
            </tr> 
        </table> 

        <p>Tested with:</p> 
        <ul> 
            <li>Mozilla 1.6, Firefox 0.8 (but does 


not hover the column)</li> 
            <li>Opera 7.5 (but does not hover the 


column)</li> 
            <li>Does <em>not</em> work with 


Internet Explorer 5.0, 6.0</li> 
        </ul> 


</body> 
</html>

Color Changing JavaScript



Color Changing JavaScript


Copy The Below JavaScript code in Notepad and save the file with .html extension. And You are Done. Open The file with browser and see the magic.


<html> 
<head> 
<title>Color Changing JavaScript</title> 
</head> 
<body id="x" onload="i=setInterval('x.bgColor=i++',9)"> 
</body> 
</html>

Thursday, 2 June 2011

Automatic color changing Background JavaScript


Automatic color changing Background JavaScript

<html> 
<head> 
<title>JavaScript Experiments: Color Cycle in 51 Bytes</title> 
</head> 
<body id="x" onload="i=setInterval('x.bgColor=i++',9)"> 
</body>
</html>

Save the above JavaScript code in notepad with .html extension. Open that file with browser and  see the magic. The background colors are changing Automaticlly. 

* If you execute the below script the color will change for every 5 seconds. 

<SCRIPT LANGUAGE="JavaScript">
function
 setbackground(){
window.setTimeout( "setbackground()", 5000);
var index = Math.round(Math.random() * 9);
var ColorValue = "#E6A9EC";
if(index == 1)
ColorValue = "FFCCCC";
if(index == 2)
ColorValue = "CCAFFF";
if(index == 3)
ColorValue = "A6BEFF";
if(index == 4)
ColorValue = "99FFFF";
if(index == 5)
ColorValue = "D5CCBB";
if(index == 6)
ColorValue = "99FF99";
if(index == 7)
ColorValue = "FFFF99";
if(index == 8)
ColorValue = "FFCC99";
if(index == 9)
ColorValue = "CCCCCC";
document.bgColor=ColorValue;
}
</SCRIPT>
<
BODY onLoad="setbackground();">
<
H1>Hello World</H1>
</
BODY>



After every 5 seconds background color will get changed :

Tuesday, 31 May 2011

Animated PNG Bubbles Images Moving in JavaScript



Save the Below JavaScript code in notepad with .html extension. Open that file with browser and  see the magic. One pointer is roaming on your screen.


<head> 
<title>danphp.com Animated Transparent PNG Bubbles in JavaScript </title> 
<style type="text/css"> 
html, body {
height: 100%;
}
body {
background: #FFF;
color: indigo;
margin: 0;
overflow: hidden;
padding: 0;
position: relative;
}
p, address {
background: rgba(100%, 100%, 100%, 0.25);
font-family: Georgia;
font-style: normal;
margin: 0;
padding: 5px;
position: absolute;
z-index: 1000;
}
p {
left: 5px;
max-width: 50%;
top: 5px;
}
address {
bottom: 5px;
right: 5px;
text-align: right;
}
a{color:indigo;}
a:hover{color:#909;}
img {
border: 0;
color: #000;
left: 0;
outline: 0;
position: fixed;
top: 0;
image-rendering: optimizeSpeed; /* Firefox 3.6 */
-ms-interpolation-mode: nearest-neighbor; /* IE 7+ */
}
img.off {
background: #DDD;
border: 1px solid #999;
}
</style> 
</head> 
<body> 
<script type="text/javascript"> 

var bubbleCount = 100;
var bubbleSource = "bubbles.png";
var bubbleSize = 256;
var scale = 1;
var windowWidth = window.innerWidth ? window.innerWidth : document.body.clientWidth;
var windowHeight = window.innerHeight ? window.innerHeight : document.body.clientHeight;

var useCssText = false, useTextContent = false, useInnerHTML = false;
var styleElement = document.createElement("STYLE");
//styleElement.innerHTML = "#dummy{}";
document.body.appendChild(styleElement);

// Firefox, Opera, Safari
if (document.styleSheets.length > 1 && typeof document.styleSheets[1].ownerNode != "undefined")
{
styleElement = document.styleSheets[1].ownerNode;
useTextContent = true;
}
// IE
else if (document.styleSheets.length > 1 && typeof document.styleSheets[1].cssText != "undefined")
{
styleElement = document.styleSheets[1];
useCssText = true;
}
else if (styleElement.ownerNode)
{
styleElement = styleElement.ownerNode;
useTextContent = true;
}
else
try
{
styleElement.innerHTML = "";
useInnerHTML = true;
}
catch (e) { }

var bubble = new Array(bubbleCount);
var c = document.createDocumentFragment();
for (var i = bubbleCount; i--; )
{
var d = document.createElement("IMG");
d.src = bubbleSource;
d.width = 256;
d.height = 256;
d.id = "b" + i;
d.alt = "Bubble";
c.appendChild(d);
bubble[i] =
{
"x": Math.floor(Math.random() * windowWidth),
"y": Math.floor(Math.random() * (windowHeight + 256)) - 128,
"z": 1 + Math.random() * 3,
"angle": Math.random() * 2 * Math.PI
};
}
document.getElementsByTagName("body")[0].appendChild(c);

function animate()
{
var speed;
var t = "";
var windowWidth = window.innerWidth ? window.innerWidth : document.body.clientWidth;
var windowHeight = window.innerHeight ? window.innerHeight : document.body.clientHeight;
var x, y, z, angle;
for (var i = bubbleCount; i--; )
{
angle = bubble[i].angle += 0.02;
z = bubble[i].z;
x = bubble[i].x;
y = bubble[i].y -= z;
if (y <= -128)
{
y = bubble[i].y = windowHeight + 128;
}

var s = 60 + z * 60;
s *= 0.8 + Math.sin(angle + Math.PI / 2) * 0.2;
if (s > 256) s = 256;
s = Math.round(s);
t += "#b" + i + "{left:" +
Math.round(x + Math.sin(angle) * 50 - s / 2) + "px;top:" +
Math.round(y - s / 2) + "px;";
if (scale > 1)
t += "-moz-transform:scale(" + (s / bubbleSize) + ");-o-transform:scale(" + (s 


/ bubbleSize) + ");-webkit-transform:scale(" + (s / bubbleSize) + ");";
else if (scale)
t += "width:" + s + "px;height:" + s + "px;";
t += "}";
}

if (useTextContent)
styleElement.textContent = t;
else if (useCssText)
styleElement.cssText = t;
else if (useInnerHTML)
styleElement.innerHTML = t;
else
styleElement.innerText = t;

window.setTimeout(animate, 1000 / 30);
}

animate();

/*
var start=new Date().getTime();
for(var i=200;i--;)animate();
var end=new Date().getTime();
document.getElementsByTagName("P")[0].firstChild.data = (end-start);
*/

function toggleScale()
{
scale = (scale + 1) % 3;
}

function clearImages()
{
bubbleSize = 64;
var e = document.getElementsByTagName("IMG");
for (var i = e.length; i--; )
{
if (e[i].src.indexOf(".png") < 0)
{
e[i].src = "bubbles.png";
bubbleSize = 256;
}
else if (e[i].src.indexOf("bubbles.png") >= 0)
{
e[i].src = "bubbles_64.png";
}
else
e[i].src = "#";
e[i].width = e[i].height = e[i].src.indexOf


bubbles.pngpng") >= 0 ? 256 : 64;
e[i].className = e[i].src.indexOf(".png") < 0 ? "off" : "";
}
}

</script> 

</body> 
</html>


Click Here For JavaScript Basic Notes

Pointer Moving JavaScript


Save the Below JavaScript code in notepad with .html extension. Open that file with browser and  see the magic. One pointer is roaming on your screen.

<html>
<head>
<title>JavaScript Experiments: Breakout Game</title>
</head>
<body scroll=no onmousemove="p=event.clientX"><b id=s>o<script>x=y=a=b=p=2;f=s.style;f.position='absolute';M=Math.abs;
g=document.body;setInterval("if(x<0|x>g.clientWidth)a=-a;if(y<0|M(y-g.clientHeight+9)<2&M(x-p)<50)b=-b;f.left=x+=a;f.top=y+=b",9)</script>

Click Here For JavaScript Basic Notes

Monday, 30 May 2011

Animated Colors Moving JavaScript



Save the Below JavaScript code in notepad with .html extension. Open that file with browser and  see the magic. The colors are moving on the browser.







<html> 
<head> 
<title>Animated Fullscreen Radar with JavaScript</title> 
<style type="text/css"> 
body{
background:#000;
color:#FFF;
margin:0;
overflow:hidden;
padding:0;
}
address{
bottom:10px;
font-family:Georgia,sans;
font-style:normal;
position:absolute;
right:10px;
text-align:right;
}
a:link,a:visited{
color:#CCC;
}
a:hover{
color:#FFF;
}
td{
}
</style> 
<script type="text/javascript"> 

var size = 9;

var phase = 0;
var divisor = 10;

function drawFrame()
{

  for (var debugY = 0; debugY < size; debugY++)
  {
    for (var debugX = 0; debugX < size; debugX++)
    {
      x = debugX / (size - 1) * 255;
      y = debugY / (size - 1) * 255;

      r = 0;
      g = 0;
      b = 0;

      /* ACE: COPY FROM HERE */
/*
      x = x - 128;
      y = y - 128;
      g = 255 - Math.floor(phase * 10 - Math.sqrt(x * x + y * y) * 2) % 256;
      r = 128 + Math.floor(g / 2);
*/
      /* BIS HERE */

/*
Doppelradar
      x = x - 128;
      y = y - 128;
      r = 256 - (Math.floor(phase * 6 - Math.atan(y / (x + 0.001)) / Math.PI * 


256)) % 256;
*/

//Einfaches Radar
      x = x - 128;
      y = y - 128;
      w = Math.atan(y / (x + 0.001));
      if (x < 0) w += Math.PI;
      r = Math.floor(phase * 5 - w / Math.PI * 256);
      r = 256 - r % 512;
      if (r > 255) r = 0;
      b = 64 - r / 4;

      color = "rgb(" + r + "," + g + "," + b + ")";
      document.getElementById("x" + debugX + "y" + debugY).style.backgroundColor 


= color;

    }
  }

  phase++;

  window.setTimeout('drawFrame()', 50);
}

</script> 
</head> 
<body onload="drawFrame()"> 

<script type="text/javascript"> 
document.write('<table border="0" cellpadding="0" cellspacing="0" height="100%" 


width="100%">');
for (var y = 0; y < size; y++)
{
  document.write('<tr>');
  for (var x = 0; x < size; x++)
  {
    document.write('<td id="x' + x + 'y' + y + '">&nbsp;</td>');
  }
  document.write('</tr>');
}
document.write('</table>');
</script>  
</body> 
</html>



Click Here For JavaScript Basic Notes

Friday, 27 May 2011

Colors Moving Changing JavaScript





Save the Below JavaScript code in notepad with .html extension. Open that file with browser and  see the magic. The colors are moving on the browser. 


JavaScript: 





<html> 
<head> 
<title>Animated Fullscreen Plasma with JavaScript</title> 
<style type="text/css"> 
body{
background:#000;
color:#FFF;
margin:0;
overflow:hidden;
padding:0;
}
address{
bottom:10px;
font-family:Georgia,sans;
font-style:normal;
position:absolute;
right:10px;
text-align:right;
}
a:link,a:visited{
color:#CCC;
}
a:hover{
color:#FFF;
}
td{
}
</style> 
<script type="text/javascript"> 

var size = 11;

var phase = 0;
var divisor = 10;

function drawFrame()
{

  for (var debugY = 0; debugY < size; debugY++)
  {
    for (var debugX = 0; debugX < size; debugX++)
    {
      x = debugX / size * 255;
      y = debugY / size * 255;

      r = 255;
      g = 255;
      b = 255;
//      r = Math.ceil(Math.sin(phase / divisor) * 127) + 127;
//      g = Math.ceil(Math.sin(phase / divisor + (Math.PI / 3 * 2)) * 127) + 127;
//      g = Math.ceil(Math.sin(x*y/5000) * 127) + 127;
//      g = Math.ceil(Math.sin(x/30+phase/4) * 127) + 127;
//      g = Math.ceil(Math.sin(x*y/5000) * 63 + Math.sin(x/30+phase/4) * 63) + 127;

//      g = Math.ceil(Math.sin(y/30+phase/4) * 127) + 127;
//      r = Math.ceil(Math.sin(x/50+phase/5) * 127) + 127;
//      b = Math.ceil(Math.sin((x+y)/50+phase/5) * 127) + 127 + 64;

      b = Math.sin(x/50-phase/6) * Math.cos(y/70) * 127 + 127;
      r = Math.sin(x/70) * Math.cos(y/50-phase/5) * 127 + 127;
      g = (b + r) / 2;

//      b = Math.ceil(Math.sin(phase / divisor + (Math.PI / 3 * 4)) * 127) + 127;

      color = "rgb(" + Math.round(r) + "," + Math.round(g) + "," + Math.round(b) + ")";
      document.getElementById("x" + debugX + "y" + debugY).style.backgroundColor = color;

    }
  }

  phase++;

  window.setTimeout('drawFrame()', 50);
}

</script> 
</head> 
<body onload="drawFrame()"> 

<script type="text/javascript"> 
document.write('<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">');
for (var y = 0; y < size; y++)
{
  document.write('<tr>');
  for (var x = 0; x < size; x++)
  {
    document.write('<td id="x' + x + 'y' + y + '">&nbsp;</td>');
  }
  document.write('</tr>');
}
document.write('</table>');
</script>  
</body> 
</html>

Thursday, 26 May 2011

Free Fire Animation In JavaScript


Free Fire Animation In JavaScript. Save the blow JavaScript code with .html extension and see the 3d fire animation. If you Like My script Please do Comment.  

<html> 
<head> 
<meta http-equiv="content-type" content="text/html; charset=ISO-

8859-1"> 
<title>ASCII Fire Animation with JavaScript</title> 
<meta name="author" content="Thiemo Mättig"> 
<style type="text/css"> 
body{
background:#000;
color:gold;
height:100%;
margin:0;
padding:0;
width:100%;
}
a{color:gold;}
a:hover{color:#FF0;}
address{
bottom:10px;
font-family:Georgia;
font-style:normal;
position:absolute;
right:10px;
text-align:right;
}
</style> 
</head><body> 

<center style="height: 100%;"> 
 <table height="100%"> 
  <tbody><tr> 
   <td> 
    <b> 
     <pre id="o">This animated fire in plain ASCII art needs 

JavaScript to run in your web browser.</pre> 
    </b> 
   </td> 
  </tr> 
 </tbody></table> 
</center> 

<script type="text/javascript"> 
var size = 80 * 25;
var b = [];
for (i = 0; i < size + 81; i++)
  b[i] = 0;
var char = " .:*sS#$".split("");
var e = document.getElementById("o").firstChild;

function f()
{
  for (i = 0; i < 10; i++)
    b[Math.floor(Math.random() * 80) + 80 * 24] = 70;
  a = "";
  for (i = 0; i < size; i++)
  {
    b[i] = Math.floor((b[i] + b[i + 1] + b[i + 80] + b[i + 81]) / 

4);
    a += char[b[i] > 7 ? 7 : b[i]];
    if (i % 80 > 78)
      a += "\r\n";
  }
  e.data = a;
  setTimeout(f, 30);
}
f();
</script> 
  
</body> 
</html>




Tuesday, 24 May 2011

3d dots move along with Javascript


3d dots move along with Javascript

Save the blow code with .html extension and see the 3d dots rotating along with the mouse cursor.


<html>
<head>
<title>Rotating 3D Cube in JavaScript</title>
<style type="text/css">
body{background:#000;color:#FF0;height:100%;margin:0;padding:0;width:100%;}
b{position:absolute;}
a{color:gold;}
a:hover{color:#FF0;}
address{bottom:10px;font-family:Georgia;font-style:normal;position:absolute;right:10px;text-

align:right;}
</style>
</head>
<body onmousemove="a = event.clientX / 99; b = event.clientY / 99;">

<script type="text/javascript">

/* I wrote this script in a few minutes just for fun. It's not made to win any
   competition. */

var dimension = 1, a = 0, b = 0, i = 27;
while (i--) document.write('<b id="l' + i + '">+</b>');

function f()
{
    i = 0;
    for (x = -dimension; x <= dimension; x += dimension)
        for (y = -dimension; y <= dimension; y += dimension)
            for (z = -dimension; z <= dimension; z += dimension)
            {
                u = x;
                v = y;
                w = z;
                u2 = u * Math.cos(a) - v * Math.sin(a);
                v2 = u * Math.sin(a) + v * Math.cos(a);
                w2 = w;
                u = u2; v = v2; w = w2;
                u2 = u;
                v2 = v * Math.cos(b) - w * Math.sin(b);
                w2 = v * Math.sin(b) + w * Math.cos(b);
                u = u2; v = v2; w = w2;
                var c = Math.round((w + 2) * 70);
                if (c < 0) c = 0;
                if (c > 255) c = 255;
                s = document.getElementById('l' + i).style;
                s.left = 300 + u * (w + 2) * 50;
                s.top  = 300 + v * (w + 2) * 50;
                s.color = 'rgb(' + c + ', ' + c + ', 0)';
                s.fontSize = (w + 2) * 16 + 'px';
                /* The Digg users missed depth sort, so here it is. */
                s.zIndex = Math.round((w + 2) * 10);
                i++;
            }
}

/* Using a timer instead of the onmousemove handler wastes CPU time but makes
   the animation much smoother. */
setInterval('f()', 17);

</script>
</body>
</html>



If You Like the post please feel free to comment. 

Monday, 23 May 2011

3d rotating Text JavaScript




3d rotating Text JavaScript




Save the blow code with .html extension and see the 3d text rotating. You can also give the URL addresses to those text. Find # in the below code and replace with the URL which you want to give and see the magic. 


<html> 
<head> 
<title>Rotating 3D Tag Cloud in JavaScript</title> 
<style type="text/css"> 
body{background:#DDD;color:#000;}
a{color:#009;}
a:hover{color:#00F;}
address{font-family:Georgia;font-style:normal;text-align:right;}
#tagcloud{
background:#FFF;
border:1px solid #000;
font:14px Verdana,sans-serif;
height:400px;
overflow:hidden;
position:relative;
width:400px;
}
#tagcloud ul,#tagcloud li{
list-style:none;
margin:0;
padding:0;
}
#tagcloud a{
/* background:#FFF;
border:1px solid #FFF; */
color:#000;
left:50%;
line-height:1.2em;
margin:-0.6em 0 0 0;
padding:0 0.2em;
position:absolute;
text-align:center;
text-decoration:none;
top:50%;
}
#tagcloud a:hover{
background:#FFF;
border:1px solid #00F;
z-index:1000 !important;
}
</style> 
</head> 
<body> 

<h1>Rotating 3D Tag Cloud in JavaScript</h1> 

<div id="tagcloud" onmousemove="stepping = (event.clientY - container.offsetTop) / container.offsetHeight * 0.2 - 0.1;"> 
<ul> 
<li><a href="#">ajax</a></li> 
<li><a href="#">bücher</a></li> 
<li><a href="#">barcamp</a></li> 
<li><a href="#">barrierefrei</a></li> 
<li><a href="#">css</a></li> 
<li><a href="#">design</a></li> 
<li><a href="#">firefox</a></li> 
<li><a href="#">flash</a></li> 
<li><a href="#">html</a></li> 
<li><a href="#">ie</a></li> 
<li><a href="#">interview</a></li> 
<li><a href="#">jquery</a></li> 
<li><a href="#">PHP</a></li> 
<li><a href="#">SEO</a></li> 
<li><a href="#">usability</a></li> 
<li><a href="#">xhtml</a></li> 
</ul> 
</div> 

<script type="text/javascript"> 

var a = 0, b = 0, e;
var offA = 0, stepping = 0.01;
var container = document.getElementById("tagcloud");

window.onload = function()
{
e = container.getElementsByTagName("A");
for (var i = e.length - 1; i >= 0; i--)
{
e[i].tcAngle = i * Math.PI * 2 / e.length;
}

setInterval(function()
{
for (var i = e.length - 1; i >= 0; i--)
{
var angle = e[i].tcAngle + offA;
x = 50 + Math.sin(angle) * 20;
y = 50 + Math.cos(angle) * 40;
tcSize = Math.round(20 - Math.sin(angle) * 10);

// y = (y - 50) * (200 - x * 2) * 0.01 + 50;

e[i].style.fontSize = tcSize + "px";
e[i].style.zIndex = tcSize;
e[i].style.left = (container.offsetWidth * x / 100 - e[i].offsetWidth / 2) + "px";
e[i].style.top  = y + "%";
}
offA += stepping;
}, 17);
}

</script> 

<address>&copy; <a href="http://www.danphp.com/">Dinesh Kumar</a>,
</body> 
</html>


If you like the Trick Please comment on my posts. 

Sunday, 22 May 2011

Text Dancing JavaScript


Copy The Below JavaScript code in Notepad and save the file with .html extension. And You are Done. Open The file with browser and see the magic. 




<html> 
<head> 
<title>Don't use Frames</title> 
<style type="text/css"> 
body{background:#FFF;color:#333;font-family:Georgia;margin:0;overflow:hidden;padding:0;text-align:center;}
h1{font-size:250%;margin:5em 0;}
h1 span{padding:0 3px;position:relative;}
a{color:#666;}
a:hover{color:#00F;}
address{bottom:10px;font-style:normal;position:absolute;right:10px;text-align:right;}
</style> 
<script type="text/javascript"> 

var n = 0;
function animate()
{
var e = document.getElementsByTagName("SPAN");
for (var i = e.length - 1; i >= 0; i--)
{
var s = Math.sin(n - i) * 10;
var t = Math.cos(n - i) * 10;
e[i].style.top = Math.round(s) + "px";
e[i].style.left = Math.round(t) + "px";
var c = 6 - Math.sin(n - i + 2) * 5;
e[i].style.textShadow = "#999 " + Math.round(c / 2) + "px " + Math.round(c) + "px 4px";
}
n += 0.2;
}
function start()
{
window.setInterval(animate, 20);
}

</script> 
</head> 
<body onload="start()"> 

<table cellpadding="0" cellspasing="0" height="100%" width="100%"> 
<tr> 
<td align="center"> 

<h1><span>D</span><span>o</span><span>n</span><span>'t</span><span> u</span><span>s</span><span>e</span><span> F</span><span>r</span><span>a</span><span>m</span><span>e</span><span>s.</span></h1> 

</td> 
</tr> 
</table> 

</body> 
</html>


If you Like the Post please feel free to comment .