initial commit

This commit is contained in:
Ray Elliott 2022-04-19 15:34:33 +01:00
commit 2baaa573f5
7 changed files with 2362 additions and 0 deletions

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

29
index.html Normal file
View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app" class="wrapper">
<ul class="orbitals clockwise">
<li class="orbital bg-red"><div class="orbital-content content-center anti-clockwise"><p>Hallo!</p></div></li>
<li class="orbital bg-green"><div class="orbital-content"></div></li>
<li class="orbital bg-blue"><div class="orbital-content"></div></li>
<li class="orbital bg-red"><div class="orbital-content content-center anti-clockwise"><p>How's things?</p></div></li>
<li class="orbital bg-green"><div class="orbital-content"></div></li>
<li class="orbital bg-blue"><div class="orbital-content"></div></li>
<li class="orbital bg-red"><div class="orbital-content"></div></li>
<li class="orbital bg-green"><div class="orbital-content"></div></li>
</ul>
<div class="inner-content">
<div class="image-hover">
<img class="img" src="https://via.placeholder.com/256x256/999/333">
<img class="img" src="https://via.placeholder.com/256x256/666/ccc">
</div>
</div>
</div>
<script type="module" src="/main.js"></script>
</body>
</html>

1
main.js Normal file
View File

@ -0,0 +1 @@
import "./style.css";

2126
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "orbitals",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
"postcss-nesting": "^10.1.4",
"postcss-preset-env": "^7.4.3",
"vite": "^2.9.5"
}
}

6
postcss.config.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
plugins: {
"postcss-preset-env": {},
"postcss-nesting": {},
},
};

161
style.css Normal file
View File

@ -0,0 +1,161 @@
:root {
--width__inner-content: 10em;
--width__orbital: 7em;
--radius__orbital: 14em;
--radius__orbital--diagonal: calc(var(--radius__orbital) / 1.4142);
}
body, html {
padding: 0;
margin: 0;
background-color: rgba(0, 255, 0, 0.1);
}
.wrapper {
position: relative;
width: 80vw;
height: 80vh;
font-size: 1rem;
background-color: white;
}
ul, li {
padding: 0;
margin: 0;
list-style: none;
}
.orbitals {
position: relative;
width: 100%;
height: 100%;
}
.orbital {
position: absolute;
width: var(--width__orbital);
height: var(--width__orbital);
border-radius: 50%;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
&:nth-child(1) {
/* top */
transform: translate(-50%, calc(-50% - var(--radius__orbital)));
}
&:nth-child(2) {
/* top right */
transform: translate(calc(-50% + var(--radius__orbital--diagonal)), calc(-50% - var(--radius__orbital--diagonal)));
}
&:nth-child(3) {
/* right */
transform: translate(calc(-50% + var(--radius__orbital)), -50%);
}
&:nth-child(4) {
/* bottom right */
transform: translate(calc(-50% + var(--radius__orbital--diagonal)), calc(-50% + var(--radius__orbital--diagonal)));
}
&:nth-child(5) {
/* bottom */
transform: translate(-50%, calc(-50% + var(--radius__orbital)));
}
&:nth-child(6) {
/* bottom left */
transform: translate(calc(-50% - var(--radius__orbital--diagonal)), calc(-50% + var(--radius__orbital--diagonal)));
}
&:nth-child(7) {
/* left */
transform: translate(calc(-50% - var(--radius__orbital)), -50%);
}
&:nth-child(8) {
/* top left */
transform: translate(calc(-50% - var(--radius__orbital--diagonal)), calc(-50% - var(--radius__orbital--diagonal)));
}
}
.orbital-content {
width: 100%;
height: 100%;
}
.inner-content {
position: absolute;
width: var(--width__inner-content);
height: var(--width__inner-content);
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
opacity: 0.3;
}
.image-hover {
width: 100%;
height: 100%;
& > .img {
position: absolute;
width: 100%;
height: 100%;
inset: 0;
object-fit: cover;
&:last-child {
transition: opacity .3s;
opacity: 0;
}
}
&:hover > .img {
&:last-child {
opacity: 1;
}
}
}
.content-center {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.bg-red {
background-color: rgba(255, 200, 200);
}
.bg-green {
background-color: rgba(200, 255, 200);
}
.bg-blue {
background-color: rgba(200, 200, 255);
}
.clockwise {
animation: rotate 20s linear infinite;
}
.anti-clockwise {
animation: rotate 20s reverse linear infinite;
}
@keyframes rotate {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}