Tgif Home
----
About Tgif
Current Release & Download
FAQ
Copyright Info
A Screendump of Tgif
Release History
Tools That Tgif Uses
Tools That Work with Tgif
Author of Tgif
Miscellaneous Info
----
 
Return to Tgif's Home Page
William Chia-Wei Cheng
(bill.cheng@acm.org)
 

Tgif FAQ - Animation

 
I'm looking for a simple tool that can display the results of a dynamic simulation. I look into the manpage of tgif and find a begin_animate command but no example how to do this. What I try do do is to define some Objects and move/rotate them with respect of the result of the simulation via a pipe to tgif. Is this possible to do this in tgif?
One way you may want to try is to user tgif's internal commands and see how far it goes. For example, if you want to create a solid red circle centered at location (50,50) with radius 10, you can use the following internal command:
    set_selected_obj_color("red");
    set_selected_obj_fill(1);
    create_center_oval_obj(50,50,10);
    set_selected_obj_fill(0);
The newly created object is placed on top of all the other objects. You can select it and give this object a name:
    select_top_obj();
    add_attr_to_selected_obj("name","foo",50,50);
This object now has the name "!foo", where the "!" character means top-level. To hide the "name" attribute of the "!foo" object, you can do:
    hide_attr("!foo.name");
If you want to create an outlined box, you can do:
    set_selected_obj_color("blue");
    set_selected_obj_fill(0);
    create_box_obj(80,80,60,40);
To select it and rotate it by 45 degrees, you can do:
    select_top_obj();
    rotate_selected_obj(45);
You can feed all the above commands to tgif at the stdin by starting tgif in the following way:
    tgif -exec -
Of course, this is just a start. If you have more questions, please send me e-mail.

By the way, the begin_animate() command just make things look smoother and doesn't really start any animation.