text effects

Blitz3D Forums/Blitz3D Beginners Area/text effects

I'm trying to make a string make a sort of 'wave' motion by moving each character up and down, but i'm confused as to how to do it.
Here is where i'm at right now:
Global o,num,up

Graphics 800,600,16,2

SetBuffer BackBuffer()

font=LoadFont("Impact",32,False,False)
SetFont font

Type effect

	Field e.effect
	Field name$
	Field x,y
	
End Type

e.effect=New effect
e\name$="Paul Leduc"
e\x=400-StringWidth(e\name$)/2
e\y=300-StringHeight(e\name$)/2
o=1
num=0
up=True

While Not KeyHit(1)

	TextEffect()
			
	Flip
	Cls
	
Wend
End 

Function TextEffect()

	For e.effect=Each effect
	
		Text e\x,e\y,Mid$(e\name$,o,1)
		
		If up=True Then
			e\y=e\y-1
			num=num+1
			If num>FontHeight() Then
				o=o+1
				up=False
			EndIf
		EndIf
		
		If up=False Then
			e\y=e\y+1
			num=num-1
			If num<1 Then 
				up=True		
			EndIf
		EndIf 
		
		If o>Len(e\name$) Then o=1
			 		
	Next

End Function

I don't know if this should be a type, or array, or just a simple function, actually. I have the characters of my name moving up and down, but it only shows 1 character at a time, and i'm just so confused! :/

Anyone know how I could achieve "wavy" text?

You could do something like this:

Graphics 640,480,16,2
While Not KeyHit( 1 )

	waveText( "THIS IS A TEST", 100, 200, 12, ang, 64, 4 )
	ang = ang + 1 : If ang > 359 Then ang = ang - 360
	Flip
	Cls
Wend
End

Function waveText( TXT$, X, Y, SPACING, STARTANGLE, WAVEHEIGHT, ANGLESTEP )
	For i = 1 To Len( TXT$ )
		YY = Y + Sin( STARTANGLE ) * WAVEHEIGHT
		Text X, YY, Mid( TXT$, i, 1 )
		STARTANGLE = STARTANGLE + ANGLESTEP
		X = X + SPACING
	Next
End Function


Graphics 800,600,32,2
SetBuffer BackBuffer()
txt$="Quick Brown Fox Jumps Over The Lazy Dog"
;this is how I cheated to find the correct length of the array
Print Len(txt)

;dump the string into an array lenght of the message
Dim msg$(39)
For f = 1 To 39
	msg(f)=Mid(txt,f,1)
Next
x=10
astep=5
amp=100
freq=10

a%=0
While Not KeyHit(1)
	Cls
	
	For f=1 To 39
	  Text 100+x*f,300+amp*Sin(a+f*freq),msg(f)
	Next

	a=a+astep
	Flip
Wend



lol its almost identical to zawrans code.. sorry man, I didnt even read your stuff untill after. Great minds hey?

more informative version:
Graphics 800,600,32,2
SetBuffer BackBuffer()
txt$="Quick Brown Fox Jumps Over The Lazy Dog"
;this is how I cheated to find the correct length of the array
Print Len(txt)

;dump the string into an array lenght of the message
Dim msg$(39)
For f = 1 To 39
	msg(f)=Mid(txt,f,1)
Next
x=10
aStep=5
amp=100
freq=10

a%=0
While Not KeyHit(1)
	If KeyHit(200) Then freq=freq+1;uparrow
	If KeyHit(208) Then freq=freq-1;downarrow
	If KeyHit(30) Then amp=amp+5;a key
	If KeyHit(44) Then amp=amp-5;z key
	If KeyHit(52) Then x=x+1;> key
	If KeyHit(51) Then x=x-1;< key
	If KeyHit(205) Then aStep=astep+1;arrowkey
	If KeyHit(203) Then aStep=astep-1;arrowkey
	Cls
	Text 0,10, "aStep:"+astep + "(arrow keys) (speed of oscillation)"
	Text 0,25,"x    :"+x +"(<> keys) distance between characters"
	Text 0,40,"amp  :"+amp+"(az keys) height of the wave"
	Text 0,55,"freq :"+freq+"(arrow keys) number of waves"
	
	For f=1 To 39
	  Textwave(100,300,x,amp,freq,a,msg(f),f)
	  
	Next
	
	a=a+aStep
        if a>360 Then a=a-360
        If a<0 then a=a+360
	Flip
Wend


Function TextWave(xstart,ystart,xdisplacement,amplitude,frequency,angle,character$,index)

	Text (xstart+xdisplacement*index,ystart+amplitude*Sin(angle+index*frequency),character)

End Function



Great, thanks guys.