Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. // var letters = angular.element(childrenElement.querySelectorAll('.small'));
  2. /**
  3. * writingAnimation()
  4. */
  5. function writingAnimation() {
  6.  
  7. var i = 0;
  8. var textTimeout;
  9.  
  10. /**
  11. * addText()
  12. *
  13. */
  14. (function addText() {
  15.  
  16. if (letters[i]) {
  17. letters[i].classList.add('is-big');
  18. }
  19.  
  20. i++;
  21. // the text animation shall take max 20s
  22. var isInTime = Math.round( ( i * 67 ) / 1000 ) <= 20;
  23. if (isInTime && totalLength >= i) {
  24. if (angular.isDefined(textTimeout)) {
  25. $timeout.cancel(textTimeout);
  26. }
  27. textTimeout = $timeout(addText, 1000 / 30 );
  28. } else {
  29. if (!isInTime) {
  30. childrenElement.querySelector('.description').innerHTML += '...'; // Leguan
  31. }
  32. if (settings.QRMode === 2) {
  33. currentItem.iconStyle['opacity'] = '0';
  34. }
  35. }
  36. })();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement