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

[Feature Request] Set and Read properties #208

Closed
TomS- opened this issue Jul 20, 2017 · 2 comments
Closed

[Feature Request] Set and Read properties #208

TomS- opened this issue Jul 20, 2017 · 2 comments

Comments

@TomS-
Copy link

TomS- commented Jul 20, 2017

AnimeJS is amazing, however for this current project I need to set transform properties without animating them. I can do this using javascript however it becomes problematic when I need to set TranslateX, TranslateY and Scale.

duration: 0 doesn't work, I was wondering if anime.set() function could be made available and maybe anime.css() to read a value.

I am making a drag and drop module for a website, something that I would like to use the power of AnimeJS for.

something like

anime.set({
    targets: ".block",
    translateX: current.x + (e.clientX + mouse.x),
    translateY: current.y + (e.clientY + mouse.y),
    scale: anime.css(".block", "scale")
});

or

anime({
    targets: ".block",
    translateX: current.x + (e.clientX + mouse.x),
    translateY: current.y + (e.clientY + mouse.y),
    scale: anime.css(".block", "scale"),
    duration: 0
});
@glomotion
Copy link

glomotion commented Sep 6, 2017

+1!
I'm just now also trying to do something similar - and the only way it works is to use a tiny duration, like 1ms.
eg:

anime({
    targets: els,
    translateX: 300,
    duration: 1
});

It would kinda be nice to be able to use a simple set method.

I'd also just as happily do: el.style.transform = "translate(300px,0)" - but the second you do that, anime stops working properly with future transform animations.

@juliangarnier
Copy link
Owner

duration: 0 and seek(0) will be fixed in the next release.
Related #177, #228

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants