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

Username:   Password: 
 RegisterRegister   
 [source code] Text Effects
Index -> Programming, Turing -> Turing Submissions
Goto page Previous  1, 2, 3, 4, 5  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Delta




PostPosted: Fri Mar 21, 2003 10:55 pm   Post subject: Text Effect Number 1

Types out the text
code:

procedure TypeThis (word:string, speed:int)
    for i : 1 .. length(word)
        put word(i)..
        delay (speed)
    end for
    put ""
end TypeThis

TypeThis ("Text Effect", 100)
TypeThis ("Number 1", 100)
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Mar 21, 2003 11:00 pm   Post subject: (No subject)

isnt it the same as textDelay Confused
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Delta




PostPosted: Fri Mar 21, 2003 11:04 pm   Post subject: (No subject)

Here is the same thing just with some extras and using Font.Draw
code:

procedure TypeThis (word:string, x, y :int, size, clr, speed:int)
    var font : int := Font.New ("Arial:"+intstr(size))
    for i : 1 .. length(word)
        Font.Draw (word(1..i), x, y, font, clr)
        delay (speed)
    end for
    put ""
end TypeThis

TypeThis ("Text Effect",100, 300, 20,14, 100)
TypeThis ("Number 2", 50,100, 50,12,100)
Delta




PostPosted: Fri Mar 21, 2003 11:06 pm   Post subject: I'm sorry

Sorry if some of the text effects are the same I'm just posting what ever I can think of
Delta




PostPosted: Fri Mar 21, 2003 11:17 pm   Post subject: Text Effect Number3

Fades in text using Font.Draw
code:

procedure FadeThisIn (word:string, x, y :int, size, speed:int)
    var font : int := Font.New ("Arial:"+intstr(size))
    for decreasing i : 31 .. 16
        Font.Draw (word, x, y, font, i)       
        delay (speed)
    end for
    put ""
end FadeThisIn

FadeThisIn ("Text Effect", 300, 100, 75, 100)
FadeThisIn ("Number 3", 200, 50, 45, 500)


to fade out for i : 16 .. 31 fades from black to white
Delta




PostPosted: Fri Mar 21, 2003 11:25 pm   Post subject: Text Effect Number 4

Flashes the letters in the word
code:

procedure LetterFlash (word:string)
    var font : int := Font.New ("Arial:50")
    for i : 1..length(word)
        Font.Draw (word(1..i), 200, 200, font, 28)
        if i > 1 then
            Font.Draw (word(1..i-1), 200, 200, font, 0)
        end if
        delay (100)
    end for
end LetterFlash

LetterFlash ("Text Effect Number 4")
Catalyst




PostPosted: Sat Mar 22, 2003 12:54 pm   Post subject: (No subject)

This makes the text explode and unexplode, (note for now only on a black background)
code:

setscreen ("offscreenonly,graphics:320;150,nobuttonbar")

proc ExplodeText (x0, y0 : int, text00 : string, font : int, c0 : int)
    var clr, c : int := 0
    var r, g, b : real
    RGB.GetColor (c0, r, g, b)
    for i : 1 .. 255
        clr := RGB.AddColor ((i * r) / 255, (i * g) / 255, (i * b) / 255)
    end for
    type Particle :
        record
            x, y, xV, yV : real
            life, c : int
        end record

    drawfillbox (0, 0, maxx, maxy, 7)
    var text : string := text00
    Font.Draw (text, x0, y0, font, c0)
    var screen : array 1 .. maxx, 1 .. maxy of int
    const numP := 200
    const maxLife := 25
    var main : flexible array 1 .. 1 of Particle
    for x : 1 .. maxx
        for y : 1 .. maxy
            if whatdotcolor (x, y) = c0 then
                c += 1
                new main, c
                main (c).x := x
                main (c).y := y
                main (c).xV := Rand.Int (-5, 5) * Rand.Real
                main (c).yV := Rand.Int (-5, 5) * Rand.Real
                main (c).life := maxLife
                main (c).c := whatdotcolor (x, y)
            end if
        end for
    end for
    loop
        for i : 1 .. c
            main (i).x += main (i).xV
            main (i).y += main (i).yV
            main (i).life -= 1
            if main (i).life > 0 then
                drawdot (round (main (i).x), round (main (i).y), round ((main (i).life / maxLife) * 255) + 255)
            end if
        end for
        View.Update
        drawfillbox (0, 0, maxx, maxy, 7)
        exit when main (1).life <= 0
    end loop
