Jump to content
Search Community

How to create a pizza chart

rscarpim 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

Yeah, if you have some demo you like, we can point you in the right direction of how to animate it. A lot depends on what you're creating. Will the pieces be dynamically generated or will you be creating a simple SVG chart? What will the wedges need to do, etc. GSAP can certainly handle all the animation whether you use DOM, SVG, canvas, WebGl. 

 

Good luck with your search.

:)

 

  • Like 1
Link to comment
Share on other sites

Hey Pointc.

 

My idea is create a <img> inside a wrapper and animate the pizza, so it's a DOM animation.

So probably it's kind of "static" content.

 

I had an example to animate bars. 

 

        var timeline = new TimelineLite({ paused: true }),
            $chart  = $('.su__comp-chart'),
            $x_axis = $chart.find('.su__chart-x-axis'),
            $y_axis = $chart.find('.su__chart-y-axis'),
            $axis_labels = $('.su__chart-axis-label'),
            $bar_1  = $('#su__chart-bar-1'),
            $bar_2  = $('#su__chart-bar-2');

        timeline

            .staggerFrom($axis_labels, 0.5, { opacity: 0 }, 0.1)
            .add([
                TweenLite.fromTo($bar_1, 2, { height: '1%' }, { height: '56%' }),
                TweenLite.fromTo($bar_2, 2, { height: '1%' }, { height: '54%' })
            ]);

And them play.

 

timeline.play();
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...