Neon text effect 3 colors - Ash Princess Kawaii
Breaking News
Loading...
13 Maret 2014

Neon text effect 3 colors



Previous article I post how to make neon lights text 2 color effect,This time I will share how to create a neon text effect 3 colors.

Live Demo



The code.

<script language="JavaScript1.2">
var message="ASH PRINCESS KAWAII"
var neonbasecolor="#FF21AE"
var neontextcolor="#23FCF2"
var neontextcolor2="#FFB921"
var flashspeed=100      // speed of flashing in milliseconds
var flashingletters=3      // number of letters flashing in neontextcolor
var flashingletters2=1      // number of letters flashing in neontextcolor2 (0 to disable)
var flashpause=0      // the pause between flash-cycles in milliseconds
///No need to edit below this line/////
var n=0
if (document.all||document.getElementById){
document.write('<font color="'+neonbasecolor+'">')
for (m=0;m<message.length;m++)
document.write('<span id="neonlight'+m+'">'+message.charAt(m)+'</span>')
document.write('</font>')
}
else
document.write(message)
function crossref(number){
var crossobj=document.all? eval("document.all.neonlight"+number) : document.getElementById("neonlight"+number)
return crossobj
}
function neon(){
//Change all letters to base color
if (n==0){
for (m=0;m<message.length;m++)
crossref(m).style.color=neonbasecolor
}
//cycle through and change individual letters to neon color
crossref(n).style.color=neontextcolor
if (n>flashingletters-1) crossref(n-flashingletters).style.color=neontextcolor2
if (n>(flashingletters+flashingletters2)-1) crossref(n-flashingletters-flashingletters2).style.color=neonbasecolor
if (n<message.length-1)
n++
else{
n=0
clearInterval(flashing)
setTimeout("beginneon()",flashpause)
return
}
}
function beginneon(){
if (document.all||document.getElementById)
flashing=setInterval("neon()",flashspeed)
}
beginneon()
</script>

Replace the message text and color as desired. Enjoy!
See the Pen Neon text effect 3 colors by Erna Ayuning Nareswari (@ashavenger) on CodePen.

4 Comments:

  1. Xergy offers a wide variety of Quirky yet functional products for your home. You can shop from our decor section for Fairy Lights / String Lights / Diwali Ladi / Solar Outdoor Lights / Neon Lights / 3D Moon Lamps / Smart Home Automation products We offer Replacement Warranty on our entire product range.
    Buy Neon Lights
    Buy Neon Lights Online
    3D Moon Lamp
    Buy Moon Lamp Online

    BalasHapus
  2. Komentar ini telah dihapus oleh pengarang.

    BalasHapus
  3. Komentar ini telah dihapus oleh pengarang.

    BalasHapus
  4. Thanks for this content, very elaborate and also it's going to be helpful for those who are looking for home décor ideas and for buying various kind of neon signs Adelaide visit us.

    BalasHapus