Initial commit: Vue 3 coming soon page for Ariege.io with Vue Bits Galaxy background
- Set up Vue 3 project with Vite - Added OGL-powered galaxy background component from Vue Bits - Implemented coming soon page with responsive design - Added proper attribution for MIT + Commons Clause licensed component - Configured project dependencies and build setup 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
commit
22e4c1bdc1
8 changed files with 1742 additions and 0 deletions
101
.gitignore
vendored
Normal file
101
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
node_modules
|
||||||
|
.pnpm-lock.yaml
|
||||||
|
|
||||||
|
# Build outputs
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
|
.env
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
# OS generated files
|
||||||
|
Thumbs.db
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
.parcel-cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
public
|
||||||
|
|
||||||
|
# Storybook build outputs
|
||||||
|
.out
|
||||||
|
.storybook-out
|
||||||
|
|
||||||
|
# Temporary folders
|
||||||
|
tmp/
|
||||||
|
temp/
|
||||||
22
index.html
Normal file
22
index.html
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
<!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>Ariege.io - Coming Soon</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||||
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||||
|
sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1139
package-lock.json
generated
Normal file
1139
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
19
package.json
Normal file
19
package.json
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"name": "ariege-coming-soon",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Coming Soon page for Ariege.io",
|
||||||
|
"main": "index.html",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ogl": "^1.0.11",
|
||||||
|
"vue": "^3.4.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vitejs/plugin-vue": "^5.0.0",
|
||||||
|
"vite": "^5.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
129
src/App.vue
Normal file
129
src/App.vue
Normal file
|
|
@ -0,0 +1,129 @@
|
||||||
|
<template>
|
||||||
|
<div class="app">
|
||||||
|
<Galaxy
|
||||||
|
class="galaxy-background"
|
||||||
|
:density="1.5"
|
||||||
|
:glow-intensity="0.5"
|
||||||
|
:saturation="0.8"
|
||||||
|
:hue-shift="240"
|
||||||
|
/>
|
||||||
|
<div class="content">
|
||||||
|
<h1>Coming Soon</h1>
|
||||||
|
<p>Ariege.io</p>
|
||||||
|
</div>
|
||||||
|
<footer class="footer">
|
||||||
|
<p>Galaxy background by <a href="https://vue-bits.dev" target="_blank" rel="noopener">Vue Bits</a></p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import Galaxy from './Galaxy.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app {
|
||||||
|
position: relative;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.galaxy-background {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content h1 {
|
||||||
|
font-size: 4rem;
|
||||||
|
font-weight: 300;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
background: linear-gradient(45deg, #fff, #a8edea);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
background-clip: text;
|
||||||
|
animation: glow 2s ease-in-out infinite alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content p {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 200;
|
||||||
|
opacity: 0.8;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes glow {
|
||||||
|
from {
|
||||||
|
text-shadow: 0 0 20px rgba(168, 237, 234, 0.3);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
text-shadow: 0 0 30px rgba(168, 237, 234, 0.6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
left: 20px;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer p {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
opacity: 0.6;
|
||||||
|
color: white;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer a {
|
||||||
|
color: rgba(168, 237, 234, 0.8);
|
||||||
|
text-decoration: none;
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer a:hover {
|
||||||
|
opacity: 1;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.content h1 {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content p {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
bottom: 10px;
|
||||||
|
left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer p {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
322
src/Galaxy.vue
Normal file
322
src/Galaxy.vue
Normal file
|
|
@ -0,0 +1,322 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
/**
|
||||||
|
* Galaxy Background Component
|
||||||
|
* Adapted from Vue Bits (https://vue-bits.dev)
|
||||||
|
* Copyright (c) Vue Bits
|
||||||
|
* Licensed under MIT + Commons Clause License
|
||||||
|
*
|
||||||
|
* Original component: https://vue-bits.dev/backgrounds/galaxy
|
||||||
|
*/
|
||||||
|
import { Renderer, Program, Mesh, Color, Triangle } from 'ogl';
|
||||||
|
import { onMounted, onUnmounted, ref, useTemplateRef, watch } from 'vue';
|
||||||
|
|
||||||
|
const vertexShader = `
|
||||||
|
attribute vec2 uv;
|
||||||
|
attribute vec2 position;
|
||||||
|
|
||||||
|
varying vec2 vUv;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vUv = uv;
|
||||||
|
gl_Position = vec4(position, 0, 1);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const fragmentShader = `
|
||||||
|
precision highp float;
|
||||||
|
|
||||||
|
uniform float uTime;
|
||||||
|
uniform vec3 uResolution;
|
||||||
|
uniform vec2 uFocal;
|
||||||
|
uniform vec2 uRotation;
|
||||||
|
uniform float uStarSpeed;
|
||||||
|
uniform float uDensity;
|
||||||
|
uniform float uHueShift;
|
||||||
|
uniform float uSpeed;
|
||||||
|
uniform vec2 uMouse;
|
||||||
|
uniform float uGlowIntensity;
|
||||||
|
uniform float uSaturation;
|
||||||
|
uniform bool uMouseRepulsion;
|
||||||
|
uniform float uTwinkleIntensity;
|
||||||
|
uniform float uRotationSpeed;
|
||||||
|
uniform float uRepulsionStrength;
|
||||||
|
uniform float uMouseActiveFactor;
|
||||||
|
uniform float uAutoCenterRepulsion;
|
||||||
|
uniform bool uTransparent;
|
||||||
|
|
||||||
|
varying vec2 vUv;
|
||||||
|
|
||||||
|
#define NUM_LAYER 4.0
|
||||||
|
#define STAR_COLOR_CUTOFF 0.2
|
||||||
|
#define MAT45 mat2(0.7071, -0.7071, 0.7071, 0.7071)
|
||||||
|
#define PERIOD 3.0
|
||||||
|
|
||||||
|
float Hash21(vec2 p) {
|
||||||
|
p = fract(p * vec2(123.34, 456.21));
|
||||||
|
p += dot(p, p + 45.32);
|
||||||
|
return fract(p.x * p.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
float tri(float x) {
|
||||||
|
return abs(fract(x) * 2.0 - 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
float tris(float x) {
|
||||||
|
float t = fract(x);
|
||||||
|
return 1.0 - smoothstep(0.0, 1.0, abs(2.0 * t - 1.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
float trisn(float x) {
|
||||||
|
float t = fract(x);
|
||||||
|
return 2.0 * (1.0 - smoothstep(0.0, 1.0, abs(2.0 * t - 1.0))) - 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 hsv2rgb(vec3 c) {
|
||||||
|
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||||
|
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||||
|
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
float Star(vec2 uv, float flare) {
|
||||||
|
float d = length(uv);
|
||||||
|
float m = (0.05 * uGlowIntensity) / d;
|
||||||
|
float rays = smoothstep(0.0, 1.0, 1.0 - abs(uv.x * uv.y * 1000.0));
|
||||||
|
m += rays * flare * uGlowIntensity;
|
||||||
|
uv *= MAT45;
|
||||||
|
rays = smoothstep(0.0, 1.0, 1.0 - abs(uv.x * uv.y * 1000.0));
|
||||||
|
m += rays * 0.3 * flare * uGlowIntensity;
|
||||||
|
m *= smoothstep(1.0, 0.2, d);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 StarLayer(vec2 uv) {
|
||||||
|
vec3 col = vec3(0.0);
|
||||||
|
|
||||||
|
vec2 gv = fract(uv) - 0.5;
|
||||||
|
vec2 id = floor(uv);
|
||||||
|
|
||||||
|
for (int y = -1; y <= 1; y++) {
|
||||||
|
for (int x = -1; x <= 1; x++) {
|
||||||
|
vec2 offset = vec2(float(x), float(y));
|
||||||
|
vec2 si = id + vec2(float(x), float(y));
|
||||||
|
float seed = Hash21(si);
|
||||||
|
float size = fract(seed * 345.32);
|
||||||
|
float glossLocal = tri(uStarSpeed / (PERIOD * seed + 1.0));
|
||||||
|
float flareSize = smoothstep(0.9, 1.0, size) * glossLocal;
|
||||||
|
|
||||||
|
float red = smoothstep(STAR_COLOR_CUTOFF, 1.0, Hash21(si + 1.0)) + STAR_COLOR_CUTOFF;
|
||||||
|
float blu = smoothstep(STAR_COLOR_CUTOFF, 1.0, Hash21(si + 3.0)) + STAR_COLOR_CUTOFF;
|
||||||
|
float grn = min(red, blu) * seed;
|
||||||
|
vec3 base = vec3(red, grn, blu);
|
||||||
|
|
||||||
|
float hue = atan(base.g - base.r, base.b - base.r) / (2.0 * 3.14159) + 0.5;
|
||||||
|
hue = fract(hue + uHueShift / 360.0);
|
||||||
|
float sat = length(base - vec3(dot(base, vec3(0.299, 0.587, 0.114)))) * uSaturation;
|
||||||
|
float val = max(max(base.r, base.g), base.b);
|
||||||
|
base = hsv2rgb(vec3(hue, sat, val));
|
||||||
|
|
||||||
|
vec2 pad = vec2(tris(seed * 34.0 + uTime * uSpeed / 10.0), tris(seed * 38.0 + uTime * uSpeed / 30.0)) - 0.5;
|
||||||
|
|
||||||
|
float star = Star(gv - offset - pad, flareSize);
|
||||||
|
vec3 color = base;
|
||||||
|
|
||||||
|
float twinkle = trisn(uTime * uSpeed + seed * 6.2831) * 0.5 + 1.0;
|
||||||
|
twinkle = mix(1.0, twinkle, uTwinkleIntensity);
|
||||||
|
star *= twinkle;
|
||||||
|
|
||||||
|
col += star * size * color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec2 focalPx = uFocal * uResolution.xy;
|
||||||
|
vec2 uv = (vUv * uResolution.xy - focalPx) / uResolution.y;
|
||||||
|
|
||||||
|
vec2 mouseNorm = uMouse - vec2(0.5);
|
||||||
|
|
||||||
|
if (uAutoCenterRepulsion > 0.0) {
|
||||||
|
vec2 centerUV = vec2(0.0, 0.0); // Center in UV space
|
||||||
|
float centerDist = length(uv - centerUV);
|
||||||
|
vec2 repulsion = normalize(uv - centerUV) * (uAutoCenterRepulsion / (centerDist + 0.1));
|
||||||
|
uv += repulsion * 0.05;
|
||||||
|
} else if (uMouseRepulsion) {
|
||||||
|
vec2 mousePosUV = (uMouse * uResolution.xy - focalPx) / uResolution.y;
|
||||||
|
float mouseDist = length(uv - mousePosUV);
|
||||||
|
vec2 repulsion = normalize(uv - mousePosUV) * (uRepulsionStrength / (mouseDist + 0.1));
|
||||||
|
uv += repulsion * 0.05 * uMouseActiveFactor;
|
||||||
|
} else {
|
||||||
|
vec2 mouseOffset = mouseNorm * 0.1 * uMouseActiveFactor;
|
||||||
|
uv += mouseOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
float autoRotAngle = uTime * uRotationSpeed;
|
||||||
|
mat2 autoRot = mat2(cos(autoRotAngle), -sin(autoRotAngle), sin(autoRotAngle), cos(autoRotAngle));
|
||||||
|
uv = autoRot * uv;
|
||||||
|
|
||||||
|
uv = mat2(uRotation.x, -uRotation.y, uRotation.y, uRotation.x) * uv;
|
||||||
|
|
||||||
|
vec3 col = vec3(0.0);
|
||||||
|
|
||||||
|
for (float i = 0.0; i < 1.0; i += 1.0 / NUM_LAYER) {
|
||||||
|
float depth = fract(i + uStarSpeed * uSpeed);
|
||||||
|
float scale = mix(20.0 * uDensity, 0.5 * uDensity, depth);
|
||||||
|
float fade = depth * smoothstep(1.0, 0.9, depth);
|
||||||
|
col += StarLayer(uv * scale + i * 453.32) * fade;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uTransparent) {
|
||||||
|
float alpha = length(col);
|
||||||
|
alpha = smoothstep(0.0, 0.3, alpha); // Enhance contrast
|
||||||
|
alpha = min(alpha, 1.0); // Clamp to maximum 1.0
|
||||||
|
gl_FragColor = vec4(col, alpha);
|
||||||
|
} else {
|
||||||
|
gl_FragColor = vec4(col, 1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
interface GalaxyProps {
|
||||||
|
focal?: [number, number];
|
||||||
|
rotation?: [number, number];
|
||||||
|
starSpeed?: number;
|
||||||
|
density?: number;
|
||||||
|
hueShift?: number;
|
||||||
|
disableAnimation?: boolean;
|
||||||
|
speed?: number;
|
||||||
|
glowIntensity?: number;
|
||||||
|
saturation?: number;
|
||||||
|
twinkleIntensity?: number;
|
||||||
|
rotationSpeed?: number;
|
||||||
|
transparent?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<GalaxyProps>(), {
|
||||||
|
focal: () => [0.5, 0.5],
|
||||||
|
rotation: () => [1.0, 0.0],
|
||||||
|
starSpeed: 0.5,
|
||||||
|
density: 1,
|
||||||
|
hueShift: 140,
|
||||||
|
disableAnimation: false,
|
||||||
|
speed: 1.0,
|
||||||
|
glowIntensity: 0.3,
|
||||||
|
saturation: 0.0,
|
||||||
|
twinkleIntensity: 0.3,
|
||||||
|
rotationSpeed: 0.1,
|
||||||
|
transparent: false
|
||||||
|
});
|
||||||
|
|
||||||
|
const ctnDom = useTemplateRef('ctnDom');
|
||||||
|
|
||||||
|
let cleanup: (() => void) | null = null;
|
||||||
|
|
||||||
|
const setup = () => {
|
||||||
|
if (!ctnDom.value) return;
|
||||||
|
const ctn = ctnDom.value;
|
||||||
|
const renderer = new Renderer({
|
||||||
|
alpha: props.transparent,
|
||||||
|
premultipliedAlpha: false
|
||||||
|
});
|
||||||
|
const gl = renderer.gl;
|
||||||
|
|
||||||
|
if (props.transparent) {
|
||||||
|
gl.enable(gl.BLEND);
|
||||||
|
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
||||||
|
gl.clearColor(0, 0, 0, 0);
|
||||||
|
} else {
|
||||||
|
gl.clearColor(0, 0, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
let program: Program;
|
||||||
|
|
||||||
|
function resize() {
|
||||||
|
const scale = 1;
|
||||||
|
renderer.setSize(ctn.offsetWidth * scale, ctn.offsetHeight * scale);
|
||||||
|
if (program) {
|
||||||
|
program.uniforms.uResolution.value = new Color(
|
||||||
|
gl.canvas.width,
|
||||||
|
gl.canvas.height,
|
||||||
|
gl.canvas.width / gl.canvas.height
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.addEventListener('resize', resize, false);
|
||||||
|
resize();
|
||||||
|
|
||||||
|
const geometry = new Triangle(gl);
|
||||||
|
program = new Program(gl, {
|
||||||
|
vertex: vertexShader,
|
||||||
|
fragment: fragmentShader,
|
||||||
|
uniforms: {
|
||||||
|
uTime: { value: 0 },
|
||||||
|
uResolution: {
|
||||||
|
value: new Color(gl.canvas.width, gl.canvas.height, gl.canvas.width / gl.canvas.height)
|
||||||
|
},
|
||||||
|
uFocal: { value: new Float32Array(props.focal) },
|
||||||
|
uRotation: { value: new Float32Array(props.rotation) },
|
||||||
|
uStarSpeed: { value: props.starSpeed },
|
||||||
|
uDensity: { value: props.density },
|
||||||
|
uHueShift: { value: props.hueShift },
|
||||||
|
uSpeed: { value: props.speed },
|
||||||
|
uMouse: {
|
||||||
|
value: new Float32Array([0.5, 0.5])
|
||||||
|
},
|
||||||
|
uGlowIntensity: { value: props.glowIntensity },
|
||||||
|
uSaturation: { value: props.saturation },
|
||||||
|
uMouseRepulsion: { value: false },
|
||||||
|
uTwinkleIntensity: { value: props.twinkleIntensity },
|
||||||
|
uRotationSpeed: { value: props.rotationSpeed },
|
||||||
|
uRepulsionStrength: { value: 0 },
|
||||||
|
uMouseActiveFactor: { value: 0.0 },
|
||||||
|
uAutoCenterRepulsion: { value: 0 },
|
||||||
|
uTransparent: { value: props.transparent }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const mesh = new Mesh(gl, { geometry, program });
|
||||||
|
let animateId: number;
|
||||||
|
|
||||||
|
function update(t: number) {
|
||||||
|
animateId = requestAnimationFrame(update);
|
||||||
|
if (!props.disableAnimation) {
|
||||||
|
program.uniforms.uTime.value = t * 0.001;
|
||||||
|
program.uniforms.uStarSpeed.value = (t * 0.001 * props.starSpeed) / 10.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderer.render({ scene: mesh });
|
||||||
|
}
|
||||||
|
animateId = requestAnimationFrame(update);
|
||||||
|
ctn.appendChild(gl.canvas);
|
||||||
|
|
||||||
|
cleanup = () => {
|
||||||
|
cancelAnimationFrame(animateId);
|
||||||
|
window.removeEventListener('resize', resize);
|
||||||
|
ctn.removeChild(gl.canvas);
|
||||||
|
gl.getExtension('WEBGL_lose_context')?.loseContext();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
cleanup?.();
|
||||||
|
setup();
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
cleanup?.();
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props,
|
||||||
|
() => {
|
||||||
|
cleanup?.();
|
||||||
|
setup();
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div ref="ctnDom" class="relative w-full h-full" v-bind="$attrs" />
|
||||||
|
</template>
|
||||||
4
src/main.js
Normal file
4
src/main.js
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
import { createApp } from 'vue'
|
||||||
|
import App from './App.vue'
|
||||||
|
|
||||||
|
createApp(App).mount('#app')
|
||||||
6
vite.config.js
Normal file
6
vite.config.js
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [vue()],
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue