Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to explicitly set delay for the very last frame #144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ For Linux and MacOS, the created directory is located under the home directory `

* `frameDelay`: The delay between frames in ms. If the value is `auto` use the actual recording delays.
* `maxIdleTime`: Maximum delay between frames in ms. Ignored if the `frameDelay` isn't set to `auto`. Set to `auto` to prevent limiting the max idle time.
* `lastFrameDelay`: Delay for the very last frame in ms. Overrides `maxIdleTime` and `frameDelay` for last frame. If the value is `auto` use the actual recording delay.

## GIF

Expand Down
16 changes: 14 additions & 2 deletions commands/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ function command(argv) {
// Playing options
var options = {
frameDelay: argv.recordingFile.json.config.frameDelay,
maxIdleTime: argv.recordingFile.json.config.maxIdleTime
maxIdleTime: argv.recordingFile.json.config.maxIdleTime,
lastFrameDelay: argv.recordingFile.json.config.lastFrameDelay
};

// Use the actual delays between frames as recorded
if (argv.realTiming) {

options = {
frameDelay: 'auto',
maxIdleTime: 'auto'
maxIdleTime: 'auto',
lastFrameDelay: 'auto'
};

}
Expand Down Expand Up @@ -105,6 +107,11 @@ function adjustFramesDelays(records, options) {
options.maxIdleTime = 2000;
}

// Default value for options.lastFrameDelay
if (typeof options.lastFrameDelay === 'undefined') {
options.lastFrameDelay = 'auto';
}

// Default value for options.speedFactor
if (typeof options.speedFactor === 'undefined') {
options.speedFactor = 1;
Expand All @@ -125,6 +132,11 @@ function adjustFramesDelays(records, options) {

});

// Explicitly set lastFrameDelay
if (options.lastFrameDelay != 'auto') {
records[records.length - 1].delay = options.lastFrameDelay;
}

}

/**
Expand Down
3 changes: 2 additions & 1 deletion commands/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ function command(argv) {
// For adjusting (calculating) the frames delays
var adjustFramesDelaysOptions = {
frameDelay: config.frameDelay,
maxIdleTime: config.maxIdleTime
maxIdleTime: config.maxIdleTime,
lastFrameDelay: config.lastFrameDelay
};

// For rendering the frames into PNG images
Expand Down
5 changes: 5 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ frameDelay: auto
# Set to `auto` to prevent limiting the max idle time
maxIdleTime: 2000

# Delay for the very last frame in ms
# Overrides `maxIdleTime` and `frameDelay` value for last frame
# If the value is `auto` use the actual recording delay
lastFrameDelay: auto

# The surrounding frame box
# The `type` can be null, window, floating, or solid`
# To hide the title use the value null
Expand Down