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

Multiple color tweens #114

Open
kujohn opened this issue Feb 5, 2017 · 7 comments
Open

Multiple color tweens #114

kujohn opened this issue Feb 5, 2017 · 7 comments
Labels
feature feature request to implement motion motion request
Projects

Comments

@kujohn
Copy link

kujohn commented Feb 5, 2017

Are there anyway to change multiple fill color in one tween such as:

fill: { 'red': 'pink', 'green': 'black', 'yellow': 'orange' }

It does not seem to work. I have to resort to mutiple .then callbacks to accomplish this. Am I doing something wrong?

@legomushroom
Copy link
Member

Hey John!

Unfortunately, it is not possible and you need to rely on the then chains. The problem is that javascript does not give any reliable way to get the order of object keys, thus no order of animation will be preserved.

@kujohn
Copy link
Author

kujohn commented Feb 6, 2017

I see. I have not looked at the source but I am guessing an array doesn't work as a structure?
If there are no major reason why, I could give it a shot and implement it using arrays.

@legomushroom
Copy link
Member

@kujohn sure, could you tell me how do you see the API with arrays?

@kujohn
Copy link
Author

kujohn commented Feb 6, 2017

Something like:

fill: [ '#eee', 'red', 'orange', 'black' ]

@legomushroom
Copy link
Member

@kujohn looks nice 👍, what about easing? or maybe delay/duration?

@kujohn
Copy link
Author

kujohn commented Feb 15, 2017

Yeah, I think if we have an order data type for these, we can introduce order matching for easing/delay/duration with the fill array. Or we can have these metadata inside the object of the fill array. But I am not sure what the direction of mojs is heading. LMK.

@legomushroom
Copy link
Member

My concern is that the ordered items will not be very readable. Maybe some kind of keyframes will do?

const html = new mojs.Html({
  fill: [
    { to: '#eee', easing: 'ease.out' },
    { to: 'red', easing: 'ease.in' },
    { to: 'orange', easing: 'sin.in' },
    { to: 'black', easing: 'quad.out' },
  ]
});

@xavierfoucrier xavierfoucrier added motion motion request feature feature request to implement labels Mar 20, 2019
@xavierfoucrier xavierfoucrier added this to Features in mojs@next Feb 13, 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 motion motion request
Projects
No open projects
mojs@next
Features
Development

No branches or pull requests

3 participants