mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 03:43:50 +00:00
feat: lower third
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
.mainContainer {
|
||||
width: 95%;
|
||||
background: linear-gradient(90deg, #202020 0%, #121212 100%);
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
height: 95vh;
|
||||
color: #fffd;
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
import { AnimatePresence, motion } from 'framer-motion';
|
||||
import style from './Lower.module.css';
|
||||
|
||||
export default function Lower(props) {
|
||||
const { pres, publ, lower, title, time, events, selectedId, general } = props;
|
||||
|
||||
// getting config from URL
|
||||
// like http://localhost:3000/lower?bg=ff2&text=f00&size=0.6&transition=5
|
||||
let params = new URLSearchParams(props.location.search);
|
||||
|
||||
const preset = params.get('preset') ? params.get('preset') : 1;
|
||||
const size = params.get('size') ? params.get('size') : 1;
|
||||
const transitionIn = params.get('transition') ? params.get('transition') : 3;
|
||||
const textColour = params.get('bg') ? `#${params.get('text')}` : '#fffffa';
|
||||
const bgColour = params.get('bg') ? `#${params.get('bg')}` : '#00000033';
|
||||
const key = params.get('key') ? `#${params.get('key')}` : 'null';
|
||||
|
||||
// Format messages
|
||||
const showLower = lower.text !== '' && lower.visible;
|
||||
|
||||
// transition segments
|
||||
const eight = transitionIn / 8;
|
||||
const quarter = transitionIn / 4;
|
||||
const third = transitionIn / 3;
|
||||
const half = transitionIn / 2;
|
||||
|
||||
// motion
|
||||
const lowerThirdVariants = {
|
||||
hidden: {
|
||||
opacity: 0,
|
||||
},
|
||||
visible: {
|
||||
opacity: 1,
|
||||
transition: {
|
||||
duration: third,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const titleContainerVariants = {
|
||||
hidden: {
|
||||
left: -1000,
|
||||
},
|
||||
visible: {
|
||||
left: 0,
|
||||
transition: {
|
||||
duration: third,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const titleVariants = {
|
||||
hidden: {
|
||||
opacity: 0,
|
||||
},
|
||||
visible: {
|
||||
opacity: 1,
|
||||
transition: {
|
||||
delay: quarter,
|
||||
duration: half,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const subtitleContainerVariants = {
|
||||
hidden: {
|
||||
left: -1000,
|
||||
},
|
||||
visible: {
|
||||
left: 0,
|
||||
transition: {
|
||||
delay: eight,
|
||||
duration: third,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const subtitleVariants = {
|
||||
hidden: {
|
||||
opacity: 0,
|
||||
},
|
||||
visible: {
|
||||
opacity: 1,
|
||||
transition: {
|
||||
delay: third,
|
||||
duration: third * 2,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={style.lowerThird}
|
||||
style={{
|
||||
backgroundColor: key,
|
||||
color: textColour,
|
||||
fontSize: `${size * 4}vh`,
|
||||
}}
|
||||
>
|
||||
<motion.div
|
||||
className={style.lowerContainer}
|
||||
style={{ backgroundColor: bgColour }}
|
||||
variants={lowerThirdVariants}
|
||||
initial='hidden'
|
||||
animate='visible'
|
||||
exit={{ opacity: 0 }}
|
||||
>
|
||||
<motion.div
|
||||
className={style.titleContainer}
|
||||
variants={titleContainerVariants}
|
||||
>
|
||||
<motion.div className={style.title} variants={titleVariants}>
|
||||
{title.titleNow}
|
||||
</motion.div>
|
||||
<div className={style.titleDecor} />
|
||||
</motion.div>
|
||||
<motion.div
|
||||
className={style.subtitleContainer}
|
||||
variants={subtitleContainerVariants}
|
||||
>
|
||||
<div className={style.subDecor} />
|
||||
<motion.div className={style.subtitle} variants={subtitleVariants}>
|
||||
{title.presenterNow}
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
|
||||
<AnimatePresence>
|
||||
{showLower && (
|
||||
<motion.div
|
||||
className={style.messageContainer}
|
||||
key='modal'
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ scaleY: 0 }}
|
||||
transition={{ duration: 0.5 }}
|
||||
>
|
||||
<div className={style.message}>{lower.text}</div>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
.lowerThird {
|
||||
color: #fffffa;
|
||||
font-size: 4vh;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.lowerContainer {
|
||||
position: absolute;
|
||||
top: 70vh;
|
||||
background-color: #00000033;
|
||||
|
||||
padding: 1vw 1vw 1vw 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 45vw;
|
||||
gap: 3vh;
|
||||
border-radius: 0 1vh 1vh 0;
|
||||
}
|
||||
|
||||
.messageContainer,
|
||||
.messageContainerHidden {
|
||||
position: absolute;
|
||||
bottom: 2vh;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
filter: blur(0);
|
||||
}
|
||||
|
||||
.titleContainer,
|
||||
.subtitleContainer {
|
||||
display: grid;
|
||||
grid-template-columns: auto max-content;
|
||||
grid-template-areas: 'decor text';
|
||||
align-items: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.titleDecor,
|
||||
.subDecor {
|
||||
grid-area: decor;
|
||||
height: 4vh;
|
||||
background-color: #ff6969;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
rgba(255, 105, 105, 1) 0%,
|
||||
rgba(255, 132, 132, 1) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.titleDecor,
|
||||
.subDecor {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.title,
|
||||
.subtitle {
|
||||
grid-area: text;
|
||||
padding-left: 1vw;
|
||||
justify-self: right;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.title {
|
||||
}
|
||||
|
||||
.subtitleContainer {
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
}
|
||||
|
||||
.messageContainer {
|
||||
background-color: #00000033;
|
||||
opacity: 1;
|
||||
transition: 0.5s;
|
||||
transition-property: opacity;
|
||||
}
|
||||
|
||||
.messageContainerHidden {
|
||||
background-color: #00000033;
|
||||
opacity: 0;
|
||||
transition: 0.5s;
|
||||
transition-property: opacity;
|
||||
}
|
||||
|
||||
.message {
|
||||
font-size: 3.5vh;
|
||||
}
|
||||
@@ -86,7 +86,7 @@
|
||||
font-size: 18vw;
|
||||
line-height: 18vw;
|
||||
font-weight: 600;
|
||||
color: #ff5353;
|
||||
color: #ff6969;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
}
|
||||
|
||||
.container__grayFinished {
|
||||
border: 1vw solid #ff5353;
|
||||
border: 1vw solid #ff6969;
|
||||
}
|
||||
|
||||
/* =================== OVERLAY ===================*/
|
||||
|
||||
Reference in New Issue
Block a user