Texte Flou

Code HTML

				
					<link href="https://fonts.googleapis.com/css2?family=Unbounded&display=swap" rel="stylesheet">

<div id="blur-text" style="font-size: 50px; font-weight: bold; font-family: 'Unbounded', sans-serif;"></div>

<style>
  #blur-text span {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    filter: blur(8px);
    animation: blurIn 0.8s forwards;
    animation-play-state: paused;
    margin-right: 6px;
  }

  @keyframes blurIn {
    0% {
      opacity: 0;
      transform: translateY(20px);
      filter: blur(8px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
      filter: blur(0);
    }
  }
</style>

<script>
  document.addEventListener('DOMContentLoaded', () => {
    const textContent = " N'est ce pas trop cool ? "; // <-- texte avec espaces au début et fin
    const container = document.getElementById('blur-text');
    const delay = 200; // ms entre mots

    function playAnimation() {
      container.innerHTML = '';
      const words = textContent.trim().split(' '); // trim pour enlever espaces début/fin

      words.forEach((word, index) => {
        const span = document.createElement('span');
        span.textContent = word;
        span.style.animationDelay = `${(index * delay) / 1000}s`;
        span.style.animationPlayState = 'running';
        span.style.animationName = 'blurIn';
        container.appendChild(span);

        if (index < words.length - 1) {
          container.appendChild(document.createTextNode('\u00A0')); // ajoute un espace insécable
        }
      });
    }

    playAnimation();
  });
</script>
				
			

Bouton Relancer animation

				
					<div id="blur-text" style="font-size: 24px; font-weight: bold; color: white;"></div>

<button id="replay-btn" style="
  margin-top: 1rem;
  padding: 8px 16px;
  font-size: 16px;
  cursor: pointer;
  background-color: transparent;
  color: white;
  border: 1px solid white;
  border-radius: 5px;
  transition: background-color 0.3s ease, color 0.3s ease;
">
  Relancer l'animation
</button>

<style>
  #blur-text span {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
    filter: blur(8px);
    animation: blurIn 0.8s forwards;
    animation-play-state: paused;
    margin-right: 6px;
  }

  @keyframes blurIn {
    0% {
      opacity: 0;
      transform: translateY(20px);
      filter: blur(8px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
      filter: blur(0);
    }
  }

  #replay-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
  }
</style>

<script>
  document.addEventListener('DOMContentLoaded', () => {
    const textContent = "N'est-ce pas trop cool ?"; // change le texte ici
    const container = document.getElementById('blur-text');
    const replayBtn = document.getElementById('replay-btn');
    const delay = 200; // délai entre mots en ms

    function playAnimation() {
      container.innerHTML = '';
      const words = textContent.split(' ');

      words.forEach((word, index) => {
        const span = document.createElement('span');
        span.textContent = word;
        span.style.animationDelay = `${(index * delay) / 1000}s`;
        span.style.animationPlayState = 'running';
        span.style.animationName = 'blurIn';
        container.appendChild(span);
      });
    }

    // Lancement initial
    playAnimation();

    // Bouton pour relancer
    replayBtn.addEventListener('click', () => {
      playAnimation();
    });
  });
</script>
				
			

Comment insérer le code sur son site ?

✏️ Étape 1 : Copiez ce code.

Copier le code complet. Ne vous inquiétez pas, vous le collerez tel quel.

🛠️ Étape 2 : Ajoutez ce code dans votre site.

  1. Allez dans Pages > Modifier avec Elementor sur la page souhaitée

  2. Cherchez le widget HTML

  3. Glissez le widget HTML à l’endroit voulu sur la page

  4. Collez tout le code que vous venez de copier dans le champ HTML

  5. Cliquez sur Mettre à jour

✅ C’est terminé !


Quand vous visualisez la page, le texte circulaire tourne automatiquement, et ralentit si vous passez votre souris dessus 🌀

Strategie Execution Succès
Strategie Execution Succès

Agence de webdesign à Brest spécialisé dans le référencement local.

Notre Newsletters

Liens pratiques
Services
Location

Rue de l’Elorn, 29200 Brest

Site web réalisé par WREIZH.