Jump to content

Hugh Nivers

  • Posts

  • Joined

  • Last visited

Posts posted by Hugh Nivers

  1. 6 minutes ago, GreenSock said:

    Yep, @PointC and @Carl are right, of course. Also, one minor note: you're linking to the "/latest/" CDN directory which (strangely) is way out of date because CDNJS refused to support it years ago. So I'd recommend linking to /1.20.4/ (the actual latest version) :)


    Thanks. What's the easiest way to get to the best version? I'm just typing in TweenMax and accepting what CodePen gives me. 

  2. 2 minutes ago, Carl said:

    Yup, PointC is exactly right. To see if animations worked I just got rid of the unnecessary code (eventlistener and circles) and put in a to() tween for the bars.

    You should be good to go.


    See the Pen NMyYry?editors=1010 by GreenSock (@GreenSock) on CodePen

    Thank you for taking the time to demonstrate the animation. That helps. I appreciate it.



  3. 2 minutes ago, PointC said:

    You have an error in your code. You've added a listener to the bar0 element, but the go() function doesn't exist.


    bar0.addEventListener("mouseover", go);


    Other than that, your selectors are fine and the SVG elements should animate correctly. You could also target the elements like this:


    TweenMax.set("#bars rect", {transformOrigin:"center bottom", scaleY: 0.01});


    Happy tweening.




    Thanks. I didn't realize that not having the function yet would break everything else. I commented it out and everything worked. Thanks for the pointer on targeting. 

  4. I go to the Greensock Docs and find a piece of code like this:


    TweenMax.set([obj1, obj2, obj3], {x:100, y:50, opacity:0});


    I then take it over to my CodePen and use it as described, changing the properties I want to animate. It then doesn't work.  Nowhere in that section of the doc does it talk about exceptions for SVGs. Is there a difference? What am I missing?

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

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

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




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