JavaScripts -> Texteffekt -> Color Fader
Dieses Script ändert die Farbe des Textes zufällig.
Kompatibilität getestet:
Script-Code
<script type="text/javascript">
<!--
// = = ================================================================ = =
// = = Color Fader v1.0 (c) 2004 Triple-M / http://www.htmlarsenal.de = =
// = = ================================================================ = =
// ------------------------------------------------------------------------
// -- Dieses Script und viele andere im --
// -- This script and many more in the --
// ------------------------------------------------------------------------
// -- HTML ARSENAL - Die Quelle für HTML, JavaScript, PHP --
// -- HTML ARSENAL - Your Source for HTML, JavaScript, PHP --
// ------------------------------------------------------------------------
// -- -= http://www.htmlarsenal.de =- --
// ------------------------------------------------------------------------
// Sie dürfen dieses Script für nicht-kommerzielle Zwecke nutzen, wenn diese Urheber-Notiz erhalten bleibt.
// You may use this Script for non-commercial causes as long as you include this copyright notice.
// Benutzung:
// ==========
// Fügen Sie an der Stelle Ihres Dokumentes, an der die farbveränderliche Schrift erscheinen soll, ein
// Script mit dem Inhalt
// colorfader("Text","#abcdef");
// ein. Text ist dabei Ihr Text, und #abcdef eine Farbangabe im HTML-Format, die die Ausgangsfarbe bestimmt.
// Sie können beliebig viele solche Texte in einem Dokument verwenden.
// Usage:
// ======
// Simply include a script with the content
// colorfader("text","#abcdef");
// at the position in your document where the color fading text shall be placed.
// text is your text, and #abcdef is a color value in HTML syntax describing the starting color.
// You may use any number of such calls in one document.
// Veränderbare Einstellungen / Adjustable Settings
// ================================================
// FARBBEREICHE
var rmin=128; // Minimum-Wert: Rot / minimum value: red
var rmax=255; // Maximum-Wert: Rot / maximum value: red
var gmin=0; // Minimum-Wert: Grün / minimum value: green
var gmax=128; // Maximum-Wert: Grün / maximum value: green
var bmin=0; // Minimum-Wert: Blau / minimum value: blue
var bmax=128; // Maximum-Wert: Blau / maximum value: blue
var maxchange=5; // Maximale Veränderung pro Durchlauf / maximum change per run
var delay=15; // Pause zwischen Veränderungen / delay between changes
// Script-Code
// ===========
// Ab hier bitte nichts mehr verändern
// Please do not change anything from here on
var r=new Array(), g=new Array(), b=new Array();
var fader=0;
function colorfader(text,col) {
var sr,sg,sb;
if(col.substr(0,1)=='#') {
sr=parseInt(col.substr(1,2),16);
sg=parseInt(col.substr(3,2),16);
sb=parseInt(col.substr(5,2),16);
} else {
sr=parseInt(col.substr(4,4));
for(p=4;p++;p<col.length) if(col.substr(p,1)==',')break;
p++;
sg=parseInt(col.substr(p,4));
for(;p++;p<col.length) if(col.substr(p,1)==',')break;
p++;
sb=parseInt(col.substr(p,4));
}
document.writeln('<span id="fader_'+fader+'" style="color:'+col+'">'+text+'<\/span>');
r[fader]=sr;
g[fader]=sg;
b[fader]=sb;
window.setInterval("dothefader("+fader+")",delay);
fader++;
}
function rgb2h(R,G,B) {
RGB="#";
if(R<16)RGB+="0";
RGB+=R.toString(16);
if(G<16)RGB+="0";
RGB+=G.toString(16);
if(B<16)RGB+="0";
RGB+=B.toString(16);
return RGB;
}
function dothefader(f) {
r[f]+=(0-maxchange+Math.floor(Math.random()*((2*maxchange)+1)));
g[f]+=(0-maxchange+Math.floor(Math.random()*((2*maxchange)+1)));
b[f]+=(0-maxchange+Math.floor(Math.random()*((2*maxchange)+1)));
if(r[f]<rmin)r[f]=rmin;
if(r[f]>rmax)r[f]=rmax;
if(g[f]<gmin)g[f]=gmin;
if(g[f]>gmax)g[f]=gmax;
if(b[f]<bmin)b[f]=bmin;
if(b[f]>bmax)b[f]=bmax;
document.getElementById("fader_"+f).style.color=rgb2h(r[f],g[f],b[f]);
}
// ----------------------------
// -- Ende / End Script-Code --
// ----------------------------
// -- Color Fader --
// -- Author: Triple-M --
// -- www.htmlarsenal.de --
// -- 18.Jun.2004 --
// ----------------------------
//-->
</script>
<!--
// = = ================================================================ = =
// = = Color Fader v1.0 (c) 2004 Triple-M / http://www.htmlarsenal.de = =
// = = ================================================================ = =
// ------------------------------------------------------------------------
// -- Dieses Script und viele andere im --
// -- This script and many more in the --
// ------------------------------------------------------------------------
// -- HTML ARSENAL - Die Quelle für HTML, JavaScript, PHP --
// -- HTML ARSENAL - Your Source for HTML, JavaScript, PHP --
// ------------------------------------------------------------------------
// -- -= http://www.htmlarsenal.de =- --
// ------------------------------------------------------------------------
// Sie dürfen dieses Script für nicht-kommerzielle Zwecke nutzen, wenn diese Urheber-Notiz erhalten bleibt.
// You may use this Script for non-commercial causes as long as you include this copyright notice.
// Benutzung:
// ==========
// Fügen Sie an der Stelle Ihres Dokumentes, an der die farbveränderliche Schrift erscheinen soll, ein
// Script mit dem Inhalt
// colorfader("Text","#abcdef");
// ein. Text ist dabei Ihr Text, und #abcdef eine Farbangabe im HTML-Format, die die Ausgangsfarbe bestimmt.
// Sie können beliebig viele solche Texte in einem Dokument verwenden.
// Usage:
// ======
// Simply include a script with the content
// colorfader("text","#abcdef");
// at the position in your document where the color fading text shall be placed.
// text is your text, and #abcdef is a color value in HTML syntax describing the starting color.
// You may use any number of such calls in one document.
// Veränderbare Einstellungen / Adjustable Settings
// ================================================
// FARBBEREICHE
var rmin=128; // Minimum-Wert: Rot / minimum value: red
var rmax=255; // Maximum-Wert: Rot / maximum value: red
var gmin=0; // Minimum-Wert: Grün / minimum value: green
var gmax=128; // Maximum-Wert: Grün / maximum value: green
var bmin=0; // Minimum-Wert: Blau / minimum value: blue
var bmax=128; // Maximum-Wert: Blau / maximum value: blue
var maxchange=5; // Maximale Veränderung pro Durchlauf / maximum change per run
var delay=15; // Pause zwischen Veränderungen / delay between changes
// Script-Code
// ===========
// Ab hier bitte nichts mehr verändern
// Please do not change anything from here on
var r=new Array(), g=new Array(), b=new Array();
var fader=0;
function colorfader(text,col) {
var sr,sg,sb;
if(col.substr(0,1)=='#') {
sr=parseInt(col.substr(1,2),16);
sg=parseInt(col.substr(3,2),16);
sb=parseInt(col.substr(5,2),16);
} else {
sr=parseInt(col.substr(4,4));
for(p=4;p++;p<col.length) if(col.substr(p,1)==',')break;
p++;
sg=parseInt(col.substr(p,4));
for(;p++;p<col.length) if(col.substr(p,1)==',')break;
p++;
sb=parseInt(col.substr(p,4));
}
document.writeln('<span id="fader_'+fader+'" style="color:'+col+'">'+text+'<\/span>');
r[fader]=sr;
g[fader]=sg;
b[fader]=sb;
window.setInterval("dothefader("+fader+")",delay);
fader++;
}
function rgb2h(R,G,B) {
RGB="#";
if(R<16)RGB+="0";
RGB+=R.toString(16);
if(G<16)RGB+="0";
RGB+=G.toString(16);
if(B<16)RGB+="0";
RGB+=B.toString(16);
return RGB;
}
function dothefader(f) {
r[f]+=(0-maxchange+Math.floor(Math.random()*((2*maxchange)+1)));
g[f]+=(0-maxchange+Math.floor(Math.random()*((2*maxchange)+1)));
b[f]+=(0-maxchange+Math.floor(Math.random()*((2*maxchange)+1)));
if(r[f]<rmin)r[f]=rmin;
if(r[f]>rmax)r[f]=rmax;
if(g[f]<gmin)g[f]=gmin;
if(g[f]>gmax)g[f]=gmax;
if(b[f]<bmin)b[f]=bmin;
if(b[f]>bmax)b[f]=bmax;
document.getElementById("fader_"+f).style.color=rgb2h(r[f],g[f],b[f]);
}
// ----------------------------
// -- Ende / End Script-Code --
// ----------------------------
// -- Color Fader --
// -- Author: Triple-M --
// -- www.htmlarsenal.de --
// -- 18.Jun.2004 --
// ----------------------------
//-->
</script>