i just write a code using css and html. Its a beginner rocket animation which flies through transform: translate() rotate(). I used hover to fly the rocket. I want to use javascript onclick (or any other) event to fly the rocket. e.g when i click on lime box rocket animation begin. How can i do that through javascript event.
I also glad to know what i use to explode the rocket when i click on red button? how can i explode it on any stage of animation?
<html>
<head>
<link rel="stylesheet" href="rocket.css" type="text/css">
</head>
<body>
<div id="box">
<div id="pic">
</div>
<div id="play">
</div>
<div id="explode">
</div>
</div>
</body>
</html>
css i used
#box{
\\position:fixed;
top:0;
left:0;
width:900px;
height:650px;
background: black;
}
#pic{
width: 128px;
height: 128px;
top:80%;
position: relative;
\\background: red;
background-image: url('http://imgur.com/a/xlNpE');
transition: 3s;
}
#pic:hover {
width: 128px;
height: 128px;
top:80%;
position: relative;
\\background: red;
background-image: url('http://imgur.com/a/xlNpE');
transition: 5s;
transform:translate(750px, -530px) rotate(45deg) ;
}
#play {
width: 50px;
height: 50px;
background:lime;
float: left;
}
#explode {
width: 50px;
height: 50px;
background:red;
float: left;
}