I have an animation made in CSS in which, I want to change the %(or keyframe) whenever a user clicks a button.Means, the animation should continue playing but from thew specified keyframe now matter which keyframe it currently is in. The HTML is like this:
<!DOCTYPE html>
<html>
<head>
<style>
.animate{
animation:main 5s infinite;
}
@ keyframes main{
0%{color:#000000;}
25%{color:#FF0000;}
50%{color:#00FF00;}
75%{color:#0000FF;}
100%{color:#000000;}
}
</style>
</head>
<body>
<div id="animate" class="animate">Some text</div>
<div onclick="change()">Change frame</div>
</body>
</html>
<script>
function change(){
document.getElementById("animate").style.frame=50%; //need help here
}
</script>
The animation is working fine. The problem is, I couldn't find any property which I can use to change keyframes(object.style.frame is no property!!)
Is there any such property that exists to do this?? Does anyone know what property that is??
Your help is much appreciated