end ExplodeText


proc UnExplodeText (x0, y0 : int, text00 : string, font : int, c0 : int)
    var clr, c : int := 0
    var r, g, b : real
    RGB.GetColor (c0, r, g, b)
    for i : 1 .. 255
        clr := RGB.AddColor ((i * r) / 255, (i * g) / 255, (i * b) / 255)
    end for
    type Particle :
        record
            x, y, xV, yV : real
            life : int
        end record
    drawfillbox (0, 0, maxx, maxy, 7)
    View.Update
    Font.Draw (text00, x0, y0, font, c0)
    var screen : array 1 .. maxx, 1 .. maxy of int
    const numP := 200
    const maxLife := 100
    var s : int := 100
    var main : flexible array 1 .. 1 of Particle
    for x : 1 .. maxx
        for y : 1 .. maxy
            if whatdotcolor (x, y) = c0 then
                c += 1
                new main, c
                main (c).xV := Rand.Int (-5, 5) * Rand.Real
                main (c).yV := Rand.Int (-5, 5) * Rand.Real
                main (c).x := x + (main (c).xV * s)
                main (c).y := y + (main (c).yV * s)
                main (c).xV := -main (c).xV
                main (c).yV := -main (c).yV
                main (c).life := 0

            end if
        end for
    end for
    loop
        drawfillbox (0, 0, maxx, maxy, 7)
        for i : 1 .. c
            if main (i).life < maxLife then
                main (i).x += main (i).xV
                main (i).y += main (i).yV
                main (i).life += 1
                drawdot (round (main (i).x), round (main (i).y), round ((main (i).life / maxLife) * 255) + 255)
            else
                drawdot (round (main (i).x), round (main (i).y), c0)
            end if
        end for
        View.Update
        exit when main (c).life >= maxLife
    end loop
end UnExplodeText


var font : int := Font.New ("verdana:36:bold")
loop
    ExplodeText (50, 50, "Catalyst", font, 103)
    cls
    UnExplodeText (50, 50, "Catalyst", font, 103)
    View.Update
end loop


MOD Edit: I never realized we had such awesome turing programmers here already Confused This effect by far is the best! +15Bits, I'm VERY impressed -Tony
MOD Edit: This is godly! Adding an additional +5 Bits! -Asok
Catalyst




PostPosted: Sat Mar 29, 2003 1:29 am   Post subject: (No subject)

bored... racecar effect...

code:

View.Set ("nobuttonbar,graphics:650;100,position:300;300,offscreenonly")

var font : int := Font.New ("verdana:45:bold")
var a, c : int := 0000

var x0, y0 : int := 20

var text : string := "               Catalyst"
var buff : string := ""
var x, y : array 1 .. length (text) of int

for i : 1 .. length (text)
    x (i) := x0 + Font.Width (buff, font)
    y (i) := y0
    buff += text (i)
end for

for decreasing i : length (text) .. 1
    for k : 1 .. x (i)
        Font.Draw (text (i), k, y (i), font, 7)
        View.Update
        delay (1)
        Font.Draw (text (i), k - 2, y (i), font, 0)
    end for
    Font.Draw (text (i), x (i), y (i), font, 7)
    View.Update
    delay (50)
end for


MOD Edit: Those effects just keep on comming Very Happy +10Bits -Tony
Sponsor
Sponsor
Sponsor
sponsor
BlAcK TuRtLe




PostPosted: Mon Mar 31, 2003 7:51 pm   Post subject: (No subject)

