 | Because movies usually feature very complex animations,
they cannot be clicked together with the mouse, but are written in any text editor using the
Yanaconda macro language. This allows you to quickly copy and paste blocks from different movies to create a scaffold for your own productions.
Go to the yasara/mov directory and create a subdirectory with the name of your movie. In this subdirectory,
you must then store all the data needed by your movie, including the Yanaconda macro
(named like your movie, but with a .mcr extension). As a start,
open the macro yasara/mov/mdintro/mdintro.mcr, an introduction to molecular dynamics simulations. If you do not have this movie,
download it from www.yasara.org/movies
. Change the header to match your movie. The chapter numbers in the TOPIC and TITLE fields define where your movie appears when you click on Help
> Play help movie. Example:
# YASARA MOVIE
# TOPIC: 6. NMR Spectroscopy
# TITLE: 6.4. KING - Killing Inaccurate NOEs by Guessing
# REQUIRES: Dynamics
# AUTHOR: MyName
# LICENSE: GPL
Use the following commands at the beginning: |
CD (MacroDir)
| Change the working directory to the place of this macro,
so that you do not have to specify paths when loading your files |
Menu Off
| Hide the menus, as a presentation with YASARA menus would look strange. |
Console Off
| Hide the console as well, which would otherwise display the commands run by the macro. |
FullScreen On
| Switch to fullscreen mode (helpful when connected to a video projector) |
PointerStyle Large
| Choose a large mouse pointer, so that even people in the last row can follow your presentation |
|
The probably most crucial command in a movie is
Wait, which waits for a given condition and updates the screen while waiting
. Normally, YASARA redraws the screen after each command. This is convenient when working interactively,
but it is not what you want in a movie, because often more than one command is needed to do something. If the intermediate steps were all shown on screen,
this would be very annoying. Consequently YASARA stops updating the screen as soon as the
console is switched off. It is then your duty to tell YASARA that the macro has reached a point where it can be held to update the screen. This is achieved with the
Wait command:
|
Wait 1
| Wait for one screen update, then continue |
Wait 60
| Wait for 60 screen updates (= 1 second if FramesPerSec is 60) |
Wait LeftButton
| Wait for a click on the left mouse button |
Wait RightButton
| Wait for a click on the right mouse button |
Wait ContinueButton
| Display a continue button and wait for a click |
|
Console off
LoadPDB 1crn
# Start an automatic rotation in steps of 2 degrees about the Y-axis
AutoRotateObj 1crn,Y=2
# Wait for 180 screen updates (=360/2, one full rotation of 1crn)
Wait 180
# And stop after one full rotation
AutoRotateObj 1crn,Y=0
Alternatively, this macro would do the same:
Console off
LoadPDB 1crn
# Run 180 single rotation steps in a loop
for i=1 to 180
RotateObj 1crn,Y=2
Wait 1
Nevertheless, the first macro is the preferred one, because it allows YASARA to
speedup the rotation on slow computers: if the graphics card is not capable of displaying
180 rotation steps fast enough, YASARA may decide to show only 90 and rotate 1crn in steps of four instead of two degrees.
Waiting for a pressed button is helpful for tutorials and talks. However,
you maybe want two different versions of your movie: one which you can use during your talk,
and one which actually displays the things you want to say on screen, so that people who missed your talk can download the movie instead. The second one would then also use a
'ContinueButton', so that the audience can e.g. rotate a protein structure before continuing.
This can be achieved with the 'Help' flag. If a movie is run via Help
> Play help movie, the variable 'Help' is set to 1. You can therefore start a movie with the following code:
if Help
# If we are showing a help movie, wait for clicks on the ContinueButton
button='ContinueButton'
else
# Otherwise just wait for a click on the left mouse button
button='LeftButton'
And then use
Wait (button)
to wait for the button you selected above. If you want,
add your text:
if Help
ShowMessage "Welcome everyone to my first YASARA movie. Today, I will tell you about.."
Every new section in your movie should start with a label,
followed by the Clear command.
#
# SLIDE 1: Title Page
#
TitlePage:
Clear
LoadPDB 1crn
The label makes sure that you can jump to this point using any of these methods:
- The forward and backward buttons in the top menu line.
- The Go commands you can find at Options > Macro & Movie.
- If the menus are switched off, look at the Macro & Movie option in the context menu (RightClick on the background).
- Pass the name of the label to the PlayMacro command.
The Clear command sets YASARA to a defined state,
which is important because the user can jump to a label at any time while a macro is executed. In case you do not want to clear everything
(e.g. some logos you loaded as image 1 and which you want to display during the entire presentation),
use your own Clear command:
TitlePage:
# MyClear: Delete all objects and all but the first image
DelObj All
DelImage !1
If you want to temporarily skip a section during development,
just comment it out using triple quotes """ in the beginning and the end.
To quickly develop a movie, follow these steps:
- Write the initial part in your text editor (e.g. loading a structure or image), save it.
You can use the StopMacro command to stop the macro at a certain point.
- Run the macro in YASARA (click Options > Macro & Movie > Play macro,
browse to the directory of your movie and select the .mcr file, or simply press <Ctrl>+<M> to rerun the last macro.
At this point it is important that you run your movie as a normal macro, otherwise YASARA will restore the
current scene after the movie ended - which is usually not what you want while debugging).
- Move the protein you loaded to the right spot, get its current position and orientation
and use these numbers in the macro with Pos and Ori or AutoMoveTo and AutoRotateTo
to animate the protein. After some time, when you are used to YASARA's coordinate system,
you will know the right numbers just by looking at the screen.
When preparing movies for a scientific presentation that may last several hours,
writing everything from scratch in Yanaconda takes too long. An efficient solution is to prepare the slides in OpenOffice Impress or Microsoft Powerpoint,
to convert them to a YASARA movie and to finally add animations on those slides that require them.
The procedure is as follows:
- Create the slides in OpenOffice Impress and save them in the standard format of your OpenOffice version (e.g. *.sxi).
To import a PowerPoint presentation (e.g. in *.ppt format), first open it in OpenOffice Impress, correct the
little details that OpenOffice's import filter got wrong and save it also in OpenOffice standard format.
- Start YASARA and click Options > Macro & Movie > Import movie, select the OpenOffice *.sxi file,
then choose a name for your movie and the animation to change the slides.
In addition to the default AlphaBlend, the following animation types are supported for
entering the screen: fromLeft, fromRight, fromTop, fromBottom, Circle, Jump, BlendLeft,
BlendRight, BlendTop, BlendBottom, Pop. Leaving the sceen can be done with
either toLeft, toRight, toTop, toBottom, Circle, Drop, BlendLeft, BlendRight, BlendTop, BlendBottom or Pop.
- YASARA then creates a new movie directory in yasara/mov/YourMovieName, runs OpenOffice to convert the
slides to platform independent PNG images, closes OpenOffice, and creates a Yanaconda macro to show the slides with
the requested transition animations. Due to a bug in the Windows version of OpenOffice, YASARA
may hang right after the OpenOffice window has been closed. In this case, press <Ctrl>+<Alt>+<Del>
to bring up the task manager and manually kill the process named 'soffice.exe'. Then the
conversion can be completed.
- Click Help > Play help movie and select your movie in the Multimedia section 6.99.
- Finally, open the macro yasara/mov/YourMovieName/YourMovieName.mcr in a text editor and
add molecular animations where you intended. You can also give each slide a clear name,
so that you can easily jump to a certain part of your presentation when required by
a question from the audience.
YASARA can load bitmap images in PNG or (worse, because uncompressed) BMP format. These bitmaps can be displayed as
(transparent) back- and foreground graphics or attached as textures to objects.
Example to show five images in a row:
for i=1 to 5
LoadPNG MyImage(i)
ShowImage MyImage(i)
Wait (Button)
DelImage MyImage(i)
If you have only a small amount of text, you can display and animate it directly by creating a
text object and printing
to it using your favorite font:
MakeTextObj Title,Width=800,Height=80
Font Name=Baikal,Height=40%,Color=White,Spacing=2,Depth=100,DepthCol=ff8000
PosText 50%,50%,Justify=Center
Print "Molecular Dynamics Simulations\n"
Print "Watching Nature@Work"
PosObj Title,0,180,670
YASARA automatically scales the scene such that movies always look the same,
independent of the actual window size, as long as the aspect ratio of the view area does not change. E.g. if you create your movie with a view area of
1024x768 pixels, it will look exactly the same when played back in a view area of
640x480 pixels. The 'view area' is the part of the YASARA window where you can see molecules. If you disable
menus, then the view area is identical to the
YASARA window size, otherwise it is lower by
48 pixels (the top and bottom menu bar are each 24 pixels high). Example: You want to create a movie that will be played back on a cheap video beamer with
640x480 pixels resolution, but you do not want to make your window that small while creating the movie. In addition you still want to use the menus,
but you do of course not want to show the menus with the beamer. So the final movie resolution will be 640x480 pixels, that's an aspect ratio of
640/480 = 1.333. Now you need a window size that gives you the same aspect ratio for the view area. A typical choice for the view area is
1024x768 pixels (1024/768 = 1.333). As we also want to show the menu bars which require
48 pixels, the final window size is 1024x(768+48) = 1024x816. Press <Space> to bring up the console and type:
ScreenSize 1024,816
Now create your movie, and to play it back on the beamer,
add the following commands:
ScreenSize 640,480
Menu off
Two little exceptions from these rules:
- The head up displays are not rescaled. E.g. the location of the message
created with ShowMessage depends on the window size.
- The rules above apply only as long as the view area is <=1280x960 pixels.
Above 1280x960 pixels YASARA starts to show you more of the scene and does
not scale it up any more.
When you base your talk at a scientific conference or job interview on a YASARA movie,
consider the following hints to make everything run smoothly:
- Use Labels for each section to make sure that you can easily
jump there via the context menu in reply to questions from the audience. Choose
obvious names, not 'SlideX'.
- Keep in mind that jumping to a label does not influence the scene or simulation
parameters. Even if the first command after a label is Clear, the force field
will still be the same as before the jump. Hence if a certain slide does not
specify a force field but runs a simulation, it will use whichever force field
was selected before the jump. In short, make sure to set ForceField, Cutoff,
Interactions, Boundary, Longrange, TimeStep, SimSteps and TempCtrl
correctly in each slide that shows a simulation.
- When running a simulation, use 'Sim Pause,in=...' to make sure that it
does not continue forever. Otherwise, if your talk takes longer than expected,
you will impress your audience with a real-time simulation you have never seen
before yourself - including potential surprises.
|