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

Is it possible to use the transform function with a gradient? #43

Closed
gnomathibus opened this issue May 26, 2013 · 11 comments
Closed

Is it possible to use the transform function with a gradient? #43

gnomathibus opened this issue May 26, 2013 · 11 comments

Comments

@gnomathibus
Copy link

eg gradient.transform ('Matrix', '0 .5261727,0,0,0.7582733, -9.5647863,5.1185895 ') it does not work

@wout
Copy link
Member

wout commented May 27, 2013

You'll have to use the gradientTransform attribute:

gradient.attr('gradientTransform', 'skewX(30)')

I fiddled something here so you can test it yourself:
http://jsfiddle.net/wout/KpYZy/1/

@gnomathibus
Copy link
Author

Thank you for that answer, what is the correct syntax with the matrix? I tried with :

"gradient.attr('gradientTransform','matrix(0.79545714,-0.70713416,0.51685009,0.58140605,-3.2162008,-48.602235)')" but it does not work

@wout
Copy link
Member

wout commented May 27, 2013

That should be the right syntax. I'm not quite sure on SVG support on matrix transformations applied to gradients. At first sight they don't work in Chrome but I didn't go really deep into it.

@gnomathibus
Copy link
Author

I have a svg file where there are gradients with matrix

@wout
Copy link
Member

wout commented May 27, 2013

Is it working in the browser as well? Can you send it so I can have a look? Maybe that would explain a little bit more.

@gnomathibus
Copy link
Author

my svg file with "gradientTransform =" matrix "

http://jsfiddle.net/WRnX8/

@wout
Copy link
Member

wout commented May 27, 2013

Ah, ok, I see now. You should set the gradientUnits to:

gradient.attr('gradientUnits', 'userSpaceOnUse')

@gnomathibus
Copy link
Author

I add gradient.attr ('gradientUnits', 'userSpaceOnUse') but it does not work

@wout
Copy link
Member

wout commented May 27, 2013

It does here: http://jsfiddle.net/wout/KpYZy/9/

@gnomathibus
Copy link
Author

I found my mistake I forgot it;
gradient.attr ('cx', '68 .138 ')
gradient.attr ('cy', '29 .869 ')
gradient.attr ('r', '33 .934 ')
and thank you again

@wout
Copy link
Member

wout commented May 27, 2013

No problem.

@wout wout closed this as completed May 27, 2013
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