Search
 
SCRIPT & CODE EXAMPLE
 

HTML

animate text

<style>
  .ml11 {
  font-weight: 700;
  font-size: 3.5em;
}

.ml11 .text-wrapper {
  position: relative;
  display: inline-block;
  padding-top: 0.1em;
  padding-right: 0.05em;
  padding-bottom: 0.15em;
}

.ml11 .line {
  opacity: 0;
  position: absolute;
  left: 0;
  height: 100%;
  width: 3px;
  background-color: #fff;
  transform-origin: 0 50%;
}

.ml11 .line1 { 
  top: 0; 
  left: 0;
}

.ml11 .letter {
  display: inline-block;
  line-height: 1em;
}
</style>

<h1 class="ml11">
  <span class="text-wrapper">
    <span class="line line1"></span>
    <span class="letters">Hello Goodbye</span>
  </span>
</h1>

<script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/2.0.2/anime.min.js"></script>

<script>
// Wrap every letter in a span
var textWrapper = document.querySelector('.ml11 .letters');
textWrapper.innerHTML = textWrapper.textContent.replace(/([^x00-x80]|w)/g, "<span class='letter'>$&</span>");

anime.timeline({loop: true})
  .add({
    targets: '.ml11 .line',
    scaleY: [0,1],
    opacity: [0.5,1],
    easing: "easeOutExpo",
    duration: 700
  })
  .add({
    targets: '.ml11 .line',
    translateX: [0, document.querySelector('.ml11 .letters').getBoundingClientRect().width + 10],
    easing: "easeOutExpo",
    duration: 700,
    delay: 100
  }).add({
    targets: '.ml11 .letter',
    opacity: [0,1],
    easing: "easeOutExpo",
    duration: 600,
    offset: '-=775',
    delay: (el, i) => 34 * (i+1)
  }).add({
    targets: '.ml11',
    opacity: 0,
    duration: 1000,
    easing: "easeOutExpo",
    delay: 1000
  });
</script>
Comment

PREVIOUS NEXT
Code Example
Html :: how to show data in html table from database in multiple table in laravel 
Html :: navigation menu 
Html :: source html 
Html :: data table in html code 
Html :: html5 time input 24 hour format 
Html :: crypto conversion calculator 
Html :: dropdown 
Html :: gjgug 
Html :: openGraph 4 
Html :: is jeremy ugly 
Html :: Customize the names of downloadable files 
Html :: how to make clicking button send you down to a certain section of page html 
Html :: open mail in html 
Html :: html encrypt email from bots 
Html :: js does a return stop a while 
Html :: HTML <address for Contact Information 
Html :: lorem long text 
Html :: chrome empty page editable 
Html :: adding bootstrap to macros html in flask 
Html :: twitter html 
Html :: htmlagility treeview 
Html :: erc20 symbol format 
Html :: angular right click not working 
Html :: google address suggestion is not working inside popup modal 
Html :: prompt for confirm before link click 
Html :: accident news report 
Html :: a open to other tab 
Html :: controls in html list 
Html :: hover message html 
Html :: dollar zero html 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =