Cleanup to near minimum

This commit is contained in:
BOTAlex 2024-01-06 05:21:32 +01:00
parent 996c5e71b5
commit 6831542447
10 changed files with 8 additions and 533 deletions

View file

@ -1,51 +1,22 @@
<script lang="ts">
import svelteLogo from './assets/svelte.svg'
import StartVideo from './assets/StartVideo.gif'
import ScrollTextComponent from './lib/ScrollTextComponent.svelte'
import WeAreText from './lib/WeAreText.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';
import Cube3DCosmetic from './lib/Cube3DCosmetic.svelte';
import { onMount } from "svelte";
window.onload = function() {
window.scrollTo(0, 100); // Real
//window.scrollTo(0, 3000); // debug
};
function randomInt(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min)
window.scrollTo(0, 100);
}
function progressToSection(prog: number): number{
return sections * prog
}
// Fields
let scrollPos: number = 0;
let parallaxProgress: number = 0;
let cosCubesPositions: number[] = [];
// Auto assigned fields (Will change after load)
let scrollPos: number = -1;
let parallaxProgress: number = -1;
const handleProgress = (progress) => {
parallaxProgress = progress;
//console.log(progress);
};
// Hyperparams
let sections: number = 10;
let cosmeticCubesSpawnRange: number[] = [0.0049253257070225615, 0.4404724075839424]; // Range relative to parallax progress
let numCosCubes: number = 10;
//Spawns the cosCubes
for (let i = 0; i < numCosCubes; i++) {
cosCubesPositions.push(randomInt(progressToSection(cosmeticCubesSpawnRange[0]),(progressToSection(cosmeticCubesSpawnRange[1]))));
}
function debugClick(){
console.log(progressToSection(cosmeticCubesSpawnRange[0]));
console.log(progressToSection(cosmeticCubesSpawnRange[1]));
}
</script>
@ -61,10 +32,10 @@
<Parallax
onProgress={handleProgress}
bind:sections
sections={10}
config={{stiffness: 0.2, damping: 0.3}}
>
<ParallaxLayer rate={0} span={3} style="background-color: #242424;" />
<ParallaxLayer rate={0} span={3} style="background-color: grey;" />
<StickyLayer offset={{ top: 0, bottom: 10 }}>
<div>
@ -73,13 +44,6 @@
<button on:click={debugClick}>Debug button</button>
</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>
@ -89,10 +53,6 @@
The deprived devs
</div>
</StickyLayer>
{#each cosCubesPositions as cosCubePos}
<Cube3DCosmetic position={cosCubePos}/>
{/each}
</Parallax>
</main>