JSFiddle - React, Tailwind, and code Playground

HTML

<div id="b">&nbsp;</div>

CSS

div#b {
    position: fixed;
    top:40px;
    left:0;
    width: 40px;
    height: 40px;
    background: url(http://www.mobianlegends.com/media/sprites/www.drshnaps.com/sdb.drshnaps.com/sheets/Media/Sega/Sonic/Customs/Bee.gif) 0 0 no-repeat;
}

JavaScript

var b = function($b,speed){
    beeWidth = $b.width();
    
    $b.animate({
        "left": "100%"
    }, speed, function(){
        $b.animate({
            "left": 0 - beeWidth + "px"
        }, speed, function(){
            b($b, speed)
        });
    });
};

$(function(){
    b($("#b"), 5000);
});