Giter Club home page Giter Club logo

Comments (5)

legomushroom avatar legomushroom commented on April 28, 2024 1

@Jeremboo hi, sorry for the long reply.

  • I have completely rewritten the tweening engine, so it now has the onRepeatComplete callback out of the box.
  • You can restart the timeline with replay method.
  • To start the timeline with a time shift, just pass the time (milliseconds) to the play method:
   var tween = new mojs.Tween;
   tween.play(  2000 ); // 2 seconds in ms
  • Or alternitelely you can do:
     var tween = new mojs.Tween;
     tween.setProgress( 0.5 ).play(); // 2 seconds in ms

Please refer to the Tween API for more info.
New mojs link on CDN: https://cdn.jsdelivr.net/mojs/0.265.6/mo.min.js

from mojs.

legomushroom avatar legomushroom commented on April 28, 2024

Hey @Jeremboo!

Sorry for the delay and thanks for the issue.

You are right. Tween should have both onComplete and onRepeatComplete callbacks, so there is a lack of the later right now. I can consider a PR if you want to submit one, not sure if you do because tween internal logic could be complex to start with. Anyways please let me know if you are planning to make one and have any questions.

Re: current affairs
You can add each tween to Timeline. If you will do so, Timeline will be capable of repeating Tweens, thus their onComplete callbacks will fire on each loop.
Demo.

There is one bug which I will fix shortly - callback can fire few times in this scenario.

If you want another tween to run after your scale one, you can make a Timeline inside startMo function, add the current tween and then append another tween to the inner Timeline. After that add the inner timeline to the outer timeline which would be capable of controlling all the nested timelines and tweens.
Demo.

Thanks a lot!

from mojs.

legomushroom avatar legomushroom commented on April 28, 2024

@Jeremboo, nice transition and colors btw, love it!

from mojs.

legomushroom avatar legomushroom commented on April 28, 2024

@Jeremboo oops, the first demo link was wrong. Updated to the right one.

from mojs.

Jeremboo avatar Jeremboo commented on April 28, 2024

Hi @legomushroom !

Thank you for your precise and reactive response ! Sorry by the way I could not keep up with your answers…

For the onRepeatComplete callback, indeed I am not sure to be the best to make a PR. I prefer to leave it to another guru ;)

And, when I checked your demos and tried to understand the Timeline uses, I found this approach very playful !

I created another Demo with what you showed me. There are two Timelines into one and the loop works.

But when my mainTimeline is played for a second time, between my two inner timelines, the scale is initialized. I don’t know if it is an error in my code or not, because the first time this does not happen...

Another issues about Timeline :

  • Can I restart manually a Timeline like myTm.restart() or myTm.stop().play() or again myTM.play(0) ?
  • Can I start my timeline at a given time like myTm.play(2) ?

Because on my first Demo ( become a pile of spaghetti ) I have used Visus.js also and I would like to chain both. ( Please do not check my code I must rewrite it now with Timeline ! ).

Thank you again for the time you have spent for answering me !

from mojs.

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.