Skip to content

Commit 6a5588e

Browse files
committed
Camera fullscreen transition animation
1 parent 9121452 commit 6a5588e

2 files changed

Lines changed: 69 additions & 1 deletion

File tree

src/chat/interface/cameras.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,88 @@ cameras.show = function (id, code, displayName, userColor, userFont) {
4242
cameras.hide(id);
4343
}
4444
var cameraVideo = {};
45+
var transitionAnim = null;
46+
var back = false;
4547
var elms = createCameraVideoDiv(() => {
4648
var div = elms.div;
4749
var fullScreenDiv = elms.fullScreenDiv;
50+
if (transitionAnim) {
51+
transitionAnim.cancel();
52+
if (back) {
53+
div.remove();
54+
fullScreenDiv.remove();
55+
cameraVideosDiv.append(div);
56+
}
57+
}
58+
back = false;
4859
if (div.hasAttribute("fullscreen")) {
60+
//Calculate estimated position.
4961
div.remove();
5062
fullScreenDiv.remove();
5163
cameraVideosDiv.append(div);
5264
div.removeAttribute("fullscreen");
65+
var bounding = div.getBoundingClientRect();
66+
div.remove();
67+
fullScreenDiv.remove();
68+
document.body.append(fullScreenDiv);
69+
document.body.append(div);
70+
//Animate
71+
transitionAnim = div.animate(
72+
[
73+
{
74+
width: "calc(100vw - 100px)",
75+
height: "calc(100vh - 100px)",
76+
position: "fixed",
77+
top: "50%",
78+
left: "50%",
79+
transform: "translate(-50%, -50%)",
80+
zIndex: "9999999",
81+
fontSize: "30px",
82+
},
83+
{
84+
width: "150px",
85+
height: "150px",
86+
position: "fixed",
87+
top: bounding.top + "px",
88+
left: bounding.left + "px",
89+
},
90+
],
91+
{
92+
duration: 300,
93+
easing: "ease-out",
94+
}
95+
);
96+
back = true;
97+
transitionAnim.onfinish = function () {
98+
div.remove();
99+
fullScreenDiv.remove();
100+
cameraVideosDiv.append(div);
101+
};
53102
} else {
103+
var bounding = div.getBoundingClientRect();
54104
div.remove();
55105
fullScreenDiv.remove();
56106
document.body.append(fullScreenDiv);
57107
document.body.append(div);
58108
div.setAttribute("fullscreen", "");
109+
transitionAnim = div.animate(
110+
[
111+
{
112+
position: "fixed",
113+
top: bounding.top + "px",
114+
left: bounding.left + "px",
115+
transform: "translate(0%, 0%)",
116+
fontSize: "13px",
117+
width: "150px",
118+
height: "150px",
119+
},
120+
{},
121+
],
122+
{
123+
duration: 300,
124+
easing: "ease-out",
125+
}
126+
);
59127
}
60128
});
61129
cameraVideo.elms = elms;

wpstatic/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"timestamp":"1761139514426"}
1+
{"timestamp":"1761141290865"}

0 commit comments

Comments
 (0)