Jump to content
Search Community

Recommended Posts

GameLord2011
Posted

I am attempting to make an svg animation in my nextjs app using GSAP and SimpleIcons wherin one programming language/utility logo morphs into another, and am concerned about the performance on lower-performance devices. Is there a way to, instead of passing the id of an svg path, pass the raw path of the svg as the target, as I don't want to have a 100mb homepage due to there being are a bunch of path elements in the html. I am using canvas drawing for performance reasons and flexibilities sake.

GreenSock
Posted

Without a minimal demo, it's SUPER difficult to know what's going on, but here's a quick fork of one of our demos showing the exact path data you're trying to pass in (according to your Github issue), and it works: 

See the Pen ogzROrB by GreenSock (@GreenSock) on CodePen.

 

For reference, you said the error was: 

Quote

SyntaxError: Failed to execute 'querySelectorAll' on 'Document': 'M16.5921 9.1962s-.354-3.298-3.627-3.39c-3.2741-.09-4.9552 2.474-4.9552 6.14 0 3.6651 1.858 6.5972 5.0451 6.5972 3.184 0 3.5381-3.665 3.5381-3.665l6.1041.365s.36 3.31-2.196 5.836c-2.552 2.5241-5.6901 2.9371-7.8762 2.9201-2.19-.017-5.2261.034-8.1602-2.97-2.938-3.0101-3.436-5.9302-3.436-8.8002 0-2.8701.556-6.6702 4.047-9.5502C7.444.72 9.849 0 12.254 0c10.0422 0 10.7172 9.2602 10.7172 9.2602z' is not a valid selector.
at toArray (gsap-core.js:671:173)
at new Tween (gsap-core.js:3172:128)
at _createTweenType (gsap-core.js:637:10)
at Timeline.to (gsap-core.js:2021:5)

That kinda makes it sound like you're trying to pass that in as the target of the tween instead of the "shape" of the morphSVG. You can't pass in a string of path data as the tween target. 

  • Like 1
GameLord2011
Posted

Yes, that's what I was attempting to do.

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...