Jump to content
Search Community

Large Illustrator Infographic to SVG to Animation

Hugh Nivers 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

Hi,

 

First post here so sorry if I'm asking something that has been answered, but I did a search and didn't find what I needed.

 

Here's my project and what I'd like to do:

 

  1. Create a large infographic with lots of groups in Illustrator. 
  2. Export the large infographic as ONE large SVG.
  3. Copy the inline SVG code and paste it into the body of an HTML page.
  4. Animate the individual elements of the ONE large SVG.

 

I've attached a JPG of an example infographic. It contains ten sections. I'd like to be able to access individual SVG elements (e.g. <rect>, <g>, etc.) in each section and animate them using Greensock.

 

Also, I attached a Codepen with a much simpler SVG with only two sections. I have tried to simply move the white rectangle in the top section but have been unable to. I set the id of the white rectangle to "logo." I'm just using the simple code from the first Jump Start tutorial.

 

I'd like to be able to animate each of these elements on hover, clicking, etc. For example, in the codepen, I'd like to be able to rotate the wheel by clicking the "click me" button.

 

Thanks.

infographic.jpg

See the Pen VxbYva by hughnivers (@hughnivers) on CodePen

Link to comment
Share on other sites

HI @Hugh Nivers :)

 

Welcome to the forum. 

 

In addition to @Carl's excellent advice, I'll throw out a bit of info for you. There is some crossover between CSS properties and SVG attributes. These two lines will produce very different results in your SVG:

 

TweenLite.to("#logo", 1, { x:600 });
TweenLite.to("#logo", 1, { attr:{x:600} });

 

If you're after those SVG attributes, you'd want to wrap them like above and use the attribute plugin (which is automatically included with TweenMax).

 

You mentioned clicking the button to tween the wheel so I added that to my fork for you.

See the Pen aGWdmo by PointC (@PointC) on CodePen

Hopefully that gets you started. Happy tweening and welcome aboard.

:)

 

  • Like 4
Link to comment
Share on other sites

Thank you Carl. That was easy. :)

 

 If I want to make it so the white rectangle scale on hover in the Y dimension only, I'll need to transform the origin to the bottom center of the rectangle. I did this before with CSS about a year ago and then it broke. Code rot? How would I do that as a transform or is there another/better way? Thx.

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