Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
core: add own animation functions
Browse files Browse the repository at this point in the history
Move the shutter start and stop animation to it's own function,
this way we are more flexible while adjusting things if needed.

Change-Id: If4b9c8c4d3f664bb44c40b5a19124b86bac52305
  • Loading branch information
andi34 committed Jan 17, 2022
1 parent 2179fa2 commit 6b441af
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,32 @@ const photoBooth = (function () {
}
};

api.shutter = {
start: function () {
blocker.fadeTo(500, 1);
},
stop: function (selector) {
aperture.show();
aperture.animate(
{
width: 0,
'padding-bottom': 0
},
500,
function () {
blocker.css('opacity', '0');
blocker.hide();
}
);
aperture.fadeTo(1000, 0, function () {
aperture.css('opacity', '1');
aperture.css('width', '150%');
aperture.css('padding-bottom', '150%');
aperture.hide();
});
}
};

api.showResultInner = function (flag) {
if (flag) {
resultInner.addClass('show');
Expand Down Expand Up @@ -429,7 +455,7 @@ const photoBooth = (function () {

api.callTakePicApi = function (data, retry = 0) {
if (config.ui.shutter_animation) {
blocker.fadeTo(500, 1);
api.shutter.start();
}
startTime = new Date().getTime();
jQuery
Expand All @@ -440,24 +466,7 @@ const photoBooth = (function () {
photoboothTools.console.log('took ' + data.style, result);
photoboothTools.console.logDev('Taking picture took ' + totalTime + 'ms');
if (config.ui.shutter_animation) {
aperture.show();
aperture.animate(
{
width: 0,
'padding-bottom': 0
},
500,
function () {
blocker.css('opacity', '0');
blocker.hide();
}
);
aperture.fadeTo(1000, 0, function () {
aperture.css('opacity', '1');
aperture.css('width', '150%');
aperture.css('padding-bottom', '150%');
aperture.hide();
});
api.shutter.stop();
}
cheese.empty();
if (config.preview.flipHorizontal) {
Expand Down

0 comments on commit 6b441af

Please sign in to comment.