:-object titlemove3: [bcilib].

var count = 5000.
var distance=  12.0.
var increment = 0.25.
var url='./title/title2.wrl'.
var countv=40.


main :- text_area(Browser),
        set_output(Browser),
	loadURL(url),
	sleep(3000),
      move_title(count).


move_title(0):-!.


move_title(N):- N1 is N-1,
			getSFVec3f(title, translation, Xt,Yt,_Zt),
                  getSFVec3f(myViewpoint,position, X,Y,Z),
	            Zt is Z - distance,
                  setSFVec3f(title, translation,Xt,Yt,Zt),
			setTitleText(titletext,N),
			move_viewpoint(myViewpoint,position(X,Y,Z), countv),
			move_title(N1).


move_viewpoint(_V,_,0):-!.

move_viewpoint(V,position(X,Y,Z),C):-C1 is C-1,
						 Znew is Z-increment,
                                     setSFVec3f(V,position,X,Y,Znew),
						 sleep(100),
						 move_viewpoint(V,position(X,Y,Znew),C1).

setTitleText(O,N):- I is N mod 5,
			  title_text(I,T),
			  format('T is ~w~n',[T]),
			  setMFString(O, string, [T]).


title_text(1, 'Multimedia Authoring II'):-!.
title_text(2, 'Flying Title Example'):-!.
title_text(3, 'Changing Title Strings'):-!.
title_text(4, 'VRML+Java+ Prolog'):-!.
title_text(0, 'Z. Huang 2002'):-!.
title_text(_, 'Thank You very much!'):-!.




:-end_object titlemove3.