From 7d4ecd0a88294f74065bbc2bf851879c8df5ba1d Mon Sep 17 00:00:00 2001 From: BOT Alex <44818698+MagicBOTAlex@users.noreply.github.com> Date: Fri, 29 Dec 2023 13:55:01 +0100 Subject: [PATCH] Added 3d cube and run shell script --- run.sh | 10 ++++ src/App.svelte | 77 ++++++++++++++++++++++++++++- src/app.css | 5 ++ src/cube3d.css | 110 +++++++++++++++++++++++++++++++++++++++++ src/lib/ZSpacer.svelte | 2 + 5 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 run.sh create mode 100644 src/cube3d.css create mode 100644 src/lib/ZSpacer.svelte diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..03ebc6a --- /dev/null +++ b/run.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Enable echoing of commands +set -x + +# Install npm dependencies +npm install + +# Run the development script +npm run dev diff --git a/src/App.svelte b/src/App.svelte index 61ca033..73da83f 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1,10 +1,50 @@ - + +
Home @@ -13,7 +53,37 @@ About
- + + + + + + +
+
+ test {scrollPos} +
+ + + +
+
+
1
+
2
+
3
+
4
+
5
+
6
+
+
+
+
+
+ + +
diff --git a/src/app.css b/src/app.css index 4071105..3500441 100644 --- a/src/app.css +++ b/src/app.css @@ -61,4 +61,9 @@ body { .topnav a.active { background-color: #04AA6D; color: white; +} + +.horizontal{ + display: flex; + justify-content: flex-start; } \ No newline at end of file diff --git a/src/cube3d.css b/src/cube3d.css new file mode 100644 index 0000000..9fee84c --- /dev/null +++ b/src/cube3d.css @@ -0,0 +1,110 @@ +/* .rotate1{ + transform: rotateX(0deg) rotateY(90deg) rotateZ(0deg); +} */ +/* demo: https://codepen.io/mrosati84/pen/kWwXLg */ + +:root { + --cube-size: 400px; +} + +#cube-3d-container { + width: var(--cube-size); + height: var(--cube-size); + position: relative; + perspective: 1000px; + -moz-perspective: 1000px; + padding: 25px; + } + + #cube3d { + width: 100%; + height: 100%; + position: absolute; + transform-style: preserve-3d; + transition: transform 1s ease-out; + } + + #cube3d div { + width: var(--cube-size); + height: var(--cube-size); + display: block; + position: absolute; + border: none; + line-height: var(--cube-size); + text-align: center; + font-size: 50px; + font-weight: bold; + } + + .front { + background: rgba(255,0,0,.5); + } + + .back { + background: rgba(0,255,0,.5); + } + + .right { + background: rgba(0,0,255,.5); + } + + .left { + background: rgba(0,255,255,.5); + } + + .top { + background: rgba(255,0,255,.5); + } + + .bottom { + background: rgba(255,255,0,.5); + } + + /* .front { + background: url('https://i1.sndcdn.com/avatars-IesRuX9vhlBZzVuz-1H6bOA-t500x500.jpg'); + } + + .back { + background: url('https://i1.sndcdn.com/avatars-IesRuX9vhlBZzVuz-1H6bOA-t500x500.jpg'); + } + + .right { + background: url('https://i1.sndcdn.com/avatars-IesRuX9vhlBZzVuz-1H6bOA-t500x500.jpg'); + } + + .left { + background: url('https://i1.sndcdn.com/avatars-IesRuX9vhlBZzVuz-1H6bOA-t500x500.jpg'); + } + + .top { + background: url('https://i1.sndcdn.com/avatars-IesRuX9vhlBZzVuz-1H6bOA-t500x500.jpg'); + } + + .bottom { + background: url('https://i1.sndcdn.com/avatars-IesRuX9vhlBZzVuz-1H6bOA-t500x500.jpg'); + } */ + + #cube3d .front { + transform: rotateY(0deg ) translateZ( calc(var(--cube-size) / 2) ); + -moz-transform: rotateY( 0deg ) translateZ( calc(var(--cube-size) / 2) ); + } + #cube3d .back { + transform: rotateX( 180deg ) translateZ( calc(var(--cube-size) / 2) ); + -moz-transform: rotateX( 180deg ) translateZ( calc(var(--cube-size) / 2) ); + } + #cube3d .right { + transform: rotateY( 90deg ) translateZ( calc(var(--cube-size) / 2) ); + -moz-transform: rotateY( 90deg ) translateZ( calc(var(--cube-size) / 2) ); + } + #cube3d .left { + transform: rotateY( -90deg ) translateZ( calc(var(--cube-size) / 2) ); + -moz-transform: rotateY( -90deg ) translateZ( calc(var(--cube-size) / 2) ); + } + #cube3d .top { + transform: rotateX( 90deg ) translateZ( calc(var(--cube-size) / 2) ); + -moz-transform: rotateX( 90deg ) translateZ( calc(var(--cube-size) / 2) ); + } + #cube3d .bottom { + transform: rotateX( -90deg ) translateZ( calc(var(--cube-size) / 2) ); + -moz-transform: rotateX( -90deg ) translateZ( calc(var(--cube-size) / 2) ); + } \ No newline at end of file diff --git a/src/lib/ZSpacer.svelte b/src/lib/ZSpacer.svelte new file mode 100644 index 0000000..81bc7df --- /dev/null +++ b/src/lib/ZSpacer.svelte @@ -0,0 +1,2 @@ + +
\ No newline at end of file