Comments (5)
@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 theplay
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.
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 Tween
s, 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.
@Jeremboo, nice transition and colors btw, love it!
from mojs.
@Jeremboo oops, the first demo link was wrong. Updated to the right one.
from mojs.
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
likemyTm.restart()
ormyTm.stop().play()
or againmyTM.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)
- GPR publication workflow failure HOT 2
- Not working on IE HOT 2
- then() method is firing error "TypeError: Cannot read property '4' of null" HOT 9
- 可以为mojs添加一个removeShape的功能吗 HOT 3
- Improve the way custom shapes are instantiated HOT 4
- Unable to import in "modules" mode HOT 3
- The file imported by cdn reports an error(a native html page) HOT 2
- Como corrigir o erro/How to fix the error: Uncaught TypeError: Cannot read properties of null (reading 'appendChild') HOT 1
- Offset on click animations HOT 3
- Frame-by-frame animation HOT 6
- Independent delta not working in .then HOT 4
- Move Shape To Absolute Position HOT 1
- Document How to Add `pointer-events: none` To Shape/Timeline HOT 2
- @mojs/core not working with remix.run > ReferenceError: self is not defined HOT 1
- Mo.js support for typescript HOT 1
- Upgrade to NodeJS 20 HOT 5
- Showcase code is not working HOT 3
- The `dist` folder is missing in the npm package for `v1.7.0` HOT 1
- Tween has chance to be played 2 times rapidly in a timeline. HOT 3
- Path Easing Debugging
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mojs.