text effects

Blitz3D Forums/Blitz3D Beginners Area/text effects

po(Posted 2005) [#1]
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:

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?


Bremer(Posted 2005) [#2]
You could do something like this:




NewtSoup(Posted 2005) [#3]
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?


NewtSoup(Posted 2005) [#4]
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




po(Posted 2005) [#5]
Great, thanks guys.