We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

# VB fade through color script?

on
Medium Priority
264 Views
What is the script that fades the current page your looking at through a color to a new page.  Example your looking at a page then it fades to black and a new page appears.
Comment
Watch Question

## View Solution Only

Commented:
Hi...

This was quick NCAA on in a few min...

The script is basically below...

Easy to hack around w/, as you're just playing w/ a couple of arrays to generate the "#xxxxxx" hex colors...

Best, Tom

<HTML>
<TITLE></TITLE>

<SCRIPT LANGUAGE="JavaScript">

<!---

function makearray(n) {
this.length = n;
for(var i = 1; i <= n; i++)
this[i] = 0;
return this;
}
hexa = new makearray(16);
for(var i = 0; i < 10; i++)
hexa[i] = i;
hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
hexa[13]="d"; hexa[14]="e"; hexa[15]="f";
function hex(i) {
if (i < 0)
return "00";
else if (255 < i)
return "ff";
else
return "" + hexa[Math.floor(i/16)] + hexa[i%16];
}
function setbgColor(r, g, b) {
var hr = hex(r); var hg = hex(g); var hb = hex(b);
document.bgColor = "#"+hr+hg+hb;
}
function fade(sr, sg, sb, er, eg, eb, step) {
for(var i = 0; i <= step; i++) {
setbgColor(
Math.floor(sr * ((step-i)/step) + er * (i/step)),
Math.floor(sg * ((step-i)/step) + eg * (i/step)),
Math.floor(sb * ((step-i)/step) + eb * (i/step)));
}
}
/* Usage:
* example.
* fade from black to white with very slow speed.
*   fade(0xff,0x00,0x00, 0x00,0x00,0xff, 50); // same as above
* fade from red to blue with fast speed.
* step 2 is very fast and step 255 is very slow.
*/
}
}

---->

</SCRIPT>

Not the solution you were looking for? Getting a personalized solution is easy.

##### Thanks for using Experts Exchange.

• View three pieces of content (articles, solutions, posts, and videos)
• Ask the experts questions (counted toward content limit)
• Customize your dashboard and profile