Thanks for the help. Here is a primitive piece of crap I just made
code:
%Logo
Draw.Arc(200,200,50,100,0,180,yellow)
Draw.Arc(300,200,50,100,0,180,yellow)
Draw.FillBox(125,115,375,200,brightred)
Draw.Arc(200,200,25,100,0,180,yellow)
Draw.Arc(300,200,25,100,0,180,yellow)
Draw.FillMapleLeaf(370,200,400,230,red)
%Text
var y:int := Font.New ("Arial:26:bold")
Font.Draw("McDonalds",160,150,y,yellow)
delay(2000)
Draw.FillBox(125,115,375,200,brightred)
var x:int := Font.New ("Arial:14:bold")
Font.Draw("We love to see you smile",130,150,x,yellow)
delay(2000)
Draw.FillBox(125,115,375,200,brightred)
var z:int := Font.New ("Arial:14:bold")
Font.Draw("Billions served everyday",130,150,z,yellow)
Tony




PostPosted: Mon Mar 31, 2003 8:18 pm   Post subject: (No subject)

lol, not exactly a text effect, but its still cool Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Catalyst




PostPosted: Mon Mar 31, 2003 10:25 pm   Post subject: (No subject)

looked at my last post here (racecar) an got and idea...

code:

setscreen ("offscreenonly,graphics:800;150,nobuttonbar")

proc ExplodeText (x0, y0 : int, text00 : string, font : int, c0 : int)
    var clr, c : int := 0
    var r, g, b : real
    RGB.GetColor (c0, r, g, b)
    for i : 1 .. 255
        clr := RGB.AddColor ((i * r) / 255, (i * g) / 255, (i * b) / 255)
    end for
    RGB.GetColor (103, r, g, b)
    for i : 1 .. 255
        clr := RGB.AddColor ((i * r) / 255, (i * g) / 255, (i * b) / 255)
    end for
    type Particle :
        record
            x, y, xV, yV : real
            life, c, trig : int
        end record

    drawfillbox (0, 0, maxx, maxy, 7)
    var text : string := text00
    Font.Draw (text, x0, y0, font, c0)
    var screen : array 1 .. maxx, 1 .. maxy of int
    const numP := 200
    const maxLife := 75
    var main : flexible array 1 .. 1 of Particle
    for x : 1 .. maxx
        for y : 1 .. maxy
            if whatdotcolor (x, y) = c0 then
                c += 1
                new main, c
                main (c).x := x
                main (c).y := y
                main (c).xV := +5
                main (c).yV := 0
                main (c).life := maxLife
                main (c).c := whatdotcolor (x, y)
                main (c).trig := 0
            end if
        end for
    end for
    loop
        for i : 1 .. c
            main (i).x += main (i).xV
            main (i).y += main (i).yV
            if main (i).x >= 750 and main (i).trig = 0 then
                main (i).trig := 1
                main (i).xV := (main (i).xV * -1) * Rand.Real
                main (i).yV := Rand.Int (-5, 5) * Rand.Real
            end if
            if main (i).trig = 1 then
                main (i).life -= 1
                main (i).yV-=0.05
            end if
            if main (i).life > 0 then
                if main (i).trig = 0 then
                    drawdot (round (main (i).x), round (main (i).y), round ((main (i).life / maxLife) * 255) + 255)
                else
                    drawdot (round (main (i).x), round (main (i).y), round ((main (i).life / maxLife) * 255) + 510)
                end if
            end if
        end for
        View.Update
        drawfillbox (0, 0, maxx, maxy, 7)
    end loop
end ExplodeText

var font : int := Font.New ("verdana:36:bold")
ExplodeText (210, 50, "Catalyst", font, 103)
Catalyst




PostPosted: Mon Mar 31, 2003 10:28 pm   Post subject: (No subject)

this happened to come about when i was making the last one...

(altho i dont need to for some reason i still use particles)
code:

setscreen ("offscreenonly,graphics:800;150,nobuttonbar")

