mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-19 19:23:02 +05:30
(refactor): allin1 core-animation is introduced to handle external animations
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
//---hello textbox on pome page (hero-section) config
|
||||
function animate_hello() {
|
||||
const texts = ["Namaste! 🙏", "Hello! 👋", "Konnichiwa! 😄", "Anyeonghaseyo! 😊", "Hola! 😃", "Bonjour! 😄", "Zdravstvuyte! 🙂", "Marhabaan! 😊", "Olá! 😃", "Salve! 🤠"];
|
||||
const textContainer = document.getElementById("helloContainer");
|
||||
|
||||
let currentIndex = 0;
|
||||
function animateText() {
|
||||
textContainer.textContent = texts[currentIndex];
|
||||
currentIndex = (currentIndex + 1) % texts.length;
|
||||
|
||||
setTimeout(() => {
|
||||
animateText();
|
||||
}, 3000);
|
||||
}
|
||||
animateText();
|
||||
}
|
||||
|
||||
if(document.getElementById("helloContainer")) {
|
||||
animate_hello();
|
||||
}
|
||||
|
||||
//---hoverAnimatedContainer animation config
|
||||
const animate_card_mouseover_effect = e => {
|
||||
const { currentTarget: target } = e;
|
||||
const rect = target.getBoundingClientRect(),
|
||||
x = e.clientX - rect.left,
|
||||
y = e.clientY - rect.top;
|
||||
|
||||
target.style.setProperty("--mouse-x",`${x}px`);
|
||||
target.style.setProperty("--mouse-y",`${y}px`);
|
||||
}
|
||||
|
||||
if(document.querySelectorAll(".hoverAnimatedContainer")){
|
||||
for(const card of document.querySelectorAll(".hoverAnimatedContainer")){
|
||||
card.onmousemove = e => animate_card_mouseover_effect(e);
|
||||
}
|
||||
}
|
||||
@@ -110,21 +110,7 @@ require 'core/query_functions.php';
|
||||
<script type="text/javascript" src="assets/js/preloader-config.js"></script>
|
||||
<script type="text/javascript" src="assets/js/floatingbar-config.js"></script>
|
||||
<script type="text/javascript" src="assets/js/keybinding-config.js"></script>
|
||||
<script type="text/javascript" src="assets/js/core-animation.js"></script>
|
||||
<script type="text/javascript" src="assets/js/contactform-config.js"></script>
|
||||
<script type="text/javascript">
|
||||
const handleOnMouseMove = e => {
|
||||
const { currentTarget: target } = e;
|
||||
const rect = target.getBoundingClientRect(),
|
||||
x = e.clientX - rect.left,
|
||||
y = e.clientY - rect.top;
|
||||
|
||||
target.style.setProperty("--mouse-x",`${x}px`);
|
||||
target.style.setProperty("--mouse-y",`${y}px`);
|
||||
}
|
||||
|
||||
for(const card of document.querySelectorAll(".hoverAnimatedContainer")){
|
||||
card.onmousemove = e => handleOnMouseMove(e);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -221,36 +221,6 @@ require 'core/query_functions.php';
|
||||
<script type="text/javascript" src="assets/js/preloader-config.js"></script>
|
||||
<script type="text/javascript" src="assets/js/floatingbar-config.js"></script>
|
||||
<script type="text/javascript" src="assets/js/keybinding-config.js"></script>
|
||||
<script type="text/javascript">
|
||||
//---hello textbox (hero-section) config
|
||||
const texts = ["Namaste! 🙏", "Hello! 👋", "Konnichiwa! 😄", "Anyeonghaseyo! 😊", "Hola! 😃", "Bonjour! 😄", "Zdravstvuyte! 🙂", "Marhabaan! 😊", "Olá! 😃", "Salve! 🤠"];
|
||||
const textContainer = document.getElementById("helloContainer");
|
||||
|
||||
let currentIndex = 0;
|
||||
function animateText() {
|
||||
textContainer.textContent = texts[currentIndex];
|
||||
currentIndex = (currentIndex + 1) % texts.length;
|
||||
|
||||
setTimeout(() => {
|
||||
animateText();
|
||||
}, 3000);
|
||||
}
|
||||
animateText();
|
||||
|
||||
//---about me card hover animation config
|
||||
const handleOnMouseMove = e => {
|
||||
const { currentTarget: target } = e;
|
||||
const rect = target.getBoundingClientRect(),
|
||||
x = e.clientX - rect.left,
|
||||
y = e.clientY - rect.top;
|
||||
|
||||
target.style.setProperty("--mouse-x",`${x}px`);
|
||||
target.style.setProperty("--mouse-y",`${y}px`);
|
||||
}
|
||||
|
||||
for(const card of document.querySelectorAll(".hoverAnimatedContainer")){
|
||||
card.onmousemove = e => handleOnMouseMove(e);
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript" src="assets/js/core-animation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user