Jump to content

How to do Hover-Text with Multiple Coloured Rainbow Effects


Eisaki
 Share

You are about to reply to a thread that has been inactive for 441 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Does anyone know how to do the Multi-colour Changing Rainbow Effects on a Hover-text Script? Where is animated like and changes into different colours automatically? Would like to also know if I could change it to any of the colours I wish to use and they automatically change example it animates or flashes on it's own to blue to red to yellow to pink then start over the colour pattern again and so on. I want it to be a Hover text so I can change up the words at anytime.

Link to comment
Share on other sites

3 hours ago, Eisaki said:

Does anyone know how to do the Multi-colour Changing Rainbow Effects on a Hover-text Script? Where is animated like and changes into different colours automatically? Would like to also know if I could change it to any of the colours I wish to use and they automatically change example it animates or flashes on it's own to blue to red to yellow to pink then start over the colour pattern again and so on. I want it to be a Hover text so I can change up the words at anytime.

It sounds as if you want to cycle through a list of colours.    If that's the case, try something like this, to run through the colours you've chosen and then start over.   You'll probably want to change the colours using a timer rather than a touch event.

integer iMax;
integer iCounter;
integer n;
list lColours =[
<1.0,0.0,0.0>,
<0.0,1.0,0.0>,
<0.0,0.0,1.0>
];

string strText ="Hello, Avatar!";
default
{
	state_entry()
	{
		iMax = llGetListLength(lColours);
		n = iCounter%iMax;//the "remainder" when you divide iCounter by iMax
		llSetText(strText,llList2Vector(lColours,n),1.0);
	}
	touch_start(integer total_number){			
		++iCounter;//advance the value of iCounter
		n = iCounter%iMax;
		llSetText(strText,llList2Vector(lColours,n),1.0);
	}
}

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

2 hours ago, Fenix Eldritch said:

So if you want to have the effect of multiple words or letters having different colors, they are actually separate prims each with their own hovertext.

And adding on to that, since the hovertext font is not monospace (Every letter has a slightly different width), the ability to have per-letter rainbow colors and the ability to change the text arbitrarily are (more or less) mutually exclusive, not to mention the letters won't fit together horizontally nicely unless it's a HUD or you're looking at it straight on.

Edited by Quistess Alpha
  • Like 1
Link to comment
Share on other sites

4 hours ago, Innula Zenovka said:
++iCounter;//advance the value of iCounter
n = iCounter%iMax;//the "remainder" when you divide iCounter by iMax

 

Just some irrelevant style notes, but

  1. n should probably be a local variable in this case, not a global one.
  2. I'd do away with n altogether and just apply the modulus to the counter:
    iCounter = (1+iCounter)%iMax;
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

21 hours ago, Quistess Alpha said:

not to mention the letters won't fit together horizontally nicely unless it's a HUD or you're looking at it straight on.

You can actually achieve consistent letter alignment regardless of view angle:

image.png.4881949013472ade8f13220a51d7f0a9.png

This has the six prims postioned at exactly the same spot with whitespaces used to position each letter. It's not something I would recommend but it is possible.

Edited by ChinRey
  • Thanks 1
Link to comment
Share on other sites

2 hours ago, ChinRey said:

You can actually achieve consistent letter alignment regardless of view angle:

Silly me imagined using the position of the prims as the spacer rather than whitespace characters, dope. figuring out the correct spacing for each letter seems error prone and tedious. Good job!

  • Like 1
Link to comment
Share on other sites

29 minutes ago, Quistess Alpha said:

Good job!

Thank you but as I said, it's not something I would recommend. It's probably more of a curiosity than a useful trick. You can't get precise kerning this way and for some reason the letters aren't correctly aligned vertically. I don't know why but it seems that darker text is positioned slightly higher than lighter.

Edited by ChinRey
Link to comment
Share on other sites

8 hours ago, ChinRey said:

You can't get precise kerning this way and for some reason the letters aren't correctly aligned vertically. I don't know why but it seems that darker text is positioned slightly higher than lighter.

It's mostly an optical illusion: (Though it looks like specifically black text loses the "drop shadow" other characters have.)

image.png.5a589bbe055142102ec720882724bd9d.png

Edited by Wulfie Reanimator
  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 441 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...