Updated <GridDistortion /> background

This commit is contained in:
Utkarsh-Singhal-26
2025-07-17 09:39:34 +05:30
parent fd2dc60700
commit 8b6b2d6b8b

View File

@@ -11,42 +11,15 @@
:relaxation="0.9" :relaxation="0.9"
className="grid-distortion" className="grid-distortion"
/> />
<p class="absolute font-black text-8xl text-center select-none mix-blend-difference">Distortion.</p> <p class="absolute font-black text-8xl text-center pointer-events-none select-none mix-blend-difference">
Distortion.
<button </p>
class="right-[2em] bottom-[2em] absolute bg-[#060010] hover:bg-[#111] active:bg-[#111] px-6 rounded-[15px] h-16 text-sm"
@click="!isFullScreen ? enterFullScreen() : exitFullScreen()"
>
{{ !isFullScreen ? 'Go Fullscreen!' : 'Exit Fullscreen' }}
</button>
</div> </div>
<Customize> <Customize>
<PreviewSlider <PreviewSlider title="Grid Size" :min="6" :max="200" :step="1" v-model="grid" />
title="Grid Size"
:min="6"
:max="200"
:step="1"
v-model="grid"
@onChange="
(val: number) => {
grid = val;
}
"
/>
<PreviewSlider <PreviewSlider title="Mouse Size" :min="0.1" :max="0.5" :step="0.01" v-model="mouse" />
title="Mouse Size"
:min="0.1"
:max="0.5"
:step="0.01"
v-model="mouse"
@onChange="
(val: number) => {
mouse = val;
}
"
/>
</Customize> </Customize>
<PropTable :data="propData" /> <PropTable :data="propData" />
@@ -80,30 +53,17 @@ const { rerenderKey: key, forceRerender } = useForceRerender();
const grid = ref(10); const grid = ref(10);
const mouse = ref(0.25); const mouse = ref(0.25);
const isFullScreen = ref(false);
const containerRef = ref<HTMLDivElement | null>(null); const containerRef = ref<HTMLDivElement | null>(null);
watch( watch(
() => [grid, mouse, isFullScreen], () => [grid, mouse],
() => { () => {
forceRerender(); forceRerender();
}, },
{ deep: true } { deep: true }
); );
const enterFullScreen = () => {
if (containerRef.value) {
containerRef.value.requestFullscreen().then(() => (isFullScreen.value = true));
}
};
const exitFullScreen = () => {
if (document.fullscreenElement) {
document.exitFullscreen().then(() => (isFullScreen.value = false));
}
};
const propData = [ const propData = [
{ {
name: 'imgageSrc', name: 'imgageSrc',
@@ -143,3 +103,9 @@ const propData = [
} }
]; ];
</script> </script>
<style scoped>
.demo-container {
padding: 0;
}
</style>