Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

setInterval issue, if i turn on new tap, that can be slower

var rollImg = ["https://media.istockphoto.com/photos/fire-letter-a-of-burning-flame-picture-id844027508?k=6&m=844027508&s=170667a&w=0&h=dt0qXfyejRq_kjs5PqXcMf7Fij_opW7w1kfhfmH6dyQ=",
"https://cdn.leroymerlin.com.br/products/letra_b_11cm_acrilico_preto_kami_acrilicos_89622526_0001_600x600.jpg"];

var layer1Interval = 4000;
var layer2Interval = 5000;
var animationInterval = 1000;
$(function() {
  var roll = 1;
  function rollFnc () {
    setTimeout(function() {
      roll++;
      if (roll > 2) {
        roll = 1;
      }
      $("#box1").attr("src", rollImg[roll - 1]);
      setTimeout(rollFnc, layer1Interval + animationInterval * 1.5);
    }, animationInterval / 2);
  }
  
  rollFnc();
})

var tl = new TimelineMax({
  repeat: -1,
  repeatDelay: (layer1Interval / 1000)
});
tl.from(".layer1", animationInterval / 1000, {
  scaleX: 0,
  transformOrigin: "left",
  ease: 'expo.inOut'
});
tl.to(".layer1", animationInterval / 1000, {
  scaleX: 0,
  transformOrigin: "right",
  ease: 'expo.out'
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: react-image-lightbox npm 
Javascript :: F:JavascriptOOP 
Javascript :: how to save to local storage 
Javascript :: import multiple packages jsp 
Javascript :: how to detect keyboard layout js 
Javascript :: array destructuring mdn 
Javascript :: mongoose remove more than 1 item 
Javascript :: order by ascending descending in angular 6 on click of button 
Javascript :: javascript Ecrire une fonction afficherTable2() qui affiche la table de multiplication de 2 dans le contenu d’un élément p. 
Javascript :: Stateless/Presentational/Dumb component 
Javascript :: what to say to your ex 
Javascript :: CELEBRITY PROBLEM 2 gfg 7-18-21 
Javascript :: navigate to another page on vue js button 
Javascript :: Destructing variable assignment 
Javascript :: custom hook for unique items in react 
Javascript :: immutable js sort ascending and descending order 
Javascript :: default values not applied on findoneandupdate mongoose 
Javascript :: how do i count the number of occurrences in a string javascript 
Javascript :: how to make gamemaker games in javascript 
Javascript :: videoTitle$ Angular 2 - communication between two sibling components 
Javascript :: Application-level middleware 
Javascript :: fetch memes from redit from javascript 
Javascript :: react-hook-form input 
Javascript :: factorial recursion javascript 
Javascript :: reply nodejs terminal 
Javascript :: Image and other field save using Multiparty 
Javascript :: barcode scanner angularjs chrome browser issues 
Javascript :: npm ERR! code EBADPLATFORM stylint 
Javascript :: react movies 
Javascript :: how to use moment in angular 8 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =