javascript - Add a Dynamic Transparency (opacity) to Vertical Text Scroll -


here css i'm working with:

figure p { opacity:0; }  figure:hover p {  opacity:1;  -webkit-transition: opacity 0.35s; transition: opacity 0.35s;  margin: 0;  line-height: 50px;  text-align: center;  /* starting position */  -moz-transform:translatey(100%);  -webkit-transform:translatey(100%);      transform:translatey(100%);  /* apply animation element */    -moz-animation: scroll-up 5s linear infinite;  -webkit-animation: scroll-up 5s linear infinite;  animation: scroll-up 5s linear infinite; } /* move (define animation) */ @-moz-keyframes scroll-up {  0%   { -moz-transform: translatey(100%); }  100% { -moz-transform: translatey(-100%); } } @-webkit-keyframes scroll-up {  0%   { -webkit-transform: translatey(100%); }  100% { -webkit-transform: translatey(-100%); } } @keyframes scroll-up {  0%   {   -moz-transform: translatey(100%); /* browser bug fix */  -webkit-transform: translatey(100%); /* browser bug fix */  transform: translatey(100%);         }  100% {   -moz-transform: translatey(-100%); /* browser bug fix */  -webkit-transform: translatey(-100%); /* browser bug fix */  transform: translatey(-100%);   } } 

it scrolls text nicely, can't figure out how make gradual opacity transition. apparent above code, tried adding hover style:

 opacity:1;  -webkit-transition: opacity 0.35s; transition: opacity 0.35s; 

the resulting style on page not expected. text appears suddenly. bummer, because i'm after have dynamic opacity. in other words, higher text, more transparent should become. once reaches highest point in vertical scroll (the text scrolls bottom top), 100% transparent (aka 0 opacity). i'm bit apprehensive because said above, can't simple opacity transition work.

question: there means such style given current vertical scroll style?

try this

p {    opacity: 0;  }    .figure:hover p {    margin: 0;    line-height: 50px;    text-align: center;    /* starting position */    -moz-transform: translatey(100%);    -webkit-transform: translatey(100%);    transform: translatey(100%);    /* apply animation element */    -moz-animation: scroll-up 8s linear infinite;    -webkit-animation: scroll-up 8s linear infinite;    animation: scroll-up 8s linear infinite;  }      /* move (define animation) */    @-moz-keyframes scroll-up {    0% {      -moz-transform: translatey(100%);      opacity: 0;    }    50%,60%{      opacity: 1;    }    100% {      -moz-transform: translatey(-100%);      opacity: 0;    }  }    @-webkit-keyframes scroll-up {    0% {      -webkit-transform: translateysa(100%);      opacity: 0;    }    50%,60%{      opacity: 1;    }    100% {      -webkit-transform: translatey(-100%);      opacity: 0;    }  }    @keyframes scroll-up {    0% {      -moz-transform: translatey(100%);      /* browser bug fix */      -webkit-transform: translatey(100%);      /* browser bug fix */      transform: translatey(100%);      opacity: 0;    }    50%,60%{      opacity: 1;    }    100% {      -moz-transform: translatey(-100%);      /* browser bug fix */      -webkit-transform: translatey(-100%);      /* browser bug fix */      transform: translatey(-100%);      opacity: 0;    }  }
<div class="figure">    hover here    <br>    <br>    <p>      lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text ever since 1500s, when unknown printer took galley of type , scrambled make type specimen book. has      survived not 5 centuries, leap electronic typesetting, remaining unchanged. popularised in 1960s release of letraset sheets containing lorem ipsum passages, , more desktop publishing      software aldus pagemaker including versions of lorem ipsum.    </p>  </div>


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -