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

Added cool animations to DoIT #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Binary file added images/Bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added images/welcomeSignTVonlyblue.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
203 changes: 69 additions & 134 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,150 +1,85 @@
<!--
Don't use the "5-unsafe" CDN version in your own code. It will break on you.
Instead go to videojs.com and copy the CDN urls for the latest version.
-->
<!DOCTYPE html>
<html lang="en">

<head>
<link href="https://vjs.zencdn.net/8.10.0/video-js.css" rel="stylesheet" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- If you'd like to support IE8 (for Video.js versions prior to v7) -->
<!-- <script src="https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script> -->
<style>
body {
background: #091F2F;
text-align: center;
color: #E0E0E0;
/* height: 93.5%; */
margin: 0;
/* padding: 2em; */
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
overflow: hidden;
<title>Document</title>
<style>
.container {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
justify-content: center;
margin-top: 1%;
margin-bottom: 1%;
}

.three {
display: flex;
justify-content: center;
height: 700px;
gap: 2px;
}

#full-image {
width: 100%;
height: 100%;
object-fit: cover;
}



/* for use with videoJS player
#video-container {
height: 100%;
border: none;
} */
#full-image {
display:block;
/* width: 100vw; */
height: 100vh;
object-fit: cover;
align-items: center;
}

.video-js {
height: 100% !important;
width: 100% !important;
border: none;
}

.vjs-fullscreen .vjs-tech {
border: none;
}


</style>
#top {
width: 1145px;
height: 27px;
}
#down {
width: 1145px;
height: 27px;
}


@keyframes slide {
0% {
position: absolute;
left: 100%;
}

100% {
position: absolute;
left: -100%;
}
}
</style>
</head>

<body>
<img id="full-image" src="https://raw.githubusercontent.com/CityOfBoston/doit-welcome-board/main/welcomeSignTV.jpg" alt=" Welcome to the Department of Innovation and Technology!">
</body>
<!-- <div id="video-container"> -->

<!-- <video id="my_video_1" class="video-js vjs-default-skin" autoplay muted controls preload="auto" loop></video> -->
<!-- </div> -->

<!-- <script src="https://vjs.zencdn.net/8.10.0/video.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const videoContainer = 'my_video_1'
const repoOwner = 'CityOfBoston';
const repoName = 'doit-welcome-board';
const winFolderPath = 'wins';
const transitionFolderPath = 'transitions'

const state = {
winVideos: [],
transitionVideos: [],
currentWinIndex: 0,
currentTransitionIndex: 0,
isWinVideoNext: true
};

const player = videojs(videoContainer, { controls: false, autoplay: true, muted: true, loop: false, inactivityTimeout: 0 });

const fetchVideoFiles = async (folderPath) => {
try {
const response = await fetch(`https://api.github.com/repos/${repoOwner}/${repoName}/contents/${folderPath}`);
const data = await response.json();

return data
.filter(file => file.type === 'file' && (file.name.endsWith('.mp4') || file.name.endsWith('.webm')))
.map(file => ({
src: file.download_url,
type: `video/${file.name.split('.').pop()}`
}));
} catch (error) {
console.error(`Error fetching video files from ${folderPath}:`, error);
return [];
}
};

const shuffleArray = (array) => array.sort(() => Math.random() - 0.5);

const playNextVideo = () => {
const { isWinVideoNext, winVideos, transitionVideos } = state;
let videoSources = isWinVideoNext ? winVideos : transitionVideos;
let currentIndex = isWinVideoNext ? state.currentWinIndex : state.currentTransitionIndex;

if (videoSources.length === 0) {
console.error('No video sources available.');
return;
}

const videoSource = videoSources[currentIndex];
player.src({ src: videoSource.src, type: videoSource.type });
player.play();

// Update the current index and shuffle if necessary
if (isWinVideoNext) {
state.currentWinIndex = (state.currentWinIndex + 1) % winVideos.length;
if (state.currentWinIndex === 0) {
state.winVideos = shuffleArray(winVideos);
}
} else {
state.currentTransitionIndex = (state.currentTransitionIndex + 1) % transitionVideos.length;
if (state.currentTransitionIndex === 0) {
state.transitionVideos = shuffleArray(transitionVideos);
}
}

// Toggle for next video
state.isWinVideoNext = !isWinVideoNext;
player.one('ended', playNextVideo);
};

const initializeVideoPlayback = async () => {
state.winVideos = shuffleArray(await fetchVideoFiles(winFolderPath));
state.transitionVideos = shuffleArray(await fetchVideoFiles(transitionFolderPath));

playNextVideo();
};

initializeVideoPlayback();
});
</script> -->
<div class="container">

<marquee id="top" behavior="scroll" direction="left">
<img src="images/Top.png" width="1100px" height="25px" alt="Natural" />
</marquee>

<div class="three">

<marquee id="left" behavior="scroll" direction="down">
<img id="left" src="images/Left.png" width="25px" height="700px" alt=" re">
</marquee>

<img id="full-image" src="images/welcomeSignTVonlyblue.jpg" width="1100px" height="700px"
alt=" Welcome to the Department of Innovation and Technology!">

<marquee id="right" behavior="scroll" direction="up">
<img id="right" src="images/Right.png" width="25px" height="700px" alt=" we">
</marquee>

</div>

<marquee id="down" behavior="scroll" direction="right">
<img src="images/Bottom.png" width="1100px" height="25px" alt="Natural" />
</marquee>

</div>

</body>

</html>


Binary file removed transitions/crying_arnie.mp4
Binary file not shown.
Binary file removed transitions/excited_arnie.mp4
Binary file not shown.
Binary file removed transitions/idle_arnie.mp4
Binary file not shown.