John Delmark Aguilar

Delmark - Profiling
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 

 [JS] Rainbow Spinner CSS

View previous topic View next topic Go down 

Posts : 92
Join date : 09/04/2012

PostSubject: [JS] Rainbow Spinner CSS   Fri Feb 28, 2014 2:19 pm

<!--<script language="JavaScript" src="rainbowspinner.js"></script>-->

<body onload="starts()">

<script type="text/javascript">
function toSpans(span) {
 var a=str.length;
 for(var i=0; i<a; i++) {
  var theSpan=document.createElement("SPAN");
function RainbowSpinner(span, hue, deg, brt, spd, hspd) {
RainbowSpinner.prototype.shiftRainbow = function() {
 if(this.hue>359) this.hue-=360;
 var color;
 var b=this.brt;
 var a=this.length;
 var h=this.hue;
 for(var i=0; i<a; i++) {
  if(h>359) h-=360;
  if(h<60) { color=Math.floor(((h)/60)*b); red=b;grn=color;blu=0; }
  else if(h<120) { color=Math.floor(((h-60)/60)*b); red=b-color;grn=b;blu=0; }
  else if(h<180) { color=Math.floor(((h-120)/60)*b); red=0;grn=b;blu=color; }
  else if(h<240) { color=Math.floor(((h-180)/60)*b); red=0;grn=b-color;blu=b; }
  else if(h<300) { color=Math.floor(((h-240)/60)*b); red=color;grn=0;blu=b; }
  else { color=Math.floor(((h-300)/60)*b); red=b;grn=0;blu=b-color; }
  this.span.childNodes[i].style.color="rgb("+red+", "+grn+", "+blu+")";

<span id="rainbowTarget">full color!</span>
<script type="text/javascript">
// start rainbow animation
var rainbowTarget=document.getElementById("rainbowTarget"); 
var myRainbowSpinner=new RainbowSpinner(rainbowTarget, 0, 360, 255, 50, 4);
myRainbowSpinner.timer=window.setInterval("myRainbowSpinner.shiftRainbow()", myRainbowSpinner.speed);

Back to top Go down
View user profile
[JS] Rainbow Spinner CSS
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
John Delmark Aguilar :: dElmARk Productions :: Web Coding-
Jump to: