Page 1 of 1

support fade in and fade out?

Posted: Fri Aug 18, 2006 6:53 am
by KFC123
Does trichview support a fade-in & fade-out text?

thx in advance

Posted: Fri Aug 18, 2006 1:12 pm
by Sergey Tkachenko
Sorry, no.
But you can create image of TRichView document, place it on top of TRichView, and apply fade-in/fade-out effect to this image.
I created a demo: http://www.trichview.com/support/files/fade.zip

But if you need to apply this effect to text only (not to pictures, tables, etc.), and if this text is on the same background, you simply can modify RVStyle.TextStyles.Color (for all i) and repaint TRichView.

Posted: Fri Aug 18, 2006 1:25 pm
by KFC123
Wow, it's really great! Thanks a lot.

Posted: Sat Aug 19, 2006 4:03 am
by KFC123
Sergey Tkachenko wrote:Sorry, no.
But you can create image of TRichView document, place it on top of TRichView, and apply fade-in/fade-out effect to this image.
I created a demo: http://www.trichview.com/support/files/fade.zip
That's great.
But if you need to apply this effect to text only (not to pictures, tables, etc.), and if this text is on the same background, you simply can modify RVStyle.TextStyles.Color (for all i) and repaint TRichView.

I only want to fade-in/fade-out line 2 (only text), but merely change the style can make a transparency effect? I try but seems not good

Posted: Sat Aug 19, 2006 1:42 pm
by Sergey Tkachenko
If the background is a plain color (for example, white), you can make text color whiter and whiter, until it becomes white and completely disappears.

Posted: Mon Aug 21, 2006 5:24 am
by KFC123
Sergey Tkachenko wrote:If the background is a plain color (for example, white), you can make text color whiter and whiter, until it becomes white and completely disappears.
Thanks. I am not quite familiar with controling color, here is my code of handling TEXT in green on black background (change the brightness from bright to dark)

RVEdit.Clear;
RVEdit.AddNL('text', 0, 0);
RV.Format;
cColor := clBlack;

ccColor := Self.AnsRVStyle.TextStyles.Items[0].Color;
for i := 10 downto 0 do
begin
Level := 255*i div 10;
blue := ((cColor and $FF00FF) shr 16)*Level;
green := ((cColor and $00FFFF) shr 8)*Level;
red := (cColor and $0000FF)*Level;
Lev := 255-Level;
cBlue := ((ccColor and $FF00FF) shr 16)*Level;
cGreen := ((ccColor and $00FFFF) shr 8)*Level;
cRed := (ccColor and $0000FF)*Level;
cBlue := (cBlue *Lev + blue) div 255;
cGreen := (cGreen*Lev + green) div 255;
cRed := (cRed *Lev + red) div 255;
ccColor := cBlue*255*255 + cGreen*255 + cRed;
Self.AnsRVStyle.TextStyles.Items[0].Color := ccColor;
Sleep(100);
end;

But the it doesn't change the brightness smoothly and Sleep here seems block the program seriously while clicking other other buttons before the loop is finished. By the way, is it possible to make a specific line being fade-in/out rather than working on the whole richview?

Thanks in advance.