proc ExplodeText (x0, y0 : int, text00 : string, font : int, c0 : int)
    var clr, c : int := 0
    var r, g, b : real
    RGB.GetColor (c0, r, g, b)
    for i : 1 .. 255
        clr := RGB.AddColor ((i * r) / 255, (i * g) / 255, (i * b) / 255)
    end for
    type Particle :
        record
            x, y, xV, yV : real
            life, c : int
        end record

    drawfillbox (0, 0, maxx, maxy, 7)
    var text : string := text00
    Font.Draw (text, x0, y0, font, c0)
    var screen : array 1 .. maxx, 1 .. maxy of int
    const numP := 200
    const maxLife := 25
    var main : flexible array 1 .. 1 of Particle
    for x : 1 .. maxx
        for y : 1 .. maxy
            if whatdotcolor (x, y) = c0 then
                c += 1
                new main, c
                main (c).x := x
                main (c).y := y
                main (c).xV := +5
                main (c).yV := 0
                main (c).life := maxLife
                main (c).c := whatdotcolor (x, y)
            end if
        end for
    end for
    loop
        for i : 1 .. c
            main (i).x += main (i).xV
            main (i).y += main (i).yV
            if main (i).x < 200 and main (i).life < maxLife then
                main (i).life += 1
            end if
            if main (i).x > 600 then
                main (i).life -= 1
            end if
            if main (i).x >= 800 then
                main (i).x -= 900
            end if
            if main (i).life > 0 then
                drawdot (round (main (i).x), round (main (i).y), round ((main (i).life / maxLife) * 255) + 255)
            end if
        end for
        View.Update
        drawfillbox (0, 0, maxx, maxy, 7)
    end loop
end ExplodeText

var font : int := Font.New ("verdana:20:bold")
ExplodeText (210, 50, "Catalyst - It's a Marquee...", font, 103)
Tony




PostPosted: Mon Mar 31, 2003 10:59 pm   Post subject: (No subject)

Very Happy AWESOME... just AWESOME.

+20Bits ofcourse... each Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Tony




PostPosted: Sat Apr 05, 2003 3:36 pm   Post subject: (No subject)

Count-Down Very Happy

Note: This text effect works only in v4+ compilers because of View.Update. The effect will work in v3 if View.Update is removed, but it will flicker. If you want to use it in v3 anyway, atleast get rid of cls to reduce flicker amount.

code:

procedure CountDown(numFrom,numTo,speed:int)

View.Set("offscreenonly") %flicker free animation, v4 compiler only
var fontID:array 1..ceil(maxy*1.5) of int %declear variables for fonts

for i:1..ceil(maxy*1.5)
fontID(i):= Font.New("arial:"+intstr(i)) %declearing fonts of sizes we need
end for

for decreasing num:numFrom..numTo %starting count down loop

for i:1..ceil(maxy*1.5) by speed %starting loop for zooming numbers in
Font.Draw(intstr(num),round(maxx/2 - i/3 - Font.Width(intstr(num),fontID(i))/4),round(maxy/2-i/2),fontID(i),round(17+i/ceil(maxy*1.5)*13))
%just draws the number where its suppost to be, X,Y,Color
View.Update %updates image
cls %clears screen
end for

end for

View.Set("nooffscreenonly") %disable offscreenonly and returns to previous mod

for i:1..ceil(maxy*1.5)
Font.Free(fontID(i)) %clean up after ourselves
end for

end CountDown %and we're done


%now to call the procedure and test it out.
%arguments are:
%Count down from: int
%Count down to: int
%Speed :int ~ larger num = faster countdown
CountDown(10,1,10)


Counts down from/to numbers your specify. Good for the start of the "movie" or whenever you need to count down to something.

Also this procedure is screen-size independant. Meaning it would work properly in any screensize of your program.

Note: if you count in single digits only, you can take out
code:
- Font.Width(intstr(num),fontID(i))/4
Its there just to fix positioning of 2 digit numbers.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
void




PostPosted: Mon Apr 07, 2003 6:34 pm   Post subject: patch

is there a patch i can get for v3 to run v4 programs because i really dont feel like paying money for v4 but all these neat effects require v4 because of the one line that all of them use "View.Update" Evil or Very Mad if anyone knows of any site where i can in theory "GET" this v4 of winOOT...a link would be much appreciated or a link to a patch..(my skools too cheap for v4)
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 5  [ 70 Posts ]
Goto page Previous  1, 2, 3, 4, 5  Next
Jump to:   


Style:  
Search: