Donatello Sprite

Developer
Size
2,452 Kb
Views
28,336

How do I make an donatello sprite?

Experimenting with a simple sprite animation.. What is a donatello sprite? How do you make a donatello sprite? This script and codes were developed by Coran Spicer on 15 October 2022, Saturday.

Donatello Sprite Previews

Donatello Sprite - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Donatello Sprite</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="donatello" class="idle"></div>
<button id="play" onClick="play();">Play Animation</button>
<br />
<input id="framerate" value="24" type="text" name="framespersecond" ></input> <script src="js/index.js"></script>
</body>
</html>

Donatello Sprite - Script Codes CSS Codes

body { text-align: center;
}
#donatello { display: block; position: relative; margin: 0 auto; width: 184px; height: 118px; overflow: hidden; background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/23594/stompin_the_foot.png") no-repeat; background-position: 0 0;
}

Donatello Sprite - Script Codes JS Codes

var img = { name : 'donatello', width : 184, height : 118, frames : 12
};
var framerate = document.getElementById('framerate').value ? document.getElementById('framerate').value : 24, el = document.getElementById('donatello'), currentFrame = 0;
console.log( document.getElementById('framerate').value );
var play = function() { // re-check framerate setting framerate = document.getElementById('framerate').value ? document.getElementById('framerate').value : 24; var animationPlay = setInterval( function(){ if ( currentFrame >= (img.frames - 1) ) { clearInterval(animationPlay); setTimeout( function() { currentFrame = 0; el.style.backgroundPosition = "0px 0px"; },1000/framerate); return false; } currentFrame++; el.style.backgroundPosition = -(currentFrame * img.width) +'px 0px'; }, 1000/framerate);
}
Donatello Sprite - Script Codes
Donatello Sprite - Script Codes
Home Page Home
Developer Coran Spicer
Username cgspicer
Uploaded October 15, 2022
Rating 3
Size 2,452 Kb
Views 28,336
Do you need developer help for Donatello Sprite?

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!

Coran Spicer (cgspicer) Script Codes
Create amazing Facebook ads 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!