analyze.C: This macro produces the flowchart of TFormula::Analyze | Basic Graphics | archi.C: This macro displays the ROOT architecture |
//macro illustrating how to animate a picture using a Timer //Author: Rene Brun #include "TStyle.h" #include "TCanvas.h" #include "TF2.h" #include "TTimer.h" Double_t pi; TF2 *f2; Float_t t = 0; Float_t phi = 30; void anim() { gStyle->SetCanvasPreferGL(true); 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("glsurf1"); TTimer *timer = new TTimer(20); timer->SetCommand("Animate()"); timer->TurnOn(); } void Animate() { //just in case the canvas has been deleted if (!gROOT->GetListOfCanvases()->FindObject("c1")) return; t += 0.05*pi; f2->SetParameter(0,TMath::Cos(t)); phi += 2; gPad->SetPhi(phi); gPad->Modified(); gPad->Update(); } anim.C:1 anim.C:2 anim.C:3 anim.C:4 anim.C:5 anim.C:6 anim.C:7 anim.C:8 anim.C:9 anim.C:10 anim.C:11 anim.C:12 anim.C:13 anim.C:14 anim.C:15 anim.C:16 anim.C:17 anim.C:18 anim.C:19 anim.C:20 anim.C:21 anim.C:22 anim.C:23 anim.C:24 anim.C:25 anim.C:26 anim.C:27 anim.C:28 anim.C:29 anim.C:30 anim.C:31 anim.C:32 anim.C:33 anim.C:34 anim.C:35 anim.C:36 anim.C:37 anim.C:38 anim.C:39 anim.C:40 anim.C:41 anim.C:42 |
|