Page 1 of 1

[solved] text fading

Posted: Wed Aug 21, 2024 6:39 pm
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.

Re: text fading

Posted: Wed Aug 21, 2024 7:48 pm
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