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

Any way for translate SVG elemements - on IE ? #18

Closed
Oguima opened this issue Dec 1, 2015 · 12 comments
Closed

Any way for translate SVG elemements - on IE ? #18

Oguima opened this issue Dec 1, 2015 · 12 comments

Comments

@Oguima
Copy link

Oguima commented Dec 1, 2015

SVG inline elements, cam be tranlated ...
Works fine in: Chrome, Firefox and Safari ...

IE - not transform SVG elements.

Exemple:
http://codepen.io/Oguima/pen/XmvVqQ

@legomushroom
Copy link
Member

Hey @Oguima !

You mean transform with CSS or JS?
SVG has numerous issues with transforms defined in CSS.
Setting transform directly on element with transform attribute should work everywhere though:

<g id="termometro" transform="translate(0, -70px)">

Thanks

@Oguima
Copy link
Author

Oguima commented Dec 1, 2015

Testing ... Now :D Thanks

@Oguima
Copy link
Author

Oguima commented Dec 1, 2015

I try:
//termometro.style['transform'] = 'translate(0 ,' + -70 + 'px)'; //Ok firefox, safari, chrome... not IE
termometro.setAttribute("transform", 'translate(0, ' + -70*progress + 'px)');

Error: Invalid value for attribute transform="translate(0, -70px)"

@legomushroom
Copy link
Member

@Oguima surely. remove pixels:

termometro.setAttribute("transform", 'translate(0, ' + (-70*progress) + ')');

@Oguima
Copy link
Author

Oguima commented Dec 1, 2015

Good news for me, work :D.
I have problens with transitions ...
transition: all 1s;
or
transition: transform 1s;
Via CSS, no work. (For SVG elements)

Via mojs, work, partial. I need more tests for this.
Removed transition ... i try to go to 0 transform ...
Whow to transform to (0,0) ?

 new mojs.Tween({
            repeat:   1,
            delay:    0,
            duration: 2000,
            onUpdate: function (progress) {
                termometro.setAttribute("transform", 'translate(0, ' + 1*progress + ')');
            }
        }).run();

@legomushroom
Copy link
Member

termometro.setAttribute("transform", 'translate(0, ' + 70*(1-progress) + ')');

@Oguima
Copy link
Author

Oguima commented Dec 1, 2015

Works... but 2 times ?!? ...
I removed repeat: 1 ... And Works Fine , thanks

termometro.setAttribute("transform", 'translate(0, ' + -70*(1-progress) + ')');

@legomushroom
Copy link
Member

@Oguima exactly. You have 1 repeat loop, so it will run 2 times.

@Oguima
Copy link
Author

Oguima commented Dec 1, 2015

I try with WAAPI, and not work ... with SVG. works fine with divs ...
mojs , works fine with SVG NOW :D

achievement unlocked:

  • SVG transform: translate on IE

Thanks

@legomushroom
Copy link
Member

np

@Oguima
Copy link
Author

Oguima commented Dec 1, 2015

Sample Works Fine: Click on termometer, UP and Down - works on IE.

  • SVG transform: tranlate on IE - With: mojs

http://codepen.io/Oguima/pen/WreNVR

@legomushroom
Copy link
Member

yay!

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