Compare commits

...

No commits in common. "main" and "ZhenConceptOtherRotation" have entirely different histories.

48 changed files with 1819 additions and 2250 deletions

34
.gitignore vendored
View File

@ -1,10 +1,26 @@
.DS_Store
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
temp

1
.npmrc
View File

@ -1 +0,0 @@
engine-strict=true

3
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"recommendations": ["svelte.svelte-vscode"]
}

View File

@ -0,0 +1,47 @@
# Svelte + Vite
This template should help get you started developing with Svelte in Vite.
## Recommended IDE Setup
[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
## Need an official Svelte framework?
Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more.
## Technical considerations
**Why use this over SvelteKit?**
- It brings its own routing solution which might not be preferable for some users.
- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app.
This template contains as little as possible to get started with Vite + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project.
Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been structured similarly to SvelteKit so that it is easy to migrate.
**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?**
Setting `compilerOptions.types` shuts out all other types not explicitly listed in the configuration. Using triple-slash references keeps the default TypeScript setting of accepting type information from the entire workspace, while also adding `svelte` and `vite/client` type information.
**Why include `.vscode/extensions.json`?**
Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to install the recommended extension upon opening the project.
**Why enable `checkJs` in the JS template?**
It is likely that most cases of changing variable types in runtime are likely to be accidental, rather than deliberate. This provides advanced typechecking out of the box. Should you like to take advantage of the dynamically-typed nature of JavaScript, it is trivial to change the configuration.
**Why is HMR not preserving my local component state?**
HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the details [here](https://github.com/sveltejs/svelte-hmr/tree/master/packages/svelte-hmr#preservation-of-local-state).
If you have state that's important to retain within a component, consider creating an external store which would not be replaced by HMR.
```js
// store.js
// An extremely simple external store
import { writable } from 'svelte/store'
export default writable(0)
```

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

26
index.html Normal file
View File

@ -0,0 +1,26 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Svelte + balls</title>
</head>
<body>
<div id="app" style="margin: 0; padding: 0;"></div>
<script type="module" src="/src/main.js"></script>
<noscript>
<style type="text/css">
.pagecontainer {display:none;}
</style>
<div class="noscriptmsg">
You don't have javascript enabled. <br/>
Please visit this website without javascript: <a href="https://scriptless.deprived.dev/">link</a>
</div>
</noscript>
</body>
</html>

View File

@ -1,18 +1,32 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
"compilerOptions": {
"moduleResolution": "bundler",
"target": "ESNext",
"module": "ESNext",
/**
* svelte-preprocess cannot figure out whether you have
* a value or a type, so tell TypeScript to enforce using
* `import type` instead of `import` for Types.
*/
"verbatimModuleSyntax": true,
"isolatedModules": true,
"resolveJsonModule": true,
/**
* To have warnings / errors of the Svelte compiler at the
* correct position, enable source maps by default.
*/
"sourceMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
/**
* Typecheck JS in `.svelte` and `.js` files by default.
* Disable this if you'd like to use dynamic types.
*/
"checkJs": true
},
/**
* Use global.d.ts instead of compilerOptions.types
* to avoid limiting type declarations.
*/
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
}

3193
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,17 @@
{
"name": "deprived-main-website",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"svelte": "^4.2.7",
"svelte-check": "^3.6.0",
"typescript": "^5.0.0",
"vite": "^5.0.3"
},
"type": "module"
"name": "depriveddemowebsite",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.1",
"svelte": "^4.2.8",
"svelte-parallax": "^0.6.0",
"vite": "^5.0.8"
}
}

1
public/vite.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

3
run.bat Normal file
View File

@ -0,0 +1,3 @@
@echo on
call npm install
call npm run dev

10
run.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash
# Enable echoing of commands
set -x
# Install npm dependencies
npm install
# Run the development script
npm run dev

59
src/App.svelte Normal file
View File

