Coder Social home page Coder Social logo

Sequence function about leantween HOT 13 OPEN

dentedpixel avatar dentedpixel commented on August 17, 2024
Sequence function

from leantween.

Comments (13)

galacticappster04 avatar galacticappster04 commented on August 17, 2024 15

I really wonder why this library doesn't contain sequencing function. Every developer with sane mind would not even forget it, it will be on the top of their TODO list. Unbelievable, lackluster approach on developing the API.

For example, as suggested here, use onComplete. Here is what my code looks like. It looks like it has been coded by 5 year old, such a mess:

LeanTween .scale (goldCollectedText.gameObject, new Vector3 (1f, 1f, 1f), 0.15f) .setOnComplete (() => { LeanTween .scale(goldCollectedValue.gameObject, new Vector3(1f, 1f, 1f), 0.15f) .setOnComplete(() => { LeanTween .scale(highestGoldCollectedText.gameObject, new Vector3(1f, 1f, 1f), 0.15f) .setOnComplete(()=> { LeanTween .scale(highestGoldCollectedValue.gameObject, new Vector3(1f, 1f, 1f), 0.15f) .setOnComplete(OnGameOverButtonsEnter) .setEase(LeanTweenType.easeOutBounce); }) .setEase(LeanTweenType.easeOutBounce); }) .setEase(LeanTweenType.easeOutBounce); }) .setEase (LeanTweenType.easeOutBounce);

Can't believe I have to write my own sequence method to get this done. Unbelievable. ADD IT! Quickly!

from leantween.

RodrigoLegendre avatar RodrigoLegendre commented on August 17, 2024 5

@neonwarge04 A sequencer is just syntax sugar... So no, @dentedpixel didn't forget it. And no, it shouldn't be the top of his TODO list. And his effort regarding LeanTween is certainly not "lackluster"; it's one of the, if not the API with the best syntax-design and optimization.

If your code looks like that, it's because you've made it like that. Creating your own sequencer for LeanTween is not hard, and even if that was the case, neither is it hard to implement the same thing you did, in a more sane manner, instead of making that mess you've made.

Yes, sequencing functionality would be welcome, but no, it's not something of which the API needs. @dentedpixel is welcome to implement it (or not) at his discretion, but he should have no obligation to do your syntax-sugaring for you.

from leantween.

dentedpixel avatar dentedpixel commented on August 17, 2024 2

I have started a sequencer, please check out the sequencer example scene: GeneralSequencer

Right now it's pretty basic, no ability to play a sequence backwards or anything fancy like that.

Also before releasing I will make sure it's done in a way that doesn't effect garbage collection.

from leantween.

dentedpixel avatar dentedpixel commented on August 17, 2024

Hey Shinriyo,
I wasn't planning on adding this function. I personally prefer to just add delays in order to get a chain of events to run... but I could see where this might be handy.

I was going to look into making sure inline onComplete functions worked, so in a sense if you had those you could setup sequences easily. I think I could build those out with either Lambdas or Anonymous functions... (I have to look into what might work, but just in case you wanted to explore a possible solution as well)

from leantween.

shinriyo avatar shinriyo commented on August 17, 2024

Yes. I know the onComplete function.

I coded the function.
https://gist.github.com/shinriyo/452c9c96ffbfdfc8653e

I can use the sequence like below 👍
float[] xs = new float[] {10, 0, -100};
float[] times = new float[] {0.8f, 0.9f, 1.8f};
LeanTweenSequence.MoveLocalX (enemyTurnMessage.gameObject, xs, times);

I will create the move functions too. 😊

from leantween.

dentedpixel avatar dentedpixel commented on August 17, 2024

Hey Shinriyo,

Very cool, I am trying to think what makes the most sense for coding this type of functionality. I think it might make sense to just add it into the moveLocalX method, so if the user is passing an array of floats it knows to make it a sequence...

This way you could still chain optional parameters on to it as well...

from leantween.

jjhesk avatar jjhesk commented on August 17, 2024

+1

from leantween.

superprat avatar superprat commented on August 17, 2024

Sequencing function would help when trying to apply multiple tweens to the same object from different threads. Struggling with this issue right now. Tried calling LeanTween.cancel on the gameObject but that obviously doesn't finish the execution of the tween.

from leantween.

dentedpixel avatar dentedpixel commented on August 17, 2024

You can call LeanTween.cancel( gameObject, doesComplete) with a doesComplete = yes which will call any onComplete methods on the cancelled tweens. Or were you thinking you would want all the tweens to get to their end positions as well? Let me think about the sequencer feature again, since it seems to be an often requested add on...

from leantween.

superprat avatar superprat commented on August 17, 2024

Yes, was looking to have them get to their end positions as well.

Thinking of building a timeline helper class that would sequence the tweens
for gameobjects

On Sun, 13 Sep 2015 at 23:27 Russell Savage [email protected]
wrote:

You can call LeanTween.cancel( gameObject, doesComplete) with a
doesComplete = yes which will call any onComplete methods on the cancelled
tweens. Or were you thinking you would want all the tweens to get to their
end positions as well? Let me think about the sequencer feature again,
since it seems to be an often requested add on...


Reply to this email directly or view it on GitHub
#25 (comment)
.

from leantween.

dentedpixel avatar dentedpixel commented on August 17, 2024

Ah ok, yeah the LeanTween Visual Editor works a lot like a timeline editor, if you want to give that a shot. Or you could build your own, that would be cool too.

You can do a bit of a sequencer like steps by using the delayedCall method in a manner like:

int delayedId = LeanTween.delayedCall(gameObject, 4f, ()=>{
LeanTween.moveY(gameObject, 2f, 3f).setFrom(1f));
LeanTween.scaleX(gameObject, 0f, 1f).setDelay(3f).setFrom(2f);
}).setRepeat(3).setOnCompleteOnStart(true);

// has that sequence of moveY and scaleX repeat 3 times

from leantween.

superprat avatar superprat commented on August 17, 2024

I meant a Timeline editor to manage sequential tweens kind of like the greensock Timeline Library(http://greensock.com/timelinemax) it manages the sequence of tweens and their execution.

The problem I'm facing right now is that once a tween starts executing and external input adds another tween to the same gameObject, There's no way for me to sequence that on top of the previous tween. If the LeanTween.cancel( gameObject, doesComplete) would complete the running tween it would solve the problem.

But I think long term it would benefit a lot from having a sequencer and the flexibility to manage those things.

from leantween.

TurkerTunali avatar TurkerTunali commented on August 17, 2024

Thank you for your efforts.

from leantween.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.