Animated svg not working anymore?


I have an animated svg file (generated with keyshape that i’m using while waiting for Hype 4 :wink: ). It works when i open it directly with safari, chrome, firefox…
When i bring it within Hype (i did before with several test ) the animation doesnt start.

I used a rectangle and paste the svg code (including the javascript thingies) in its inner html.

I tried several things. Created other animations. didnt work. I even copied several pieces of code from the hype generated html page in another editor, compared with the original file (it was the same), watched it again in browser and then it worked !?
Any ideas guy ? I am polity begging you, you know :wink: (23.8 KB)

You could try separating the JavaScript within that SVG out, so that it can run at the correct time. (Run it as an ‘on scene load’ function).

Or, you could insert the entirety of the code within an HTML widget to insulate it a bit. Since that JavaScript is inserted within the DOM by Hype, it is not running when it is displayed in the inner HTML of a rectangle.

1 Like

Thank you, good advice : it works with the html widget.
I tried before to separate the javascript code but even there it didnt work.

I’m still surprised that it worked before within a basic rectangle and not anymore but maybe i’ll understand another day :slight_smile:

This is actually a bug; Hype has to do a bit of work to get inline <script> tags to run in normal elements, and there was an issue with this code.

It has been fixed for the next release. You’re welcome to apply for the v4 beta.