@ -0,0 +1,59 @@
<script lang="ts">
import svelteLogo from './assets/svelte.svg'
import StartVideo from './assets/StartVideo.gif'
import ScrollTextComponent from './lib/ScrollTextComponent.svelte'
import { Parallax, ParallaxLayer, StickyLayer } from 'svelte-parallax';
import ZSpacer from './lib/Universal/ZSpacer.svelte';
import Cube3D from './lib/Cube3D.svelte';
import WeAreText from './lib/WeAreText.svelte';
window.onload = function() {
window.scrollTo(0, 100); // Real
//window.scrollTo(0, 3000); // debug
};
let scrollPos: number = 0;
</script>
<svelte:window bind:scrollY={scrollPos} />
<main>
<div class="topnav">
<a class="active" href="#home">Home</a>
<a href="#news">News</a>
<a href="#contact">Contact</a>
<a href="#about">About</a>
</div>
<Parallax sections={10} config={{stiffness: 0.2, damping: 0.3}}>
<ParallaxLayer rate={0} span={3} style="background-color: #242424;" />
<StickyLayer offset={{ top: 0, bottom: 10 }} class="no-interact">
<div>
{scrollPos}
</div>
</StickyLayer>
<StickyLayer class="align-center" offset={{ top: 1, bottom: 6.5 }}>
<div class="horizontal" style="padding: 200px;">
<ZSpacer/>
<Cube3D/>
</div>
</StickyLayer>
<StickyLayer class="align-center no-interact" offset={{ top: 0, bottom: 6.5 }}>
<WeAreText/>
</StickyLayer>
<StickyLayer class="no-interact" offset={{ top: 5.4, bottom: 10 }} style="background-color: #242424;">
<div class="align-center" style="font-size: 100px; padding-top: 200px;">
The deprived devs
</div>
</StickyLayer>
</Parallax>
</main>
<style>
</style>

98
src/app.css Normal file
View File

@ -0,0 +1,98 @@
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
padding: 0;
margin: 0;
}
.typewriter h1 {
overflow: hidden; /* Ensures the content is not revealed until the animation */
border-right: .15em solid orange; /* The typwriter cursor */
white-space: nowrap; /* Keeps the content on a single line */
margin: 0 auto; /* Gives that scrolling effect as the typing happens */
letter-spacing: .15em; /* Adjust as needed */
animation:
typing 3.5s steps(40, end),
blink-caret .75s step-end infinite;
}
/* The typing effect */
@keyframes typing {
from { width: 0 }
to { width: 100% }
}
/* Add a black background color to the top navigation */
.topnav {
background-color: #333;
overflow: hidden;
}
/* Style the links inside the navigation bar */
.topnav a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
/* Change the color of links on hover */
.topnav a:hover {
background-color: #ddd;
color: black;
}
/* Add a color to the active/current link */
.topnav a.active {
background-color: #04AA6D;
color: white;
}
.horizontal{
display: flex;
justify-content: flex-start;
}
.big-text {
font-size: 125px;
}
.no-wrap {
text-wrap: nowrap;
white-space: nowrap;
}
.no-interact {
pointer-events: none;
}
.hide{
visibility: hidden;
}
/* ================================================ */
/* Aligning */
/* ================================================ */
.align-center {
align-content: center;
align-items: center;
justify-content: center;
display: flex;
text-align: center;
vertical-align: middle;
}

13
src/app.d.ts vendored
View File

@ -1,13 +0,0 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}
export {};

View File

@ -1,18 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Change theme for site here -->
<link rel="stylesheet" href="/stylesheets/main-theme.css" />
<link rel="stylesheet" href="/stylesheets/global.css" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

BIN
src/assets/StartVideo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 MiB

1
src/assets/svelte.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="26.6" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 308"><path fill="#FF3E00" d="M239.682 40.707C211.113-.182 154.69-12.301 113.895 13.69L42.247 59.356a82.198 82.198 0 0 0-37.135 55.056a86.566 86.566 0 0 0 8.536 55.576a82.425 82.425 0 0 0-12.296 30.719a87.596 87.596 0 0 0 14.964 66.244c28.574 40.893 84.997 53.007 125.787 27.016l71.648-45.664a82.182 82.182 0 0 0 37.135-55.057a86.601 86.601 0 0 0-8.53-55.577a82.409 82.409 0 0 0 12.29-30.718a87.573 87.573 0 0 0-14.963-66.244"></path><path fill="#FFF" d="M106.889 270.841c-23.102 6.007-47.497-3.036-61.103-22.648a52.685 52.685 0 0 1-9.003-39.85a49.978 49.978 0 0 1 1.713-6.693l1.35-4.115l3.671 2.697a92.447 92.447 0 0 0 28.036 14.007l2.663.808l-.245 2.659a16.067 16.067 0 0 0 2.89 10.656a17.143 17.143 0 0 0 18.397 6.828a15.786 15.786 0 0 0 4.403-1.935l71.67-45.672a14.922 14.922 0 0 0 6.734-9.977a15.923 15.923 0 0 0-2.713-12.011a17.156 17.156 0 0 0-18.404-6.832a15.78 15.78 0 0 0-4.396 1.933l-27.35 17.434a52.298 52.298 0 0 1-14.553 6.391c-23.101 6.007-47.497-3.036-61.101-22.649a52.681 52.681 0 0 1-9.004-39.849a49.428 49.428 0 0 1 22.34-33.114l71.664-45.677a52.218 52.218 0 0 1 14.563-6.398c23.101-6.007 47.497 3.036 61.101 22.648a52.685 52.685 0 0 1 9.004 39.85a50.559 50.559 0 0 1-1.713 6.692l-1.35 4.116l-3.67-2.693a92.373 92.373 0 0 0-28.037-14.013l-2.664-.809l.246-2.658a16.099 16.099 0 0 0-2.89-10.656a17.143 17.143 0 0 0-18.398-6.828a15.786 15.786 0 0 0-4.402 1.935l-71.67 45.674a14.898 14.898 0 0 0-6.73 9.975a15.9 15.9 0 0 0 2.709 12.012a17.156 17.156 0 0 0 18.404 6.832a15.841 15.841 0 0 0 4.402-1.935l27.345-17.427a52.147 52.147 0 0 1 14.552-6.397c23.101-6.006 47.497 3.037 61.102 22.65a52.681 52.681 0 0 1 9.003 39.848a49.453 49.453 0 0 1-22.34 33.12l-71.664 45.673a52.218 52.218 0 0 1-14.563 6.398"></path></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

