JSFiddle - React, Tailwind, and code Playground
JavaScript
var things_to_move = [
['.ufo, .chefoven, .sushi', 1000, 200],
['.hotdog,.pizzaman,.boyballon', 1000, 360],
];
var createShow = function(i){
return function() { showFun(i) };
}
var createHide = function(i){
return function() { hideFun(i) };
}
var showFun = function(i) {
$(things_to_move[i][0]).addClass('move');
setTimeout( createHide(i),things_to_move[i][2]);
}
var hideFun = function(i) {
$(things_to_move[i][0]).removeClass('move');
}
for(_A=0; _A < things_to_move.length; _A++) {
setInterval(createShow(_A), things_to_move[_A][1]);
}