Jump to content
Search Community

Confetti With Greensock

celli 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, I am trying to create a confetti effect similar to what we see done with canvas in the codePen. There's got to be an easier way then how I've been going about it with staggering and repeating to achieve this effect -- Can someone help with a confetti effect using greensock ?

See the Pen OPMqPV by celli (@celli) on CodePen

  • Like 1
Link to comment
Share on other sites

Hi celli  :)

 

Surely you have better performance with canvas for this type of particle effect , and you can use GSAP engine for Canvas Update/Draw loop :

 

for example :

TweenLite.to(rect, 1.5, {x:100, y:200, onUpdate:draw});

or

TweenLite.ticker.addEventListener("tick", draw);

or use GSAP great plugins for canvas animation frameworksEasel Kinetic Raphael ) .

 

but you can have almost same effect ( less count particles due devices/browsers render limitation ) with SVG or DOM based particles ; pls check these links :

 

simple div particles :

 

See the Pen wBGvgW by MAW (@MAW) on CodePen

 

simple svg particles :

 

See the Pen pvyoQL by MAW (@MAW) on CodePen

  • Like 3
Link to comment
Share on other sites

Hi,

 

You could use Pixi which is a WebGL rendering engine with a canvas fallback, is super fast and you can tap GSAP into it with no trouble at all to have better control over animations. Also Pixi has the spriteBatch class, which is designed to hold a huge amount of elements:

 

http://www.pixijs.com/

 

http://www.goodboydigital.com/webgl-spritebatching-arrives/

 

Basically you could create a loop to add the elements to the stage and give them a random color and finally animate their vertical position and opacity as they and the horizontal position based on the mouse position.

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

Hi Diaco.AW,

 

When using the 

See the Pen MYywaw by MAW (@MAW) on CodePen

 I notice that the first time it runs it drops the confetti in one shot -- and then you need to wait until they all fall before the next set of confetti starts and they start to appear to loop seamlessly. Is there any way to override that first sequence, and just get into the looping of the dots ? Maybe with a negative delay or something ?

Link to comment
Share on other sites

  • 9 months later...

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