10
src/lib/Counter.svelte Normal file
View File

@ -0,0 +1,10 @@
<script lang="ts">
let count: number = 0
const increment = () => {
count += 10
}
</script>
<button on:scroll={increment}>
count is {count}
</button>

225
src/lib/Cube3D.svelte Normal file
View File

@ -0,0 +1,225 @@
<script lang="ts">
import planeImg from './images/PlaneGrid.png';
import cubeSideImg from './images/CubeTexture.png';
// Hyperparameters (fine to change)
let startPosAnim: number = 1200; // Starts at scroll value
let endPosAnim: number = 4000; // Ends at scroll value
let parallexOutPadding = 700;
let parallaxOutLength = 400; // How long the exit anim is
// Define, don't touch
let scrollPos: number = 0;
let cubeRotY: number = 0;
let cubeRotX: number = 0;
// Total length of animation
let totalAnimLength: number = endPosAnim - startPosAnim;
// Front side text after fully scrolled
let frontSideText: string[] = ["overlooked", "DEPRIVED"];
function updateUI(){
// Calculates the cube roation
let time = (scrollPos - startPosAnim)/totalAnimLength;
cubeRotY = lerp(0, 360, clamp(time, 0, 1), true);
// Start exit anim after main anim
time = (scrollPos - (endPosAnim + parallexOutPadding))/(parallaxOutLength + parallexOutPadding);
cubeRotX = lerp(0, 15, clamp(time, 0, 1), true);
// if rotated cube 180deg then change text
let frontSide = document.getElementById('front');
if (!!frontSide) // if not null
{
if (scrollPos - startPosAnim < totalAnimLength / 2){
frontSide.innerHTML = frontSide.innerHTML.replace(frontSideText[1], frontSideText[0]);
}
else {
frontSide.innerHTML = frontSide.innerHTML.replace(frontSideText[0], frontSideText[1]);
}
}
// Hide plane3d if plane3d turned pass camera
let plane3d = document.getElementById('plane3D');
if (!!plane3d) // if not null
{
if (cubeRotX <= 10){
plane3d.classList.remove("hide");
}
else{
plane3d.classList.add("hide");
}
}
}
function lerp(from: number, to: number, time: number, clamped: boolean = false) : number {
const lerped: number = from + (to - from) * time;
if (clamped) {
return from < to ? clamp(lerped, from, to) : clamp(lerped, to, from);
}
return lerped;
}
function clamp(value: number, min: number, max: number): number {
return Math.min(Math.max(value, min), max);
}
</script>
<svelte:window bind:scrollY={scrollPos} on:scroll={updateUI}/>
<style>
:root {
--cube-size: 400px;
--cube-color: rgba(125, 125, 125, 1);
}
#planeHolder {
width: 100%;
height: 100%;
position: absolute;
transform-style: preserve-3d;
}
#plane3D {
--plane-size: 2500px;
width: var(--plane-size);
height: var(--plane-size);
transform:
rotateX( -90deg )
translateZ(calc(var(--plane-size) * -0.25))
translateX(calc(var(--plane-size) * -0.45));
-moz-transform:
rotateX( -90deg )
translateZ(calc(var(--plane-size) * -0.25))
translateX(calc(var(--plane-size) * -0.45));
}
.image {
transform: translateX(calc(var(--cube-size)*-0.5));
}
.text{
margin: 0;
}
/* .rotate1{
transform: rotateX(0deg) rotateY(90deg) rotateZ(0deg);
} */
/* demo: https://codepen.io/mrosati84/pen/kWwXLg */
#cube-3d-container {
width: var(--cube-size);
height: var(--cube-size);
position: relative;
perspective: 500px;
-moz-perspective: 1000px;
padding: 25px;
}
#cube3d {
width: 100%;
height: 100%;
position: absolute;
transform-style: preserve-3d;
transition: transform 1s cubic-bezier(0,1.32,0,.92);
}
#cube3d div {
display: block;
border: none;
line-height: var(--cube-size);
text-align: center;
font-size: 65px;
}
.cube-sides {
position: absolute;
width: var(--cube-size);
height: var(--cube-size);
text-decoration: underline;
text-underline-offset: 24px;
}
#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) ) rotateZ(180deg);
-moz-transform: rotateX( 180deg ) translateZ( calc(var(--cube-size) / 2) ) rotateZ(180deg);
}
#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) );
} */
</style>
<div id="cube-3d-container">
<!-- Empty div for origin of plane object -->
<div id="planeHolder" style="transform: rotateX({cubeRotX}deg);">
<img id="plane3D" src={planeImg} alt="3D ground plane"/>
</div>
<div id="cube3d" style="transform: rotateX({cubeRotY + cubeRotX}deg)">
<div id="front" class="cube-sides">
<img src="{cubeSideImg}" class="image" style="width: 100%; position: absolute;" alt="cube side texture"/>
<p class="text" style="position: relative;">
overlooked
</p>
</div>
<div id="back" class="cube-sides">
<img src="{cubeSideImg}" class="image" style="width: 100%; position: absolute;" alt="cube side texture"/>
<p class="text" style="position: relative;">
constrained
</p>
</div>
<div id="right" class="cube-sides">
<img src="{cubeSideImg}" class="image" style="width: 100%; position: absolute;" alt="cube side texture"/>
<p class="text" style="position: relative;">
drained
</p>
</div>
<div id="left" class="cube-sides">
<img src="{cubeSideImg}" class="image" style="width: 100%; position: absolute;" alt="cube side texture"/>
<p class="text" style="position: relative;">
underfunded
</p>
</div>
<!-- <div id="top" class="cube-sides">
<img src="{cubeSideImg}" style="width: 100%;" alt="cube side texture"/>
5
</div>
<div id="bottom" class="cube-sides">
<img src="{cubeSideImg}" style="width: 100%;" alt="cube side texture"/>
6
</div> -->
</div>
</div>

