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

Redefine element.style.transform property #8

Closed
PixelsCommander opened this issue Mar 4, 2015 · 2 comments
Closed

Redefine element.style.transform property #8

PixelsCommander opened this issue Mar 4, 2015 · 2 comments

Comments

@PixelsCommander
Copy link
Owner

We react on style changes via two approaches:

1.Listen to element.style.transform changes.
2.By setting element.styleGL.transform getter / setter

For first case we still move DOM element. Also DOM Mutation Observers are a bit slow;
Second case is not HTML compatible since it introduce styleGL property instead of style.

At the moment I do not know how to overload style.transform or style which is an instance of CSSStyleDeclaration host object in JavaScript

@matthew-dean
Copy link

According to the web, mutation observers would be the only way. But at least you only have to have one observer in the document. http://stackoverflow.com/questions/20364687/mutationobserver-and-current-computed-css-styles

@PixelsCommander
Copy link
Owner Author

Thank you for hint on one observer. Could save some resources.

Mutations observing is basically done, you may try it here http://pixelscommander.com/polygon/htmlgl/demo/basic-webgl.html . The issue is about finding more performant ways of setting transformations since Mutation Observer is something I would not like to execute 60 times per second even if it is faster than Mutation Events. Also there is no way to avoid DOM Element moving when using real style.transform and that was one of aims - do not animate DOM because it is expensive. So there is a backdoor for performance lovers - styleGL.transform property on DOM node which works as getter/setter and is just a direct access to WebGl sprite`s coordinates, rotation and scale.

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

2 participants