Basically you can produce a normal HTML/CSS animation (or get one off the web), feed the keyframes and the animation parameters into my utility, click a button and hey-presto you have some text that you edit back into your HTML file (after deleting or commenting out the original animation parameters in it). There are some restrictions which are detailed on the webpage.
There are two javascript files you need to download from the website in order to run the resulting HTML filter.: jQuery (a JavaScript library designed to simplify HTML DOM tree traversal, manipulation and events) and elusien_cssanims2js.js (the āglueā between Web Animations (Polyfill) and Shotcut-MLTās WebVfx). These can be obtained from the webpage.
split the CSS clause for the ādivā into two, so that the animation part is separate:
div { width: 100px; height: 100px; background-color: red; position: relative; }
div { animation: myfirst 5s linear 2s infinite alternate; }
copy the keyframes (including the ā@keyframesā keyword) into the first textbox of the utility;
copy the whole of the animation line into the second textbox, then delete it from the HTML file (or comment it out e.g. by changing the word āanimationā to āXanimationā;
insert the framerate in the third textbox;
click the "generateā button.
Then you would copy the resulting Javascript code into your HTML file (just after the tag that says ā<head>ā and save the chages.
You now have an Overlay HTML (Text: HTML) filter. You can run it in a browser and test any modifications that way. When you are happy with the result you can then use it in Shotcut. DO NOT FORGET TO TICK THE OPTION TO SAY YOU ARE USING WEBVFX.
Hi @elusien, looks like a very useful tool! However, I canāt get it to work right now. What am I doing wrong?
I took your sample HTML code above. Pasted into notepad++, saved it as, say āelusienā.
Pasted the code as per instructions into your genarator as follows:
Generated the javascript.
Copied and pasted into HTML file, renamed it āelusien changedā.
Deleted the animation line.
It now looks like this (spread over two screenshot jpgs to fit all text in):
Then I opened SC, set up a colour clip on V1 and applied the āelusien changedā HTML file, but nothing happened.
I have the JQUERY and the cssanim2 file in the same folder as the HTML file.
In the screenshot above, I see a . . / which means go back two directories.
Try taking out both . . /
(Since you have the html and both js files in the same directory).
Ah, sorry to be dense but Iām not quite getting this bit - Iām only using one folder which has the two JS files and the new HTML file in it. Canāt quite follow the 2 overlays and 2 filters part of your diagram above.
OK, if you have the two .js files in the same folder as your html file then edit the html file to delete the string ā../ā in front of these two files.
If you have already done this can you look into the Shotcut log to see if there is an error message. Better still run it in a browser and look at the javascript console (function F12).
Your resulting HTML file is identical to mine (which works in Shotcut and in a browser), so it can only be the location of the javascript files.
Often you have more than just an HTML file when you develop a Text:HTML filter. You may have some .images (.png, .jpg), you may also have some other assets additional javascript files or CSS files. I donāt like having a hotch-potch of these all in the same folder, I like to keep the filters in separate folders, but I donāt want to have copies of the same javascript files in every folder hence the ā../ā which means "the parent folderā.
Thanks @elusien , I got somewhere - the animation is working in chrome - but not responding when I apply to a colour clip in SC. Is this generated code OK? Itās from your example.
Just compared yours to mine and apart from a break in the animation line (which makes no difference) and the location of the two javascript files itās identical.I ran it in the browser and in Shotcut and it works fine in both.
I will change the utility to try the parent directory first and if the javascript files are not there it will use the current directory.
How long is your color clip. The animation only starts visibly aftey 3 seconds. Try a longer clip. Is there any error message in the logfile?
A development - it works now! Thank you.Yes, I got it working just before your message. Yes, I needed to extend the colour clip!! Sorry to not think of that before - DOHH! (may be worth mentioning this in your instructions though in case others are as dense as me!!)
Great! I can think of so many possibilities now. What a useful addition to SCās capabilities. Superb work!!
Now, just thinking - how do I change the position of the animation? For instance, centering the animation in the SC full screen? I presume I can change the left, top attributes in the code? Iāl have a try.
Iāll change the example to have a 0.5s delay instead.
I would change the keyframes to be percentages centred around the middle (50%, 50%), e.g.
20% and 80%.
I have an interesting filter using this tool that is similar to āchasing bordersā you did a while ago. Iāll put up some examples for people to see.
Because the system uses Javascript to do the animation as opposed to CSS, You canāt have a name with a minus-sign in it, so I changed all the minuses to underscores (octagon_sparkle, triangle_sparkle, octagon_shards, triangle_shards). That got it (almost) working in Chrome.
The keyframes that have two percentages on them have the second one ignored. That is a problem in my code that I need to fix. This doesnāt stop it working though, only it isnāt quite right.
I feed this into Shotcut and again there are now another couple of things that are not quite right, basically the angle the āsparklesā shoot out. That is because of the old version of the webkit HTML engine that Shotcut uses. We have to change the ātransform:rotateā that are NOT in the keyframes into ā-webkit-transform:rotateā. We do not need to change it in the keyframes because the javascript handling those knows that this webkit HTML engine has to have the ā-webkit-ā prefix.
After making all these changes it (almost) works in Shotcut. I then added the second percentages separately an it works fine.