Hi Feodor, Below, you will find an example of a macro producing an animated picture. It uses the TTimer class. You can adapt it to your needs replacing the 2-d function TF2 by a TGraph or equivalent. Rene Brun ///macro anim.C Double_t pi; TF2 *f2; Float_t t = 0; Float_t phi = 30; void anim() { gStyle->SetFrameFillColor(42); TCanvas *c1 = new TCanvas("c1"); c1->SetFillColor(17); pi = TMath::Pi(); f2 = new TF2("f2","sin(2*x)*sin(2*y)*[0]",0,pi,0,pi); f2->SetParameter(0,1); f2->SetNpx(15); f2->SetNpy(15); f2->SetMaximum(1); f2->SetMinimum(-1); f2->Draw("surf1"); TTimer *timer = new TTimer(20); timer->SetCommand("Animate()"); timer->TurnOn(); } void Animate() { t += 0.05*pi; f2->SetParameter(0,TMath::Cos(t)); phi += 2; gPad->SetPhi(phi); gPad->Modified(); gPad->Update(); } Feodor Ogrin wrote: > > Hi everyone, > > I've just joined the ROOTcompany, so I am full of stupied questions which > I hope you do not mind to help me with. > > What I would like to do is to use ROOT as a graphical implement for my C > programs. In the very simple case I would like to draw a simple vector > which would move as its coordinates change during the execution of my > program, in other words, I would like to watch the dynamics of the > process. I know that it is possible with ROOT to draw different > STATIC objects and I have tried to make a simple loop which would draw > the same object with different coordinates on the canvas, > but it did not work. Although the loop was executed without errors what I > saw on the canvas was the object with the last coordinate set from the > loop. The canvas did not draw the coordinates from the preceding steps. > > Could anyone suggest how to implement this sort of animation > with ROOT? > > best regards > > Feodor Ogrin.
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:32 MET