Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Fading Text
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Mystify




PostPosted: Sat Dec 03, 2005 7:09 pm   Post subject: Fading Text

Hey anyone know how to do fading text if so can you give me an example i cant figure it out????
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Sat Dec 03, 2005 7:41 pm   Post subject: (No subject)

You need to use the RGB module.

Turing Walkthrough -> RGB tutorial
DIIST




PostPosted: Sun Dec 04, 2005 1:56 pm   Post subject: Fading Text

code:
const numc:int:=10%Number of shades
var font1:=Font.New ("serif:30")

var C:array 0..numc of int%to hold the colour number


for assigncolor:0..numc
    C(assigncolor):=RGB.AddColor(assigncolor/numc,assigncolor/numc,assigncolor/numc)%Typical shades of black, you can change it to fit your taste by changint the red green and blue values
end for

for fade:0..numc
    Font.Draw("example",50,50,font1,C(fade))
    delay(50)
end for

Font.Free(font1)

Try this! This is how i ussually do it.
Cervantes




PostPosted: Sun Dec 04, 2005 3:26 pm   Post subject: (No subject)

Ack! Whitespace is your friend.

Also, if there's nothing more to this program that involves these particular colours, you don't need to store them in an array:

code:

const numc := 100     %Number of shades
var font1 := Font.New ("serif:30")

for i : 0 .. numc
    RGB.SetColour (240, i / numc, i / numc, i / numc) %Typical shades of black
    Font.Draw ("example", 50, 50, font1, 240)          %Draw in colour # 240, which is the one we're modifying with RGB.SetColour
end for

Font.Free(font1)

Untested
do_pete




PostPosted: Mon Dec 05, 2005 11:37 am   Post subject: (No subject)

if your background is white or black you can do it this way which doesn't involve all that RGB stuff
code:
var font : int := Font.New ("timesnewroman:24:bold")
var text : string := "Fading text done the easy way."
var x : int := 150
var y : int := 200
for decreasing c : 31 .. 16
    Font.Draw (text, x, y, font, c)
    delay (50)
end for
for c : 16 .. 31
    Font.Draw (text, x, y, font, c)
    delay (50)
end for
colourback (black)
cls
for c : 16 .. 31
    Font.Draw (text, x, y, font, c)
    delay (50)
end for
for decreasing c : 31 .. 16
    Font.Draw (text, x, y, font, c)
    delay (50)
end for
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: