# Animation Settings

Animation settings (Plugin > Railroad > Advanced Animation Settings) can be changed to better match the needs of a renderer.

These settings are not saved between Sketchup sessions.

## Settings

#### Code executed between frames

This code runs between each frame and can tell a renderer to save an image. Changing the code immediately pauses the animation so no unfinished code will be run.

#### Δt

Time between frames. Same as (frame rate)-1.

#### Auto adjust Δt

Adjust frame rate to what Sketchup can keep up with. Typically this is turned off and a frame rate is manually chosen when exporting animation.

#### Move trains according to

Chane whether train movement should be relative to actual time passed or given Δt. Actual time passed makes train run smoother and at more correct speed in Sketchup since it also includes the calculation time between frames. Fixed Δt is used when exporting animations since the actual time passed then is irrelevant.

## Simple Render Example

This is a simple example of frames being saved as images from Sketchup and then turned into a video.

#### Console

#Change into the folder where you want images to be saved.
$video_folder = "D:/video/exported/"
$i = 0
#false if you want to start rendering when train runs over balise, otherwise false.
$export = false

#### Start balise code

$export = true

#### End balise code

$export = false

#### Animation Settings

Δt: 0.1
move trains according to: Δt

#### Code Executed between frames

return unless $export
keys = {
:filename => $video_folder + $i.to_s + ".jpg",
:width => 640,
:height => 480,
:antialias => true,
:compression => 1,
:transparent => false
}
m = Sketchup.active_model
v = m.active_view
v.write_image keys
$i += 1

#### Make video

I've used virtualdub for my animations. These are the steps to create the video file in virtualdub.

- Open virtualdub
- File > Open video file..., tick the checkbox 'Automatically load linked segments' and locate first image.
- Video > Frame Rate, set frame rate to 1/Δt.
- Video > Compression, choose a compression.
- File > Save as Avi.

Also make sure you don't move the camera while rendering...

Copyright © Julia Christina Eneroth 2015.