Текст с эффектом волны путем увеличения букв на 30% у ссылок

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}


/* HTML5 display-role reset for older browsers */

article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
  display: block;
}

body {
  line-height: 1;
}

ol, ul {
  list-style: none;
}

blockquote, q {
  quotes: none;
}

blockquote:before, blockquote:after, q:before, q:after {
  content: '';
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

* {
  box-sizing: border-box;
}

a {
  text-decoration: none;
}

.menu {
  display: block;
  background-color: #2864aa;
  display: flex;
  flex-direction: column;
  max-width: 30%;
  margin: 0 auto;
}

.menu__item {
  margin: 0 auto;
  cursor: pointer;
}

.menu__link {
  color: #fff;
  font-size: 30px;
  font-family: sans-serif;
  padding: 20px 50px 20px 50px;
  display: inline-block;
  text-align: center
}

.menu__link {
  transition: background-color .1s linear;
}

.menu__link:hover {
  background-color: #0a87ad;
}
<ul class="menu">
  <li class="menu__item">
    <a class="menu__link" href="#">МЕНЮ</a>
  </li>
  <li class="menu__item">
    <a class="menu__link" href="#">МЕНЮ</a>
  </li>
  <li class="menu__item">
    <a class="menu__link" href="#">МЕНЮ</a>
  </li>
  <li class="menu__item">
    <a class="menu__link" href="#">МЕНЮ</a>
  </li>
</ul>


Ответы (1 шт):

Автор решения: UModeL

Когда-то делал печатающийся текст в виде "мексиканской волны" - возможно, после небольшой доработки, и здесь применить:

document.querySelectorAll('.menu__link').forEach(function(link) {
  let text = [...link.textContent];
  link.textContent = '';
  text.forEach((el, i) => {
    link.insertAdjacentHTML('beforeend', `<span style="
      animation-duration: ${1 / (link.dataset.speed || 1)}s;
      animation-delay: ${i * ((1 / (link.dataset.speed || 1)) / text.length)}s;
      animation-iteration-count: ${link.dataset.loop || 'infinite'};
    ">${el}</span>`);
  });
});
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}


/* HTML5 display-role reset for older browsers */

article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
  display: block;
}

body {
  line-height: 1;
}

ol, ul {
  list-style: none;
}

blockquote, q {
  quotes: none;
}

blockquote:before, blockquote:after, q:before, q:after {
  content: '';
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

* {
  box-sizing: border-box;
}

a {
  text-decoration: none;
}

.menu {
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  max-width: max-content;
  background-color: #2864aa;
}

.menu__item {
  margin: 0 auto;
  cursor: pointer;
}

.menu__link {
  display: block;
  padding: 10px 50px;
  font-size: 30px;
  font-family: sans-serif;
  text-align: center;
  color: #fff;
}

.menu__link {
  transition: background-color .1s linear;
}

.menu__link:hover {
  background-color: #0a87ad;
}

.menu__link>span {
  display: inline-block;
  white-space: pre-wrap;
  transform-origin: 0% 50%;
  pointer-events: none;
}

.menu__link:hover>span {
  animation: wave ease-in-out;
}

@keyframes wave {
  50% {
    transform: scale(1.3);
  }
}
<ul class="menu">
  <li class="menu__item">
    <a class="menu__link" href="#" data-speed=".25">Скорость ÷4 Повторов: ∞</a>
  </li>
  <li class="menu__item">
    <a class="menu__link" href="#" data-speed="1" data-loop="">Скорость ×1 Повторов: ∞</a>
  </li>
  <li class="menu__item">
    <a class="menu__link" href="#" data-speed="2" data-loop="">Скорость ×2 Повторов: ∞</a>
  </li>
  <li class="menu__item">
    <a class="menu__link" href="#" data-speed="1" data-loop="2">Скорость ×1 Повторов: 2</a>
  </li>
</ul>

→ Ссылка