Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexing on Tween constructor with stagger #99

Open
gaou-piou opened this issue Jan 17, 2017 · 3 comments
Open

Indexing on Tween constructor with stagger #99

gaou-piou opened this issue Jan 17, 2017 · 3 comments
Labels
feature feature request to implement help need help, any contribution are welcome
Projects

Comments

@gaou-piou
Copy link

gaou-piou commented Jan 17, 2017

Can we have indexing when we use Tween cunstructor with stagger?
I will try to explain it better with code

const Stagger = mojs.stagger( mojs.Tween );

const tween = new Stagger({
    duration: 350,
    quantifier: 4,
    delay: 'stagger(0.5)',
    onUpdate: (ep, index) => {
        console.log("tween no " + index + ": " + ep[index]);
    }
})

and this will return


tween no 0: 0
tween no 1: 0.5
tween no 2: 1
tween no 3: 1.5
@legomushroom
Copy link
Member

Hi @gaou-piou!

You can get index by referring the this._index property of the tween. But this means that you can not use the arrow functions over there because you need the context of the function call.

There is demo for you - demo

I will mark it as enhancement because passing the index property to the callback is a great idea.
Please let me know.

Cheers

@legomushroom legomushroom added the feature feature request to implement label Jan 17, 2017
@legomushroom legomushroom self-assigned this Jan 17, 2017
@gaou-piou
Copy link
Author

Beautiful.
Thank you

@legomushroom
Copy link
Member

@gaou-piou happy to help, please let me know if something

@legomushroom legomushroom added beginner-friendly help need help, any contribution are welcome labels Jan 18, 2017
@legomushroom legomushroom added this to the Next release milestone Jan 18, 2017
@xavierfoucrier xavierfoucrier changed the title indexing on Tween cunstructor with stagger Indexing on Tween constructor with stagger Mar 20, 2019
@xavierfoucrier xavierfoucrier added this to Features in mojs@next Feb 13, 2020
@xavierfoucrier xavierfoucrier removed this from the @mojs/core v1.0.0 milestone Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature feature request to implement help need help, any contribution are welcome
Projects
No open projects
mojs@next
Features
Development

No branches or pull requests

3 participants