[solved] text fading

Everything else that doesn't fall into one of the other PB categories.
k3pto
User
User
Posts: 87
Joined: Sat Jan 17, 2015 5:24 pm

[solved] text fading

Post by k3pto »

Is there anyway to fade text in and out in an editor gadget? I tried changing the text color in a loop with a delay between changes but that did not work.

Thank you Mr.L,
I had not set the text after each color change. It does work but is a bit choppy. I will continue to modify the delay time and the step size to see if I can get reasonable results.
Last edited by k3pto on Mon Aug 26, 2024 1:46 am, edited 1 time in total.
Mr.L
Enthusiast
Enthusiast
Posts: 146
Joined: Sun Oct 09, 2011 7:39 am

Re: text fading

Post by Mr.L »

have you tried it like that?

Code: Select all

OpenWindow(0,0,0,800,200,"!")
EditorGadget(0,0,0,800,200)
LoadFont(0, "Arial", 64)
SetGadgetFont(0,FontID(0))
Repeat
	t = ElapsedMilliseconds()
	c = 128 + Sin(t * 0.001) * 127
	SetGadgetColor(0, #PB_Gadget_FrontColor, RGB(c,c,c))
	SetGadgetText(0, " Fading Text Demo")
	
	While WindowEvent()
		If Event()=#PB_Event_CloseWindow:End:EndIf
	Wend
	Delay(15)
ForEver
Post Reply