/* CSS */
.flying-right {
display: flex;
justify-content: center;
position: relative;
opacity: 0;
transform: translate(100px, -50px) rotate(15deg);
width: 100%;
will-change: transform, opacity;
}
.flying-right.with-transition {
transition: all 0.8s ease-out;
}
.flying-right.active {
opacity: 1;
transform: translate(0, 0) rotate(0deg);
}
Flying Word Left Animation
/* CSS */
.flying-left {
display: flex;
justify-content: center;
position: relative;
opacity: 0;
transform: translate(-100px, -50px) rotate(-15deg);
width: 100%;
will-change: transform, opacity;
}
.flying-left.with-transition {
transition: all 0.8s ease-out;
}
.flying-left.active {
opacity: 1;
transform: translate(0, 0) rotate(0deg);
}
/* CSS */
.flying-top {
display: flex;
justify-content: center;
position: relative;
opacity: 0;
transform: translateY(-100px);
width: 100%;
will-change: transform, opacity;
}
.flying-top.with-transition {
transition: all 0.8s ease-out;
}
.flying-top.active {
opacity: 1;
transform: translateY(0);
}
/* JavaScript */
function initializeFlyingTop(elementId, text) {
const element = document.getElementById(elementId);
element.textContent = text;
element.classList.add('flying-top');
// Trigger the animation after a small delay
setTimeout(() => {
element.classList.add('active');
}, 100);
}
/* CSS */
.flying-bottom {
display: flex;
justify-content: center;
position: relative;
opacity: 0;
transform: translateY(100px);
width: 100%;
will-change: transform, opacity;
}
.flying-bottom.with-transition {
transition: all 0.8s ease-out;
}
.flying-bottom.active {
opacity: 1;
transform: translateY(0);
}
/* JavaScript */
function initializeFlyingBottom(elementId, text) {
const element = document.getElementById(elementId);
element.textContent = text;
element.classList.add('flying-bottom');
// Trigger the animation after a small delay
setTimeout(() => {
element.classList.add('active');
}, 100);
}
Flying Words Right Animation
Flying Words Left Animation
Flying Words Top Animation
/* CSS */
.flyword-top {
display: inline-block;
position: relative;
opacity: 0;
transform: translateY(-50px);
transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
will-change: transform, opacity;
}
.flyword-top.active {
opacity: 1;
transform: translateY(0);
}
/* JavaScript */
function initializeFlywordTop(elementId, text) {
const element = document.getElementById(elementId);
element.innerHTML = '';
const words = text.split(' ');
words.forEach((word, index) => {
const span = document.createElement('span');
span.textContent = word + (index < words.length - 1 ? ' ' : '');
span.className = 'flyword-top';
span.style.transitionDelay = `${index * 0.1s}`;
element.appendChild(span);
});
requestAnimationFrame(() => {
Array.from(element.children).forEach(span => {
span.classList.add('active');
});
});
}
Flying Words Bottom Animation
/* CSS */
.flyword-bottom {
display: inline-block;
position: relative;
opacity: 0;
transform: translateY(50px);
transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
will-change: transform, opacity;
}
.flyword-bottom.active {
opacity: 1;
transform: translateY(0);
}
/* JavaScript */
function initializeFlywordBottom(elementId, text) {
const element = document.getElementById(elementId);
element.innerHTML = '';
const words = text.split(' ');
words.forEach((word, index) => {
const span = document.createElement('span');
span.textContent = word + (index < words.length - 1 ? ' ' : '');
span.className = 'flyword-bottom';
span.style.transitionDelay = `${index * 0.1s}`;
element.appendChild(span);
});
requestAnimationFrame(() => {
Array.from(element.children).forEach(span => {
span.classList.add('active');
});
});
}
/* CSS */
.flyletter-right {
display: inline-block;
position: relative;
opacity: 0;
transform: translate(30px, -30px) rotate(45deg);
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
will-change: transform, opacity;
}
.flyletter-right.active {
opacity: 1;
transform: translate(0, 0) rotate(0deg);
}
/* JavaScript */
function initializeFlyletterRight(elementId, text) {
const element = document.getElementById(elementId);
element.innerHTML = '';
[...text].forEach((char, index) => {
const span = document.createElement('span');
span.textContent = char === ' ' ? '\u00A0' : char;
span.className = 'flyletter-right';
span.style.transitionDelay = `${index * 0.05s}`;
element.appendChild(span);
});
requestAnimationFrame(() => {
Array.from(element.children).forEach(span => {
span.classList.add('active');
});
});
}
/* CSS */
.flyletter-left {
display: inline-block;
position: relative;
opacity: 0;
transform: translate(-30px, -30px) rotate(-45deg);
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
will-change: transform, opacity;
}
.flyletter-left.active {
opacity: 1;
transform: translate(0, 0) rotate(0deg);
}
/* JavaScript */
function initializeFlyletterLeft(elementId, text) {
const element = document.getElementById(elementId);
element.innerHTML = '';
[...text].forEach((char, index) => {
const span = document.createElement('span');
span.textContent = char === ' ' ? '\u00A0' : char;
span.className = 'flyletter-left';
span.style.transitionDelay = `${index * 0.05s}`;
element.appendChild(span);
});
requestAnimationFrame(() => {
Array.from(element.children).forEach(span => {
span.classList.add('active');
});
});
}
/* CSS */
.flyletter-top {
display: inline-block;
position: relative;
opacity: 0;
transform: translateY(-30px) rotate(-45deg);
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
will-change: transform, opacity;
}
.flyletter-top.active {
opacity: 1;
transform: translateY(0) rotate(0deg);
}
/* JavaScript */
function initializeFlyletterTop(elementId, text) {
const element = document.getElementById(elementId);
element.innerHTML = '';
[...text].forEach((char, index) => {
const span = document.createElement('span');
span.textContent = char === ' ' ? '\u00A0' : char;
span.className = 'flyletter-top';
span.style.transitionDelay = `${index * 0.05s}`;
element.appendChild(span);
});
requestAnimationFrame(() => {
Array.from(element.children).forEach(span => {
span.classList.add('active');
});
});
}
/* CSS */
.flyletter-bottom {
display: inline-block;
position: relative;
opacity: 0;
transform: translateY(30px) rotate(45deg);
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
will-change: transform, opacity;
}
.flyletter-bottom.active {
opacity: 1;
transform: translateY(0) rotate(0deg);
}
/* JavaScript */
function initializeFlyletterBottom(elementId, text) {
const element = document.getElementById(elementId);
element.innerHTML = '';
[...text].forEach((char, index) => {
const span = document.createElement('span');
span.textContent = char === ' ' ? '\u00A0' : char;
span.className = 'flyletter-bottom';
span.style.transitionDelay = `${index * 0.05s}`;
element.appendChild(span);
});
requestAnimationFrame(() => {
Array.from(element.children).forEach(span => {
span.classList.add('active');
});
});
}