Jump to content
Search Community

Maybe add a new type of offset?

pragdave test
Moderator Tag

Recommended Posts

I'm animating simulations, and so I often have to kick things when events occur, and while other things are happening.

 

Imagine, for example, I add boxes to a conveyor belt as they arrive. I have a timeline for boxes on the belt, and I want to add the new box and start it's animation _now_. I'm probably missing something, but the way I currently do it is

 

tl.to(box, { ... }, tl.time())

I was thinking: is there any demand for adding a "=" offset, analogous to < and >, which means "now". "=2" would be 2 seconds from now, etc.

 

(And I bet there's already a way to do this that I haven't noticed. Apologies if so)

 

Dave

 

Link to comment
Share on other sites

56 minutes ago, pragdave said:

Imagine, for example, I add boxes to a conveyor belt as they arrive. I have a timeline for boxes on the belt, and I want to add the new box and start it's animation _now_.

 

Do you even need a timeline for something like that? I mean, if I want something to start now, I probably wouldn't bother with inserting an animation on a timeline that is already running. I would just create a separate animation for the box. But maybe you're doing more with the timeline than what you've described. ?‍♂️

 

56 minutes ago, pragdave said:

I was thinking: is there any demand for adding a "=" offset

 

I think this is the first time I've seen someone ask for something like that.

 

56 minutes ago, pragdave said:

(And I bet there's already a way to do this that I haven't noticed. Apologies if so)

 

Not that I can think of. I think your solution is perfectly fine.

 

  • Like 2
Link to comment
Share on other sites

9 minutes ago, OSUblake said:

 

Do you even need a timeline for something like that? I mean, if I want something to start now, I probably wouldn't bother with inserting an animation on a timeline that is already running. I would just create a separate animation for the box. But maybe you're doing more with the timeline than what you've described. ?‍♂️

 

 

If the conveyor stops, for example, then all the boxes on it should stop. Right now, I just pause the timeline. If they were all separate, then I'd need to keep track of them. It's not a major issue, but at the same time it seems like a fairly trivial change :)

Link to comment
Share on other sites

8 minutes ago, pragdave said:

If the conveyor stops, for example, then all the boxes on it should stop. Right now, I just pause the timeline. If they were all separate, then I'd need to keep track of them.

 

Oh, I see.

 

8 minutes ago, pragdave said:

It's not a major issue, but at the same time it seems like a fairly trivial change :)

 

@GreenSock would have to weigh in on that.

Link to comment
Share on other sites

Yep, your solution is exactly what I'd do (use tl.time()). As for adding a special character to swap in for that, I'll keep it in mind and if there's enough demand I'll definitely consider it but for now it doesn't seem like it's worth the added API surface area and kb (not that it'd cost a lot...but like Blake, I haven't heard anyone express a need/desire for this in the past). Is your main goal to just do less typing? "=" instead of tl.time()? 

  • Like 1
Link to comment
Share on other sites

I think my main goal is to make the code a little bit more expressive. < and > are really nice visually, and make the timelines easy to reason about. tl.time() isn't rocket science, but it does break the flow just a little.

 

The strange thing is that I'm finding myself having to use this all over the place. My use case is an animation tracks a queuing system, with randomly distributed arrival rates, a limited buffer, and one or more servers that read from the queue. There's no one fixed overall timeline, because what happens isn't predetermined. In that environment, I'm totally event driven, and when an event occurs, I need to kick off the corresponding animation exactly at that time. I'm seriously impressed that GSAP can rock and roll like that. It just occurred to be that, in my particular case, the= notation would express my intent better.

 

Thanks for a great product

 

 

Dave

  • Thanks 1
Link to comment
Share on other sites

11 minutes ago, pragdave said:

My use case is an animation tracks a queuing system, with randomly distributed arrival rates, a limited buffer, and one or more servers that read from the queue. There's no one fixed overall timeline, because what happens isn't predetermined.

Sounds like an edge case to me ;) 

Link to comment
Share on other sites

1 hour ago, pragdave said:

I'm seriously impressed that GSAP can rock and roll like that. It just occurred to be that, in my particular case, the= notation would express my intent better. Thanks for a great product

Thanks for the kind words and for giving us a little more context. Yeah, I'll certainly keep this in mind as a potential feature if we sense there's enough demand for it in the future. ?

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