JSFiddle - React, Tailwind, and code Playground
by Nilzone
HTML
<img src="http://i.imgur.com/TGpkv0X.png" id ="red" alt="enemy">
CSS
body{
margin: 0;
padding: 0;
overflow: hidden;
}
img{
max-width: 100%;
}
#red{
width: 90px;
height: 60px;
}
#red{
position: absolute;
top: 76px;
left: 500px;
animation: redCar 5s linear infinite;
-webkit-animation: redCar 5s linear infinite;
-moz-animation: redCar 5s linear infinite;
-o-animation: redCar 5s linear infinite;
}
@keyframes redCar{
0%{right: 0px;}
100%{left: 100px;}
}
@-webkit-keyframes redCar{
0%{right: 0px;}
100%{left: 100px;}
}
JavaScript
$(document).ready(function(){
$('#red').animate({
opacity: 10
}, 1500);
});