Logo expanding effect - transition

by katalin_2003

HTML

<form action="" method="POST">
	<div class="card-container">
	<div class="color-square square-1-1">
		<div class="cover-square square-1-2"></div>
	</div>
	
	<div class="color-square square-2-1">
		<div class="cover-square square-2-2"></div>
	</div>

	<div class="bi-form">
		<input type="text" class="bi-email" name="bi-email">
		<button class="bi-submit" style="color: #008c3c">SE CONNECTER</button>
	</div>
	</div>
</form>

CSS

* {
	box-sizing: border-box;
}

body {
	margin: 0px;
	/*margin-top: -4em;*/
	padding: 0px;
	/* #303030 */
	background-color: #303030;
	/*padding-top: 2em;*/

	height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center; 
	justify-content: center;

}

.card-container {
	position: relative;
	width: 138px;
	height: 138px;
	margin: 0 auto;
	background-color: #11ffee00;
	transition: height 1.2s ease-in-out,
				width 1.2s ease-in-out;
/*	transition: all 1.2s ease-in-out;*/
	cursor: pointer;
}

.color-square {
	position: absolute;
	width: 100px;
	height: 100px;
}

.cover-square {
	position: relative;
	width: 64px;
	height: 64px;
	background-color: #303030;
}

.square-1-1 {
	background-color: #74b94e;
	top: 0px;
	left: 0px;
}

.square-2-1 {
	background-color: #d9dc3c;
	bottom: 2px;
	right: 2px;
}

.square-1-2 {
	top: 36px;
	left: 36px;
}

.square-2-2 {
	/*
	bottom: 36px;
	right: 36px;
	*/
}

.bi-form {
	opacity: 0;
	pointer-events: none;
	/* 1.8s */
	transition: opacity 0.6s ease-in 0.5s;
}

.bi-email,
.bi-submit {
	padding: 0.4em 0em 0.4em 0em;
}

.bi-email {
	align-self: stretch;
	margin-bottom: 1em;
	font-size: 1.4em;
	text-align: center;
}

.bi-email:focus-visible,
.bi-submit:focus-visible {
	outline-color: #008c3c;
	outline-width: 5px;
}

.bi-submit {
	width: 60%;
	height: 3em;
	font-size: 0.8em;
	cursor: pointer;
	-webkit-appearance: none;
	-webkit-border-radius: none;
	border-radius: 3px;

	/* BE style */
	background-color: #008c3c;
	color: #FFFFFF;
	border-radius: 1.875rem;
	border: 1px solid #008c3c;
	padding: 0.75rem;
}

.card-container-expand {
	width: 94vw;
	max-width: 600px;
	height: 80vh;
	/*max-height: 320px;*/
}

.bi-form-expand {
	position: absolute;
	width: 260px;
	height: 6em;
	visibility: visible;
	display: flex;
	flex-direction: column;
	align-content: space-between;
	align-items: center;
	justify-content: center;
	opacity: 1;
	top: 0px;
	right: 0px;
	bottom: 0px;
	left: 0px;
	margin: auto;
	pointer-events: all;
}

/* Landscape...

JavaScript

const cardContainer = document.getElementsByClassName('card-container')[0];
const biForm = document.getElementsByClassName('bi-form')[0];
const biEmail = document.getElementsByClassName('bi-email')[0];
const biSubmit = document.getElementsByClassName('bi-submit')[0];

cardContainer.addEventListener('click', function() {
	const sq11 = document.getElementsByClassName('square-1-1')[0];
	const sq12 = document.getElementsByClassName('square-1-2')[0];

	const sq21 = document.getElementsByClassName('square-2-1')[0];
	const sq22 = document.getElementsByClassName('square-2-2')[0];

	console.log(sq11);

	sq11.style.transition = 'transform 1.4s ease';
	sq11.style.transform = 'translateX(calc(100% - 42vw)) translateY(calc(100% - 45vh))';

	//sq12.style.transition = 'transform 1.4s ease';
	//sq12.style.transform = 'translateX(calc(100% - 40vw)) translateY(calc(100% - 38vh))';

	sq21.style.transition = 'transform 1.4s ease';
	sq21.style.transform = 'translateX(calc(100% + 30vw)) translateY(calc(100% + 45vh))';

	//sq22.style.transition = 'transform 1.4s ease';
	//sq22.style.transform = 'translateX(calc(100% + 32vw)) translateY(calc(100% + 53vh))';
});