Walkcycle with music loop

Developer
Size
2,398 Kb
Views
143,704

How do I make an walkcycle with music loop?

Demonstrating that the HTML5 audio's looping capability, which you'd think would be seemless and awesome, "pauses for breath" between loopage. Le sigh.. What is a walkcycle with music loop? How do you make a walkcycle with music loop? This script and codes were developed by Rachel Nabors on 14 June 2022, Tuesday.

Walkcycle with music loop Previews

Walkcycle with music loop - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Walkcycle with music loop</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ .tuna { animation: walk-cycle 1s steps(12) infinite; background: url(http://stash.rachelnabors.com/img/codepen/tuna_sprite.png) 0 0 no-repeat; height: 200px; width: 400px; margin: 100px auto 0;
}
@keyframes walk-cycle { 0% {background-position: 0 0; } 100% {background-position: 0 -2391px; }
}
html {text-align: center;} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <div class="tuna"></div>
<input type="button" value="Play loop!" />
<!--Notice the pauses in the loopage. So sad. Why you hurt me so, browsers?-->
<audio loop> <source src="http://stash.rachelnabors.com/music/byakkoya_single.mp3" type='audio/mpeg; codecs="mp3"'/> <source src="http://stash.rachelnabors.com/music/byakkoya_single.ogg" type='audio/ogg; codecs="vorbis"' />
</audio> <script src="js/index.js"></script>
</body>
</html>

Walkcycle with music loop - Script Codes CSS Codes

.tuna { animation: walk-cycle 1s steps(12) infinite; background: url(http://stash.rachelnabors.com/img/codepen/tuna_sprite.png) 0 0 no-repeat; height: 200px; width: 400px; margin: 100px auto 0;
}
@keyframes walk-cycle { 0% {background-position: 0 0; } 100% {background-position: 0 -2391px; }
}
html {text-align: center;}

Walkcycle with music loop - Script Codes JS Codes

document.querySelector('input').addEventListener('click', playMusic);
function playMusic() { document.querySelector('audio').play(); // audio tags have play
};
Walkcycle with music loop - Script Codes
Walkcycle with music loop - Script Codes
Home Page Home
Developer Rachel Nabors
Username rachelnabors
Uploaded June 14, 2022
Rating 4
Size 2,398 Kb
Views 143,704
Do you need developer help for Walkcycle with music loop?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Rachel Nabors (rachelnabors) Script Codes
Create amazing sales emails with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!