Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Lasercode

Particles - or "How to assign different start/end values for each class element dynamically"

Go to solution Solved by Carl,

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

Hey there,

Title says it. I know I read it somewhere some day... But I cant find what I search, so sorry to open a potential duplicate thread :/

Let's say I got a for loop creating 80 elements, as particles. 

Now I want them all to have the same starting point, but different end positions/speeds via Math.random() or so.
After the "explosion", I would like to move the particles again for some pixels in Z direction, after a break.

So: I like to have an explosion, then particles slow down and freeze, then animate again randomly, freeze again, and repeat - always with random positions.

Could someone tell be the best dynamic approach with GSAP? I dont know how to handle this right..
And sorry that I can't provide a codepen, it would just be chaos ;)
Thanks!

 

Link to comment
Share on other sites

  • Solution

Nice demo, Shaun.

 

Just a little tip. When using function-based values the function is called for each target in the tween which means you don't need an each() loop.

Check it out: http://codepen.io/GreenSock/pen/peEqKm

  • Like 4
Link to comment
Share on other sites

Just a little tip. When using function-based values the function is called for each target in the tween which means you don't need an each() loop.

Check it out: 

See the Pen peEqKm by GreenSock (@GreenSock) on CodePen

 

Yes, of course! Aye, not sure what I was thinking there :) 

  • Like 3
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.
×