<div class="pulse" style="width:150px;">Hello world!</div>
<script>
var elem = document.querySelector('.pulse');
var player = document.timeline.play(new Animation(elem, [
{opacity: "0.5", transform: "scale(0.5)"},
{opacity: "1.0", transform: "scale(1)"}
],
{
direction: "alternate", duration: 0.5, iterations: Infinity
}));
</script>
An emulator of the Web Animations specification. Please note that this is still experimental, and that the specification is likely to change in the future.
Related: Web Animations Preview
Leave a comment