JSFiddle - React, Tailwind, and code Playground

by Oussama ELGOUMRI

HTML

<img src="http://www.france-art-realisation.com/artists_createurs/aldon_mireille/abstraction_lyrique_aldon_peintre/abstraction-lyrique_150.jpg">

CSS

<style>
    img {
        position: absolute;
        width: 100px;
        height: 100px;
        left: 0;
        top: 0;

        transition-property: left;
        transition-duration: 2s;
    }
</style>

JavaScript

function animate() {
        var img = document.getElementsByTagName('img')[0];
        var img_width = 100;
        var window_width = window.innerWidth;
        img.style.left = window_width - img_width;
    }

    function init() {
        setTimeout(animate, 1000);
    }

    window.onload = init();