Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Animation.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the           
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: Animation.h,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.46 $       $Date: 2020/02/26 03:51:30 $
00015  *
00016  ***************************************************************************/
00023 #ifndef ANIMATION_H
00024 #define ANIMATION_H
00025 
00026 #include "MoleculeList.h"
00027 #include "UIObject.h"
00028 
00029 #define SPEED_FACTOR    0.5f // max fraction of a sec between redraws
00030 
00038 class Animation : public UIObject {
00039 public:
00040   // enums for Animation options
00041   enum AnimDir  { ANIM_FORWARD, ANIM_FORWARD1, ANIM_REVERSE, ANIM_REVERSE1, 
00042                   ANIM_PAUSE, ANIM_TOTAL_DIRS };
00043   enum AnimStyle  { ANIM_ONCE, ANIM_LOOP, ANIM_ROCK, ANIM_TOTAL_STYLES };
00044 
00045 private:
00048   MoleculeList &mlist;
00049  
00051   double lastTime;
00052 
00053   int frameSkip;       
00054   float Speed;         
00055   AnimDir animDir;     
00056   AnimStyle animStyle; 
00057 
00058 public:
00060   Animation( VMDApp * );
00061   
00064   int num() { 
00065       Molecule *m = mlist.top();
00066       if (m) return m->numframes();
00067       return 0;
00068   }
00069 
00072   int frame() { 
00073       Molecule *m = mlist.top();
00074       if (m) return m->frame();
00075       return -1;
00076   }
00077 
00080   void goto_frame(int fr);
00081 
00083   virtual int check_event();
00084 
00085   void skip(int newsk);                            
00086   int skip() const { return frameSkip; }           
00087   void anim_dir(AnimDir ad) { animDir = ad; }      
00088   AnimDir anim_dir() const { return animDir; }     
00089   void anim_style(AnimStyle as);                   
00090   AnimStyle anim_style() const { return animStyle; } 
00091 
00092 
00095   float speed(float newsp);
00096   float speed() const { return (float) (Speed / SPEED_FACTOR); }
00097 };
00098 
00100 extern const char *animationStyleName[Animation::ANIM_TOTAL_STYLES];
00101 
00103 extern const char *animationDirName[Animation::ANIM_TOTAL_DIRS];
00104 
00105 #endif
00106 

Generated on Fri Nov 8 02:43:52 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002