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

Option for variable frame rates to download as GIF option #1611

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion examples/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,21 @@ window.onload = function () {
}
});

$('#js-download-gif-framerate-btn').on('click', function (event){

var loader = require('./images/loader');

document.querySelector('#gif_element').src = loader;


let options = getGifResources();
gifshot.createGIF(options, function (obj) { // GIF generation
if (!obj.error) {
document.querySelector('#gif_element').src = obj.image;
}
});
});

function getGifResources() {
// Returns an object with specific gif options
let imgs = document.getElementsByClassName('step-thumbnail');
Expand All @@ -240,7 +255,7 @@ window.onload = function () {
'gifWidth': imgs[0].width,
'gifHeight': imgs[0].height,
'images': imgSrcs,
'frameDuration': 7,
'frameDuration': parseInt($('#js-download-gif-framerate').val()),
};

return options;
Expand Down
1 change: 1 addition & 0 deletions examples/images/loader.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ <h4 class="modal-title">Your gif is ready</h4>
</div>
</div>
<div class="modal-footer">
<div>
<div style="padding: 10px; margin-bottom: 10px;">
<p>Framerates</p>
harshkhandeparkar marked this conversation as resolved.
Show resolved Hide resolved
<input type='number' value=7 id="js-download-gif-framerate" />
harshkhandeparkar marked this conversation as resolved.
Show resolved Hide resolved
<button type="button" id="js-download-gif-framerate-btn" class="btn btn-default">Apply</button>
</div>
</div>
<button type="button" class="btn btn-default" data-dismiss="modal">Done</button>

<button id="js-download-as-gif-button" class="btn btn-primary">Download</button>
Expand Down