Jump to content
Search Community

Animation not animating on server

Slackton test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hey there, I'm really new here, and this is pretty much ym first attempt at using greensock.

I googled my ass off, but couldn't seem to find any answers that resolved my issue.

 

In the codepen, the animation is working as intended. In the file I created for the website, I have the css and the scripts in the .svg file, which should be fine, right?

Even if it isn't, I tried making seperate .js files and still, the animation on the website is showing only the complete circle strokes at 100%.

I'm not sure if I need to include anything else in my code or if there are any errors in the code itself. Kinda starting to get frustrated, since it works perfectly, locally, when I have it all in 1 HTML File.

 

That's how I'm trying to embed the .svg on the website:

<object type="image/svg+xml" data="/globalcore/nolng/img/Logo.svg" class="logoLoading"></object>

 

I attached the .svg file that I'm trying to embed also.

 

Every help highly appreciated, thank you!

Logo.svg

 

Edit: And oh, in the codepen I have also the opacity animated of another group that I did not include in this, because it's the Logo of a company which I don't want to show here.

See the Pen xWGMYx by anon (@anon) on CodePen

Link to comment
Share on other sites

I'm not an expert on this, but I believe browsers sandbox SVG files for security reasons, so you can't expect them to be able to reach out into the parent document and find other objects (like GSAP). 

 

I believe you've got to load the JS into your SVG file, like:

<script type="text/javascript" xlink:href="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.4/TweenMax.min.js" />

(inside the SVG) (and you'll need to load DrawSVGPlugin too of course)

 

Or you could inline GSAP, of course, but that seems kinda wasteful to me. 

 

Also, you need to define an xmlns for the xlink in your <svg> tag, like:

<svg id="AnimationsContainer" width="200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-250 -250 500 500">

 

Does that help? 

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...