Solved

VB fade through color script?

Posted on 1997-03-30
1
217 Views
Last Modified: 2013-12-25
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.
0
Comment
Question by:onlinemike
1 Comment
 
LVL 1

Accepted Solution

by:
topaz56 earned 50 total points
ID: 1854036
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>
<HEAD>
<TITLE></TITLE>
<HEAD>

<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:
 *   fade(inr,ing,inb, outr,outg,outb, step);
 * example.
 *   fade(0,0,0, 255,255,255, 255);
 * fade from black to white with very slow speed.
 *   fade(255,0,0, 0,0,255, 50);
 *   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.
 */
function fadein() {
    fade(255,255,255, 0,0,0, 64);
}
function fadeout() {
    /*fade(0,0,0, 255,255,255, 64); */
}
/* do fadein */
fadein();

---->

</SCRIPT>
</HEAD>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now