SVG mutltiple transform - rotate then translate horizontally The Next CEO of Stack OverflowActivity restart on rotation AndroidHow do I apply multiple rotation transforms on a Raphael text object?Webkit Transformations, Translate after rotationImplementing SVG scale/rotate transformations (and how to understand the coordinate system)Rotate (svg, css) around an arbitrary point, without transform-originconfusion calculating x/y coordinates based on rotation angle with D3 + svg transformationApply transformation to result of previous transformation on SVG pathMoving an SVG element after rotationSVG Translate Group positioning on window resize with d3SVG viewBox: Exact order of translation and scaling
What difference does it make matching a word with/without a trailing whitespace?
logical reads on global temp table, but not on session-level temp table
Can a PhD from a non-TU9 German university become a professor in a TU9 university?
How dangerous is XSS
Are British MPs missing the point, with these 'Indicative Votes'?
Is it possible to make a 9x9 table fit within the default margins?
Find a path from s to t using as few red nodes as possible
Is it possible to create a QR code using text?
Calculating discount not working
What are the unusually-enlarged wing sections on this P-38 Lightning?
Creating a script with console commands
Direct Implications Between USA and UK in Event of No-Deal Brexit
The sum of any ten consecutive numbers from a fibonacci sequence is divisible by 11
How does a dynamic QR code work?
Is it reasonable to ask other researchers to send me their previous grant applications?
Masking layers by a vector polygon layer in QGIS
How to unfasten electrical subpanel attached with ramset
How can a day be of 24 hours?
Read/write a pipe-delimited file line by line with some simple text manipulation
MT "will strike" & LXX "will watch carefully" (Gen 3:15)?
How can I prove that a state of equilibrium is unstable?
Horror film about a man brought out of cryogenic suspension without a soul, around 1990
Is a distribution that is normal, but highly skewed, considered Gaussian?
Incomplete cube
SVG mutltiple transform - rotate then translate horizontally
The Next CEO of Stack OverflowActivity restart on rotation AndroidHow do I apply multiple rotation transforms on a Raphael text object?Webkit Transformations, Translate after rotationImplementing SVG scale/rotate transformations (and how to understand the coordinate system)Rotate (svg, css) around an arbitrary point, without transform-originconfusion calculating x/y coordinates based on rotation angle with D3 + svg transformationApply transformation to result of previous transformation on SVG pathMoving an SVG element after rotationSVG Translate Group positioning on window resize with d3SVG viewBox: Exact order of translation and scaling
Using an SVG I am trying to rotate it by 30 degrees and then translate that horizontally 100. The issue is that when I rotate the coordinate system, it is rotated and so when I try to translate I will be translating the object along the rotated x-axis which is now at 30 degrees to the horizontal.
Is there any way to translate horizontally after rotation?
<g transform="rotate(30 50 50) translate(100 0)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
I want to create control buttons for rotate and translate up, down, left, right. These will create a string which will use data binding to the transform property of the svg and so transform the object sequentially. But the translations need to be relative to the viewport not how the object has been rotated.
I am using the vue.js framework for the data binding.
I also do not want to use css.
Thanks,
svg rotation transform translate
add a comment |
Using an SVG I am trying to rotate it by 30 degrees and then translate that horizontally 100. The issue is that when I rotate the coordinate system, it is rotated and so when I try to translate I will be translating the object along the rotated x-axis which is now at 30 degrees to the horizontal.
Is there any way to translate horizontally after rotation?
<g transform="rotate(30 50 50) translate(100 0)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
I want to create control buttons for rotate and translate up, down, left, right. These will create a string which will use data binding to the transform property of the svg and so transform the object sequentially. But the translations need to be relative to the viewport not how the object has been rotated.
I am using the vue.js framework for the data binding.
I also do not want to use css.
Thanks,
svg rotation transform translate
2
Translate first then rotate
– Robert Longson
Mar 8 at 19:32
Yes I think that will work, just gather up all the translation to get a total translation and then a total rotation and then a total scale and then apply those transforms in that order. Also I need to keep track of the centre of the object so that it always rotates about its centre. Thanks for your help
– Shane G
Mar 8 at 19:59
add a comment |
Using an SVG I am trying to rotate it by 30 degrees and then translate that horizontally 100. The issue is that when I rotate the coordinate system, it is rotated and so when I try to translate I will be translating the object along the rotated x-axis which is now at 30 degrees to the horizontal.
Is there any way to translate horizontally after rotation?
<g transform="rotate(30 50 50) translate(100 0)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
I want to create control buttons for rotate and translate up, down, left, right. These will create a string which will use data binding to the transform property of the svg and so transform the object sequentially. But the translations need to be relative to the viewport not how the object has been rotated.
I am using the vue.js framework for the data binding.
I also do not want to use css.
Thanks,
svg rotation transform translate
Using an SVG I am trying to rotate it by 30 degrees and then translate that horizontally 100. The issue is that when I rotate the coordinate system, it is rotated and so when I try to translate I will be translating the object along the rotated x-axis which is now at 30 degrees to the horizontal.
Is there any way to translate horizontally after rotation?
<g transform="rotate(30 50 50) translate(100 0)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
I want to create control buttons for rotate and translate up, down, left, right. These will create a string which will use data binding to the transform property of the svg and so transform the object sequentially. But the translations need to be relative to the viewport not how the object has been rotated.
I am using the vue.js framework for the data binding.
I also do not want to use css.
Thanks,
svg rotation transform translate
svg rotation transform translate
asked Mar 8 at 19:13
Shane GShane G
98911740
98911740
2
Translate first then rotate
– Robert Longson
Mar 8 at 19:32
Yes I think that will work, just gather up all the translation to get a total translation and then a total rotation and then a total scale and then apply those transforms in that order. Also I need to keep track of the centre of the object so that it always rotates about its centre. Thanks for your help
– Shane G
Mar 8 at 19:59
add a comment |
2
Translate first then rotate
– Robert Longson
Mar 8 at 19:32
Yes I think that will work, just gather up all the translation to get a total translation and then a total rotation and then a total scale and then apply those transforms in that order. Also I need to keep track of the centre of the object so that it always rotates about its centre. Thanks for your help
– Shane G
Mar 8 at 19:59
2
2
Translate first then rotate
– Robert Longson
Mar 8 at 19:32
Translate first then rotate
– Robert Longson
Mar 8 at 19:32
Yes I think that will work, just gather up all the translation to get a total translation and then a total rotation and then a total scale and then apply those transforms in that order. Also I need to keep track of the centre of the object so that it always rotates about its centre. Thanks for your help
– Shane G
Mar 8 at 19:59
Yes I think that will work, just gather up all the translation to get a total translation and then a total rotation and then a total scale and then apply those transforms in that order. Also I need to keep track of the centre of the object so that it always rotates about its centre. Thanks for your help
– Shane G
Mar 8 at 19:59
add a comment |
1 Answer
1
active
oldest
votes
If you want the rotate to happen first, you have to put that last in your transform attribute.
<g transform="translate(100 0) rotate(30 50 50)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
Why? Because the above snippet is equivalent to
<g transform="translate(100 0)">
<g transform="rotate(30 50 50)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
</g>
You can think of transforms as happening from the inside out. The rectangle is affected by the inner rotate transform before the outer translate transform.
Or to think of it another way, the outer transform creates a new coordinate system that is shifted 100 to the right. Within that there is a separate coordinate system that is rotated 30 degrees. Into that the rectangle is drawn.
add a comment |
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55069586%2fsvg-mutltiple-transform-rotate-then-translate-horizontally%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you want the rotate to happen first, you have to put that last in your transform attribute.
<g transform="translate(100 0) rotate(30 50 50)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
Why? Because the above snippet is equivalent to
<g transform="translate(100 0)">
<g transform="rotate(30 50 50)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
</g>
You can think of transforms as happening from the inside out. The rectangle is affected by the inner rotate transform before the outer translate transform.
Or to think of it another way, the outer transform creates a new coordinate system that is shifted 100 to the right. Within that there is a separate coordinate system that is rotated 30 degrees. Into that the rectangle is drawn.
add a comment |
If you want the rotate to happen first, you have to put that last in your transform attribute.
<g transform="translate(100 0) rotate(30 50 50)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
Why? Because the above snippet is equivalent to
<g transform="translate(100 0)">
<g transform="rotate(30 50 50)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
</g>
You can think of transforms as happening from the inside out. The rectangle is affected by the inner rotate transform before the outer translate transform.
Or to think of it another way, the outer transform creates a new coordinate system that is shifted 100 to the right. Within that there is a separate coordinate system that is rotated 30 degrees. Into that the rectangle is drawn.
add a comment |
If you want the rotate to happen first, you have to put that last in your transform attribute.
<g transform="translate(100 0) rotate(30 50 50)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
Why? Because the above snippet is equivalent to
<g transform="translate(100 0)">
<g transform="rotate(30 50 50)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
</g>
You can think of transforms as happening from the inside out. The rectangle is affected by the inner rotate transform before the outer translate transform.
Or to think of it another way, the outer transform creates a new coordinate system that is shifted 100 to the right. Within that there is a separate coordinate system that is rotated 30 degrees. Into that the rectangle is drawn.
If you want the rotate to happen first, you have to put that last in your transform attribute.
<g transform="translate(100 0) rotate(30 50 50)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
Why? Because the above snippet is equivalent to
<g transform="translate(100 0)">
<g transform="rotate(30 50 50)">
<rect x="0" y="0" fill="blue" width="100" height="100" />
</g>
</g>
You can think of transforms as happening from the inside out. The rectangle is affected by the inner rotate transform before the outer translate transform.
Or to think of it another way, the outer transform creates a new coordinate system that is shifted 100 to the right. Within that there is a separate coordinate system that is rotated 30 degrees. Into that the rectangle is drawn.
answered Mar 9 at 21:41
Paul LeBeauPaul LeBeau
57.6k56896
57.6k56896
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55069586%2fsvg-mutltiple-transform-rotate-then-translate-horizontally%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown

2
Translate first then rotate
– Robert Longson
Mar 8 at 19:32
Yes I think that will work, just gather up all the translation to get a total translation and then a total rotation and then a total scale and then apply those transforms in that order. Also I need to keep track of the centre of the object so that it always rotates about its centre. Thanks for your help
– Shane G
Mar 8 at 19:59