<!-- Code by Fedyaeva -->
<!--Подключение шрифта-->
<style>
@font-face {
src: url('RobotoVar-link.woff2') format('woff2-variations'),
url('RobotoVar-link.woff') format("woff");
font-family: "Roboto Var";
font-display: swap;
font-style: normal;
}
.custom-font div {
font-family: "Roboto Var", sans-serif!important;
}
</style>
.custom-link div, .custom-button div {
font-family: "Roboto Var", sans-serif!important;
}
<!-- Code by Fedyaeva -->
<!-- Анимация вариативного шрифта при наведении -->
<style>
@media screen and (min-width: 768px) {
.custom-link {
display: flex;
cursor: pointer;
font-variation-settings: 'wght' 200;
will-change: transform;
animation-fill-mode: backwards;
}
.custom-link div {
display: flex!important;
justify-content: space-around;
}
.custom-link:hover {
animation: sample-width 1.5s linear infinite 0s;
}
@keyframes sample-width {
0%, 100% {
font-variation-settings: 'wght' 200;
}
50% {
font-variation-settings: 'wght' 560;
}
}
}
</style>
<!-- Code by Fedyaeva -->
<!-- Анимация вариативного шрифта при наведении -->
<style>
@media screen and (min-width: 768px) {
.custom-link-1 span {
font-variation-settings: 'wght' 200;
}
.custom-link-1:hover span {
animation: sample-width-2 0.6s linear forwards;
}
}
@keyframes sample-width-2 {
0%, 100% {
font-variation-settings: 'wght' 200;
}
50% {
font-variation-settings: 'wght' 700;
}
}
</style>
<script>
document.addEventListener("DOMContentLoaded",function(){
function splitText(el) {let elem;let textContainer;if (document.querySelectorAll(el).length > 1) {elem = document.querySelectorAll(el);elem.forEach((itm) => {textContainer = itm.querySelector('div');textContainer.innerHTML = '<span>' + itm.textContent.trim().split('').join('</span><span>') + '</span>';});} else {elem = document.querySelector(el);textContainer = elem.querySelector('div');textContainer.innerHTML = '<span>' + elem.textContent.trim().split('').join('</span><span>') + '</span>';}}
function addAnimation(el, time) {let elem;let textLength;let textSymbol;let span;let delay = 0.4;if (document.querySelectorAll(el).length > 1) {elem = document.querySelectorAll(el);elem.forEach((itm) => {textLength = itm.querySelectorAll('div span').length;for (let i = 0; i <= textLength; i += 1) {textSymbol = `div span:nth-of-type(${i})`;span = itm.querySelector(textSymbol);if (span) {span.style.animationDelay = `${delay}s`;delay += time;}}delay = 0.4;});} else {elem = document.querySelector(el);textLength = elem.querySelectorAll('div span').length;delay = 0;for (let i = 0; i <= textLength; i += 1) {textSymbol = `div span:nth-of-type(${i})`;span = elem.querySelector(textSymbol);if (span) {span.style.animationDelay = `${delay}s`;delay += time;}}}}if (window.matchMedia("(min-width: 400px)").matches) {splitText('.custom-link-1');addAnimation('.custom-link-1', 0.15);}})
</script>
<!-- Code by Fedyaeva -->
<!-- Анимация вариативного шрифта при наведении -->
<style>
@media screen and (min-width: 768px) {
.custom-link-2 span {
font-variation-settings: 'wght' 200;
}
.custom-link-2:hover span {
animation: sample-width-2 var(--dur) linear infinite;
}
}
@keyframes sample-width-2 {
0%, 100% {
font-variation-settings: 'wght' 200;
}
50% {
font-variation-settings: 'wght' 700;
}
}
</style>
<script>
document.addEventListener("DOMContentLoaded",function(){
function splitText(el) {let elem;let textContainer;if (document.querySelectorAll(el).length > 1) {elem = document.querySelectorAll(el);elem.forEach((itm) => {textContainer = itm.querySelector('div');textContainer.innerHTML = '<span>' + itm.textContent.trim().split('').join('</span><span>') + '</span>';});} else {elem = document.querySelector(el);textContainer = elem.querySelector('div');textContainer.innerHTML = '<span>' + elem.textContent.trim().split('').join('</span><span>') + '</span>';}}
function addAnimation2(el, time) {let elem;let textLength;let textSymbol;let span;let dur = 0.4;if (document.querySelectorAll(el).length > 1) {elem = document.querySelectorAll(el);elem.forEach((itm) => {textLength = itm.querySelectorAll('div span').length;for (let i = 0; i <= textLength; i += 1) {textSymbol = `div span:nth-of-type(${i})`;span = itm.querySelector(textSymbol);if (span) {span.style.setProperty("--dur", dur + "s");dur += time;}}dur = 0.4;});} else {elem = document.querySelector(el);textLength = elem.querySelectorAll('div span').length;dur = 0;for (let i = 0; i <= textLength; i += 1) {textSymbol = `div span:nth-of-type(${i})`;span = elem.querySelector(textSymbol);if (span) {span.style.setProperty("--dur", dur + "s");dur += time;}}}}if (window.matchMedia("(min-width: 400px)").matches) {splitText('.custom-link-2');addAnimation2('.custom-link-2', 0.15);}})
</script>
<!-- Code by Fedyaeva -->
<!-- Анимация вариативного шрифта при наведении -->
<style>
.custom-link-3 {
font-variation-settings: 'wght' 200;
}
</style>
<script>
document.addEventListener("DOMContentLoaded",function(){
function splitText(el) {
let elem;
let textContainer;
if (document.querySelectorAll(el).length > 1) {
elem = document.querySelectorAll(el);
elem.forEach((itm) => {
textContainer = itm.querySelector('div');
textContainer.innerHTML = '<span>' + itm.textContent.trim().split('').join('</span><span>') + '</span>';
});
} else {
elem = document.querySelector(el);
textContainer = elem.querySelector('div');
textContainer.innerHTML = '<span>' + elem.textContent.trim().split('').join('</span><span>') + '</span>';
}
}
function addAnimation2 (el) {
var animText = document.querySelectorAll(el);
animText.forEach((item) => {
let i = 0;
let interval;
item.addEventListener('mouseenter', (e) => {
let span = event.target.querySelectorAll('div span');
interval = setInterval(function() {
span.forEach(char => {
char.style.fontVariationSettings = '"wght" 200';
})
span[i].style.fontVariationSettings = '"wght" 700';
i += 1;
if (i == span.length) i = 0;
}, 250);
})
item.addEventListener('mouseleave', (e) => {
let allSpan = document.querySelectorAll('div span');
allSpan.forEach(char => {
char.style.fontVariationSettings = '"wght" 200';
})
clearInterval(interval);
i = 0;
});
})
}
if (window.matchMedia("(min-width: 400px)").matches) {
splitText('.custom-link-3');
addAnimation2('.custom-link-3');
}
});
</script>