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

Feature: shutter animation #368

Merged
merged 5 commits into from
Jan 19, 2022
Merged
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 config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@
// U S E R I N T E R F A C E
// possible style values: "classic", "modern", "custom"
$config['ui']['style'] = 'modern';
$config['ui']['shutter_animation'] = true;
$config['button']['show_fs'] = false;
$config['button']['homescreen'] = true;
$config['ui']['result_buttons'] = true;
Expand Down
2 changes: 2 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@

<video id="video--preview" autoplay playsinline></video>
<body class="deselect">
<div id="blocker"></div>
<div id="aperture"></div>
<div id="wrapper">
<?php include('template/' . $config['ui']['style'] . '.template.php'); ?>

Expand Down
6 changes: 6 additions & 0 deletions lib/configsetup.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,12 @@
],
'value' => $config['ui']['style'],
],
'ui_shutter_animation' => [
'view' => 'basic',
'type' => 'checkbox',
'name' => 'ui[shutter_animation]',
'value' => $config['ui']['shutter_animation'],
],
'button_show_fs' => [
'view' => 'basic',
'type' => 'checkbox',
Expand Down
2 changes: 2 additions & 0 deletions livechroma.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
<?php endif; ?>
</head>
<body>
<div id="blocker"></div>
<div id="aperture"></div>
<div class="chromawrapper">
<div class="rotarygroup" id="start">
<div class="top-bar">
Expand Down
2 changes: 2 additions & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@
"manual:userinterface:ui_font_size": "Enter the default font size used for the Photobooth interface.",
"manual:userinterface:ui_result_buttons": "If enabled, post-processing buttons will be visible on the on result screen. If disabled the whole button bar will be hidden.",
"manual:userinterface:ui_rounded_corners": "If enabled, the Photobooth UI uses smooth rounded edges.",
"manual:userinterface:ui_shutter_animation": "If enabled, a shutter animation will be visible while taking a picture.",
"manual:userinterface:ui_style": "Choose a start page styling. To use custom styling please create and use \"/template/custom.template.php\" and \"/resources/css/custom_style.css\", if one of these files is not readable we will fallback to default theme.",
"manual:version:check_version": "This will check online against the Github repository for the latest Photobooth version.",
"manual:version:updater_button": "This will check if Photobooth can be updated and perform the update. Only works on Linux if Photobooth was installed via git.",
Expand Down Expand Up @@ -638,6 +639,7 @@
"userinterface:ui_font_size": "Default font size",
"userinterface:ui_result_buttons": "Show button bar on result screen",
"userinterface:ui_rounded_corners": "Rounded corners",
"userinterface:ui_shutter_animation": "Shutter animation",
"userinterface:ui_style": "Styling",
"using_latest_version": "You are using the latest version of photobooth.",
"version": "Version",
Expand Down
34 changes: 34 additions & 0 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const photoBooth = (function () {
resultInner = $('.resultInner'),
spinner = $('.spinner'),
sendMail = $('.send-mail'),
blocker = $('#blocker'),
aperture = $('#aperture'),
idVideoView = $('#video--view'),
idVideoPreview = $('#video--preview'),
idVideoSensor = $('#video--sensor'),
Expand Down Expand Up @@ -262,6 +264,32 @@ const photoBooth = (function () {
}
};

api.shutter = {
start: function () {
blocker.fadeTo(500, 1);
},
stop: function () {
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 @@ -425,6 +453,9 @@ const photoBooth = (function () {
};

api.callTakePicApi = function (data, retry = 0) {
if (config.ui.shutter_animation) {
api.shutter.start();
}
startTime = new Date().getTime();
jQuery
.post('api/takePic.php', data)
Expand All @@ -433,6 +464,9 @@ const photoBooth = (function () {
totalTime = endTime - startTime;
photoboothTools.console.log('took ' + data.style, result);
photoboothTools.console.logDev('Taking picture took ' + totalTime + 'ms');
if (config.ui.shutter_animation) {
api.shutter.stop();
}
cheese.empty();
if (config.preview.flipHorizontal) {
idVideoView.removeClass('flip-horizontal');
Expand Down
25 changes: 25 additions & 0 deletions src/sass/classic_live_chromakeying.scss
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,31 @@
}
}

#blocker {
position: absolute;
display: none;
width: 100%;
height: 100%;
z-index: 1499;
background-color: #ffffff;
opacity: 0;
}

#aperture {
box-sizing: content-box;
display: none;
width: 150%;
padding-bottom: 150%;
height: 0;
position: absolute;
top: 50%;
left: 50%;
z-index: 1500;
transform: translate(-50%, -50%);
border: solid 2000px #000000;
border-radius: 50%;
}

#video--view {
top: 0;
left: 0;
Expand Down
25 changes: 25 additions & 0 deletions src/sass/classic_style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@
@import 'partials/ribbon';
@import 'vendor/photoswipe';

#blocker {
position: absolute;
display: none;
width: 100%;
height: 100%;
z-index: 1499;
background-color: #ffffff;
opacity: 0;
}

#aperture {
box-sizing: content-box;
display: none;
width: 150%;
padding-bottom: 150%;
height: 0;
position: absolute;
top: 50%;
left: 50%;
z-index: 1500;
transform: translate(-50%, -50%);
border: solid 2000px #000000;
border-radius: 50%;
}

#wrapper {
display: none;
position: relative;
Expand Down