Change background at specific GIF frame - javascript

I am looking for an advice to do some “animation” on my home page on a WordPress website,
I have a gif playing once on my home page,
I would like to change the background color, only at a specific frame of the gif. When the gif hit its 80 frame, the background should switch from white to black.
Can it be done with javascript ?
Could you direct me on how to do that ?
Thank you very much

A gif with 80 frames or more is not really good for your website. I strongly recommend using a plugin like Slider Revolution to create animations or use other methods like Animate It!
A video would be another possible option too. You can convert your gif into video with the help of some online tools.

Related

Faster image changing in JS

I have an audio player I built with HTML5 and JavaScript.
Clicking on the play button tells JavaScript to play the audio and change the src on the play button image (play.svg) to the pause.svg icon. The slowness here is noticeable. Takes time to go to the server and fetch that image.
What's a faster way to change the play button to a pause button?
The question is quite broad, but to give you some ideas:
You could use two image tags and show / hide them on the page.
Use a CSS sprite and changing the CSS class
Preload the SVGs using Javascript
Without seeing your code I don't know what the best solution for you is but one of these options should cover what you are looking for.

Stop Audio in Wordpress

I am using the background video option in Divi (by elegant themes) in Wordpress to show a 4 minute or so long video in the background. The thing is, I don't want the audio. I understand if you scroll down far enough the entire thing stops, but I just don't need or want the audio. Is there any custom code that I can use (or a plugin) to get the audio to stop playing ON THE VIDEO BACKGROUND, or will I have to convert it to a gif? Thanks.

How to simulate scroll down on webpage and save the process into video

I have tons of website to scroll it's index page from top to bottom.
And save the "Animated Content" or "Dynamic js/css effect" among the scrolling process as a video.
I know the tool phatomJS can capture a screenshot.
Is there any tool can simulate scroll and get save the whole process into video?
I assume the page has no dynamic content loading after first scroll.
You can take a single screenshot with PhantomJS. Then, in the programming language of your choice segment the screenshot (with overlapping) moving a few pixels down (or up) and save as a frame image.
OR
Take a bunch of screenshots that would make up your video. You can do this by setting page.clipRect before taking the screenshot with page.render.
You end up with a lot of images that you need to fuse into a video. Consult google for a tool that can take a bunch of images and convert them to video.
If you have something like an infinite scroll page, you still need to load the complete page before you start taking screenshots. This is usually done in the following way: How to scroll down with Phantomjs to load dynamic content

HTML 5 Canvas Hide?

Is there an event that can be used to hide the canvas after it plays its animation? I have a canvas animation that plays then rests. I then want to use JavaScript to hide the canvas and show a static image with more intricate image swaps and linking than I know how to do in the canvas. Is there any way to do this?
No, there is not, because the HTML5 canvas API has no such concept like an animation. Everything that happens on a HTML5 canvas is the result of your script code changing the canvas content, so you should know best when you are finished changing it and no more changes are going to happen.
In a comment you said that you didn't write your canvas code yourself but used a tool to convert a flash animation to Javascript. So your options are:
You could try to understand the generated code and how to modify it to hide the canvas after it did the last thing it will do.
When the animation isn't interactive, you could use setTimeout to hide the canvas after a fixed time-period
You could consult the documentation of the tool you used. Maybe it has an option for doing this.
When it has no such option, you could bother the developers to add one, or when it is an open source tool, add such an option yourself.

Slowy fade in or load an image from left to right with post-load delay?

I have an image of a vine of leaves I'd like to load slowly from left to right after a delay (after the site fully loads) to underline and emphasize a slogan of website I'm working on. I don't want to animate the image, just make it seem as though it is growing by loading it slowly.
Is there a CSS solution or would it be easier to use Jquery?
Thanks so much in advance for any help!
I don't believe there is a CSS solution to your query. In photoshop you can save a jpeg or png as progressive (interlaced) so that it downloads progressively but on anything but the slowest link a regular size file will appear to load quickly.
I would have thought your easiest option was an animated gif - the opacity and apparent size could be tightly controlled and you can set it only to run once per visit. You could bind the image to the jQuery(document).ready() callback for the "after the site fully loads" part of your request.

Categories