View File

@ -0,0 +1,88 @@
<script lang="ts">
let chunkSize: number = 750;
let chunks: number = 3;
export let allChunkHeight: number = chunkSize * chunks;
let scrollPosition: number = 0;
function handleScroll() {
const divElement = document.getElementById('scrollContainer');
scrollPosition = divElement.scrollTop;
let currectChunk: number = scrollPosition / chunkSize;
let chunkProgress: number = scrollPosition % chunkSize;
let typingIndex: number = (Math.ceil(currectChunk));
if (chunkSize * 0.2 < chunkProgress
&& chunkProgress < chunkSize * 0.65){
divElement.style.color = "pink";
document.getElementById('TypingIndex_' + typingIndex).classList.add('typewriter');
}
else{
divElement.style.color = "lightblue";
document.getElementById('TypingIndex_' + typingIndex).classList.remove('typewriter');
}
console.log(scrollPosition + ">" + (allChunkHeight - chunkSize - 150));
if (scrollPosition > allChunkHeight - chunkSize - 150){
document.getElementById('scrollContainer').classList.add('no-interact');
}
else{
document.getElementById('scrollContainer').classList.remove('no-interact');
}
}
</script>
<style>
.container {
width: 100%;
height: 100vh;
overflow-y: scroll;
z-index: 0;
}
.scrollText {
width: 100%;
background-color: darkslateblue;
padding: 0;
margin: 0;
z-index: 0;
}
.center-screen {
display: flex;
align-items: center;
justify-content: center;
width: 50px;
height: 100vh;
position:absolute;
left:0;
right:0;
top: 0;
bottom: 0;
margin:auto;
z-index: 0;
}
</style>
<div style="height: 100vh;">
<div class="center-screen big-text no-wrap no-interact">
We are
</div>
<div class="container" id="scrollContainer" on:scroll={handleScroll}>
<div class="scrollText" style="height: {allChunkHeight}px;">
{#each {length: chunks} as _, i}
<div id="ChunkIndex_{i}" class="chunk" style="height: {chunkSize}px; z-index: 0;">
{scrollPosition}
<div id="TypingIndex_{i}">
<h1>{i} The cat and the hat.</h1>
</div>
</div>
{/each}
</div>
</div>
</div>

View File

@ -0,0 +1,6 @@
<!-- Short hand for spacing between components-->
<div style="flex-grow: 1; {style}"/>
<script>
export let style = "";
</script>

72
src/lib/WeAreText.svelte Normal file
View File

@ -0,0 +1,72 @@
<script lang="ts">
import ZSpacer from "./Universal/ZSpacer.svelte";
// Hyperparams
let startExit = 4700;
let exitLength = 2000;
let exitScreenLength = 700;
let textMaxRotation = 30;
let parallaxOffset = 1.0125;
// Define, don't touch
let scrollPos: number = 0;
let extraPosY = 0;
let rotation = 0;
// Define: Parallax text
let extraPosY2 = 0;
let rotation2 = 0;
$:{
let time = (scrollPos - startExit) / exitLength;
extraPosY = lerp(0, -exitScreenLength, time, true);
rotation = lerp(0, textMaxRotation, time, true);
extraPosY2 = lerp(0, -exitScreenLength, time * parallaxOffset, true);
rotation2 = lerp(0, textMaxRotation, time, true);
}
function lerp(from: number, to: number, time: number, clamped: boolean = false) : number {
const lerped: number = from + (to - from) * time;
if (clamped) {
return from < to ? clamp(lerped, from, to) : clamp(lerped, to, from);
}
return lerped;
}
function clamp(value: number, min: number, max: number): number {
return Math.min(Math.max(value, min), max);
}
</script>
<svelte:window bind:scrollY={scrollPos} />
<div class="horizontal">
<div id="WeAreHolder" class="align-center" style="margin-right: 35vw; position: relative;">
<div class="no-wrap no-interact big-text align-center WeAreText"
style="color: #c9c9c9; transform: translate(0, {extraPosY}px) rotateX({rotation}deg); position: absolute;">
We are
</div>
<div class="no-wrap no-interact big-text align-center WeAreText"
style="color: #ffffff; transform: translate(0, {extraPosY2}px) rotateX({rotation2}deg); position: absolute;">
We are
</div>
</div>
<ZSpacer style="width: 10vw;"/>
</div>
<style>
#WeAreHolder {
transition: transform 1s cubic-bezier(0,1.32,0,.92);
transform-style: preserve-3d;
perspective: 1000px;
-moz-perspective: 1000px;
}
.WeAreText {
padding: -10px 10px 0px 10px;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 KiB

View File

@ -1 +0,0 @@
// place files you want to import through the `$lib` alias in this folder.

8
src/main.js Normal file
View File

@ -0,0 +1,8 @@
import './app.css'
import App from './App.svelte'
const app = new App({
target: document.getElementById('app'),
})
export default app

View File

@ -1 +0,0 @@
export const prerender = true;

View File

@ -1,17 +0,0 @@
<div class="main-title">
<h1>The Deprived Devs</h1>
</div>
<style>
.main-title {
font-family: "CozetteVector";
margin: 0 auto;
width: 80%;
text-align: center;
}
.main-title > h1 {
font-size: 4.5vw; /* Change if title changes */
}
</style>

View File

@ -1 +0,0 @@
<p>This is an informative about page :) </p>

View File

@ -1 +0,0 @@

2
src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
/// <reference types="svelte" />
/// <reference types="vite/client" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

View File

@ -1,12 +0,0 @@
/* --- FONTS --- */
@font-face {
font-family: "CozetteVector";
src:
local("CozetteVector"),
url("/fonts/CozetteVector.ttf") format("truetype");
}
body {
color: var(--text);
background-color: var(--background);
}

View File

@ -1,7 +0,0 @@
:root {
--text: #ece4ee;
--background: #120c13;
--primary: #ff8552;
--secondary: #6c6b44;
--accent: #7da16a;
}

View File

@ -1,17 +1,7 @@
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
/** @type {import('@sveltejs/kit').Config} */
export default {
kit: {
prerender: {
handleHttpError: 'fail'
},
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: undefined,
precompress: false,
strict: true
})
}
};
// Consult https://svelte.dev/docs#compile-time-svelte-preprocess
// for more information about preprocessors
preprocess: vitePreprocess(),
}

View File

@ -1,6 +1,7 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [sveltekit()]
});
plugins: [svelte()],
})