Skip to content

Commit

Permalink
Beginning work on side scrolling emoticons
Browse files Browse the repository at this point in the history
  • Loading branch information
philwing100 committed Aug 15, 2024
1 parent 9a79091 commit 14d2c95
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 14 deletions.
68 changes: 55 additions & 13 deletions src/components/AboutMeComponents/FullPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,31 @@

<template>
<div class="fullpage-container" @wheel="handleScroll">
<div
class="section"
v-for="(section, index) in sections"
:key="section.id"
:ref="`section-${index}`"
:class="`section-${index}`"
>
<div class="section" v-for="(section, index) in sections" :key="section.id" :ref="`section-${index}`"
:class="`section-${index}`">
<div class="sidescroll-container">
<transition name="fade" @before-leave="beforeLeave">
<SideScrolling v-if="index === 0 && activeSection === 0" />
</transition>
</div>
<h2 class="content">{{ section.title }}</h2>
<p class="content">{{ section.content }}</p>
</div>
<div class="scroll-indicator" v-if="showIndicator">
<button v-for="(section, index) in sections" :key="index" @click="scrollToSection(index)">
<div class="button-container" v-for="(section, index) in sections" :key="index" @click="scrollToSection(index)">
<div class="box"></div>
{{ section.title }}
</button>
</div>
</div>
</div>
</template>

<script>
import AshEffect from './AshEffect.vue';
import SideScrolling from './SideScrolling.vue';
export default {
components: {
SideScrolling,
},
props: {
sections: {
Expand All @@ -40,6 +42,7 @@ export default {
return {
activeSection: 0,
isScrolling: false,
isLeaving: false
};
},
methods: {
Expand All @@ -58,7 +61,7 @@ export default {
if (this.isScrolling) return;
this.isScrolling = true;
const direction = event.deltaY > 0 ? 1 : -1;
this.activeSection += direction;
Expand All @@ -68,7 +71,7 @@ export default {
this.activeSection = this.sections.length - 1;
}
setTimeout(() => {
this.scrollToSection(this.activeSection);
this.scrollToSection(this.activeSection);
}, 100);
},
Expand All @@ -84,6 +87,13 @@ export default {
section.style.backgroundImage = this.computeGradient(index, this.sections.length);
}
});
},
beforeLeave(el) {
// Add a delay before the component is removed
setTimeout(() => {
// This will trigger the actual removal
el.style.opacity = 0;
}, 500); // Delay in milliseconds (500ms in this example)
}
},
mounted() {
Expand All @@ -96,6 +106,19 @@ export default {
</script>

<style scoped>
.box{
border: solid black 5px;
padding: 5px;
background-color:white;
}
.fade-enter-active, .fade-leave-active {
transition: opacity 0.5s ease;
}
.fade-enter, .fade-leave-to {
opacity: 0;
}
.fullpage-container {
overflow: hidden;
height: 100vh;
Expand All @@ -107,6 +130,8 @@ export default {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
flex-direction:column;
}
.section:nth-child(1) .content {
Expand All @@ -122,11 +147,28 @@ export default {
right: 10px;
top: 50%;
transform: translateY(-50%);
display: flex;
display:inline-block;
flex-direction: column;
margin: 0px;
}
.scroll-indicator button {
margin-bottom: 10px;
}
.button-container{
display: flex;
flex-direction:row;
background:red;
}
.sidescroll-container {
background-color:green;
color:white;
align-items: center;
justify-content: center;
display:flex;
flex-wrap: nowrap;
width: 80%;
}
</style>
62 changes: 62 additions & 0 deletions src/components/AboutMeComponents/SideScrolling.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<template>
<div id="scroll-container">

<div id="scroll-text">This is scrolling text.</div>
</div>


</template>

<script>
export default {
}
</script>

<style>
#scroll-container {
border: 3px solid black;
border-radius: 5px;
overflow: hidden;
flex-direction:column;
width: 100%;
}
#scroll-text {
/* animation properties */
-moz-transform: translateX(100%);
-webkit-transform: translateX(100%);
transform: translateX(100%);
-moz-animation: my-animation 15s linear infinite;
-webkit-animation: my-animation 15s linear infinite;
animation: my-animation 15s linear infinite;
}
/* for Firefox */
@-moz-keyframes my-animation {
from { -moz-transform: translateX(100%); }
to { -moz-transform: translateX(-100%); }
}
/* for Chrome */
@-webkit-keyframes my-animation {
from { -webkit-transform: translateX(100%); }
to { -webkit-transform: translateX(-100%); }
}
@keyframes my-animation {
from {
-moz-transform: translateX(100%);
-webkit-transform: translateX(100%);
transform: translateX(100%);
}
to {
-moz-transform: translateX(-100%);
-webkit-transform: translateX(-100%);
transform: translateX(-100%);
}
}
</style>
2 changes: 1 addition & 1 deletion src/views/AboutMe.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template class="page">
<AshEffect />
<div>
<AshEffect />
<FullPage :sections="sections" :showIndicator="true" />
</div>
</template>
Expand Down

0 comments on commit 14d2c95

Please sign in to comment.