Best way to display animated image (HTML/CSS/JS) [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
On my website I'm trying to display the animation of a coin being flipped multiple times in the air and coming back to the surface. When the animation is over it should become a static image of the side the coin landed on.
I've found multiple ways to do this such as CSS animations, sprites,... but the options with CSS animations seem to be very limited if I want a rather advanced animation and others seem to have some flaws aswell.
What is the best method of displaying an animated image for a certain amount of time and then becoming a static image?

One option is to use Javascript. You could do:
<img src="animation.gif" alt="coin" id="yourImage">
<script>
var image = document.getElementById('yourImage');
window.setTimeout(changeImage, millisecondsToEndOfAnimation);
function changeImage() {
image.src = "staticImage.png";
}
</script>

Related

Can we program GIF in a way we can change the content from backend [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I am working on an idea where we we need a editable text field in GIF or any other image format where we should be able to change the content from background even after the Gif is generated and shared. is there any way to do it?
No, GIF is a simple image file format which also allows for simplistic animation by changing the image. It doesn't have support for anything more complex. Editable fields are well handled with HTML and forms so images don't need to do that and you're unlikely to find such "images" as they're not images any more.

Javascript Detecting collision on image with clear background [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am making a javascript game and I have an obstacle that when it touches the player's image, should take away a life. The problem is that I am currently detecting with the images' rectangles, and there are clear parts so it sometimes detects a collision when it doesn't look like the images are touching. I need a way to detect if the image is touching part of the image that isn't just clear background, like you make an outline of the non-clear part and check if the outlines collide. I don't know if this is possible to do with javascript, but let me know.
I have no good way of doing it fast. You see, if we do that, it will slow down much, as it says here : https://benjaminhorn.io/code/pixel-accurate-collision-detection-with-javascript-and-canvas/. You could make some smaller rectangles of different sizes, to help with more precise collisions.

JavaScript Animate Sprite Sheet? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have no experience with Sprite Sheets or animating via CSS, and I have my own sprite sheet (found here), and I researched plenty.
Only thing useful I got out of tutorials is that you can use a HTML5 Canvas and JavaScript/CSS to make it animate. The whole point of this is so that I can make a img loop a animation once, then change the src to this. Again, I did plenty of research and got little knowledge. How could I accomplish this?
You want to use steps in CSS animations. It allows to recreate an animated gif, just with a sprite sheet that gets shifted every few ms.

Film strip image gallery [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
This is the layout of what I want to do.
2 divs are there.
Below one(rectangle shaped) should be used for image thumbnails which can be scrolled horizontally
Square on above is for the image that will be shown when clicked on thumbnail
Can anyone guide me how to proceed for thumbnails and scrolling.
Building something like this can be quite straight forward but can be time consuming. I think that the best way you should go around this would be to use something that is already been developed and is already out there and is free.
If you take a look there seems to be a lot of people who already have the code built and ready for download similar to what you are asking for
Hope this helps!

Html 5 Canvas image Gallery [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I want to create a image gallery using Html 5 Canvas and when I hover a image, it must grow and change opacity. In addition to image selectable and draggable?
How can I do this? Any ideas?
Well sir, first try to code anything and then come to ask for assistance with particular problem. For now it looks like you have no clue about subject and not even tried. I can anwser a question like how to manipulate opacity in canvas, how to implement drag and drop, etc...
but NOT I need someone to implement my whole idea for me
I should also point out that Canvas isn't probably the best technology for this task (in the meaning of both performance and implementation difficulty).
If you insist, you will have to rewrite all functionality which is already easily accessible with DOM and libraries like jQuery.

Categories