JSFiddle - React, Tailwind, and code Playground

by arcm111

HTML

<img id='hiddenImage' style='display: none',...

CSS

body
{
	line-height: 0;
}
.obstacleAnimation
{
	display: inline-block;
	width: 50px;
	height: 50px;
	margin: 0;
	padding: 0;
}

JavaScript

var src = document.getElementById ('hiddenImage').src;

function start() {
    setInterval (addObstacle, 1000);
}

function addObstacle()
{
        var element = document.createElement('img');
        element.className = 'obstacleAnimation';
        element.src = src;
        document.body.appendChild (element);
}

start();