Startup.esp Documentation

The resource META-INF/startup.esp can be loaded by scrunner by adding the file name module:org.bzdev.anim2d to the scrunner command line or by adding the line


### module:org.bzdev.anim2d
            
to a script This will import a number of classes: It will also define two functions:
  • createAnimation. There is single argument is an ESP object with the following properties:
    • frameWidth. The value of this property is the width of the animation frame in units of points.
    • frameHeight. The value of this property is the height of the animation frame in units of points.
    • ticksPerSecond. The value of this property is the number of simulation ticks per second.
    • ticksPerFrame. The value of this property is the number of simulation ticks until another animation frame is to be created.
    • imageSpaceDistance. The value of this property is a measured distance in units of points.
    • gcsDistance. The value of this property is the GCS distance in meters that imageSpaceDistance represents.
    • xgcs. The value of this property is the X coordinate in GCS coordinates for a reference point (the default value is 0.0).
    • ygcs. The value of this property is the Y coordinate in GCS coordinates for a reference point (the default value is 0.0).
    • xf. The value of this property is the fraction of the distance along the animation frame (left = 0.0, right = 1.0) for the X coordinate of the reference point (the default value is 0.0).
    • yf. The value of this property is the fraction of the distance along the animation frame (bottom = 0.0, top = 1.0) for the Y coordinate of the reference point (the default value is 0.0).
    This function will create an animation, configure it, and return it.
  • runAnimation. This function takes four arguments:
    1. a2d. The animation (e.g., an animation created by calling createAnimation).
    2. title. The title to use for a window when a built-in viewer is used.
    3. da. A directory accessor (typically provided by the scrunner -d option) for a temporary directory used to hold a sequence of images that will be used by a program such as ffmpeg to create the final animation.
    4. tend. The time (in seconds) at which the animation ends.
    This function will run the animation and returns void.

For example,

import (org.bzdev.util.units.MKS);
var a2d = createAnimation({
    frameWidth: 800,
    frameHeight: 600,
    ticksPerSecond: 1000.0,
    ticksPerFrame: 40,
    imageSpaceDistance: 200,
    gcsDistance: feet(12)
  });
...
runAnimation(a2d, "Example", null, 30.0);