
-----------------------------------
syntax0r
Thu May 12, 2005 9:43 pm

Scaling Font Text
-----------------------------------
I'm a little stuck on having a decent intro effect. The fade text in and out tutorial worked, but it destroyed w/e was next in the proceeding code.

So, I tried another effect made by myself. In this case, I want a quick explosion of the text growing from small to big quickly.

I've tried doing it look so:

   
setscreen("graphics:700;600")
 for size : 1 .. 24
        var introFont : int := Font.New ("Impact:" + intstr (size))
        Font.Draw ("Intro text here" ,10, 400, introFont, black)
        delay (10)
    end for


But I a crumpled up, black bloch on my screen, that doesnt look like the text at all.

-----------------------------------
Bacchus
Thu May 12, 2005 9:58 pm


-----------------------------------
your not clearing the area after you put the text, so its writting the new bigger text over the old one making it look like crap. try adding in a cls or just drawing a white box over the previous area

-----------------------------------
syntax0r
Thu May 12, 2005 10:27 pm


-----------------------------------
Wow, how stupid of me!


setscreen ("graphics:700;600")
for size : 1 .. 24
    var introFont : int := Font.New ("Impact:" + intstr (size))
    Font.Draw ("Intro text here", 10, 400, introFont, black)

    delay (10)
    cls
end for
var introFont : int := Font.New ("Impact:24")
 Font.Draw ("Intro text here", 10, 400, introFont, black)


Now, the hard is to have it scale from within the center of the text >:-( ..

Im a little stuck there

-----------------------------------
Bacchus
Fri May 13, 2005 5:50 am


-----------------------------------
try using Font.Width to help you out. what you do is take the point you want as the middle of the text and subtract the width of the text (using Font.Width) divded by 2 (so subtract half the width). also its easiest to put the cls before the text so you dont have to draw it again. i also took the variable out of the for loop so it wont be declared may times and set the intro text to a variable so you only have to change one thing instead of 2
setscreen ("offscreenonly,graphics:700;600")
var introFont : int
var introText : string := "Intro Text Here"
for size : 1 .. 54
    cls
    introFont := Font.New ("Impact:" + intstr (size))
    Font.Draw (introText, round ((maxx / 2) - (Font.Width (introText, introFont) / 2)), 400, introFont, black)
    View.Update
    delay (10)
end for

-----------------------------------
syntax0r
Fri May 13, 2005 6:35 am


-----------------------------------
Thanks for the help!

 I didn't know what the Font.Width statement or View.Update, but i looked those commands up and I understand your code.

-----------------------------------
mercuryy
Sat May 21, 2005 6:04 pm


-----------------------------------
I was thinking is there anyother way other using the "offscreen" command to smooth the animation "welcom" because i wanna do a program like 



setscreen ("graphics:600;400") 
var introFont : int
var introText : string := "Welcome "
for size : 1 .. 55
    cls
    introFont := Font.New ("Impact:" + intstr (size))
    Font.Draw (introText, round ((maxx / 2) - (Font.Width (introText, introFont) / 2)), 200, introFont, black)
    View.Update
    delay (10)
end for

delay(500)
colourback(grey)
cls
colour(white)
var x1, y1, x2, y2, x, y,x9, button, x3, x4, mouseX, mouseY : int
x1 := 10%x-cordinate for left side of the box 1
y1 := 30%y-cordinate for left side of the box 1&2
x2 := 83%x-cordinate for right side of the box 1
y2 := 60%y-cordinate for right side of the box 1&2
x3 := 100%x-cordinate for left side of the box 2
x4 := 180%x-cordinate for right side of the box 2
x9:=1

 
loop 
put " "
put "        ", Time.Date 

        drawbox (x1, y1, x2, y2, black)
        locate(23,3)
        put"Button 1"..
       
        drawbox (x3, y1, x4, y2, black)
         locate(23,14)
        put" Button 2"..
        
        Mouse.Where (x, y, button)
        if button = 0 and x >= x1 and x = y1 and y = x1 and x = y1 and y = x3 and x = y1 and y = x3 and x = y1 and y 