question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Centered Rotation

See original GitHub issue

Hi

I am trying to rotate an object on it’s center but cant achieved it. read some info on pivot changing the position but could not figure a way to simply rotate on its center. I am doing this:

var Obj = new PIXI.Graphics();
Obj.beginFill(0x9b59b6);
Obj.drawRoundedRect(0, 0, 100, 100, 15);
Obj.endFill();
Obj.pivot.set(50,50);
Obj.rotation = 3.14159;

But it rotates out of the render, tried Obj.pivot.set(0.5,0.5); like some documentation, but cant get it to keep the position. How is it done?

Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nikolascommented, Aug 15, 2018

@themoonrat I was, but was having some trouble getting it to work how I expect. I’ve solved the issue now though, by putting the rectangle in a Container then pivoting that container. Some of Ivan’s info here was helpful: http://www.html5gamedevs.com/topic/37296-scaling-rectangle-from-center-and-transform-origin/ So I think I’m starting to get it.

0reactions
lock[bot]commented, Aug 15, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable the centered rotation of a Circle using FabricJS?
In this tutorial, we are going to learn how to disable the centered rotation of Circle using FabricJS. Circle is one of the...
Read more >
What is the Center of Rotation? | Study.com
An object's center of rotation is the point about which it is being rotated. An object's center of gravity is the point around...
Read more >
How to find the Centre of Rotation - YouTube
Transformations: Rotations, Enlargements and Reflections ... A second problem is worked through to find the center of rotation using ...
Read more >
How to find the Center of Rotation - YouTube
Short Video - Maths Tricks. How to find the Center of Rotation. 7.9K views 1 year ago. 贝拉数学课堂 BellaMaths. 贝拉数学课堂 BellaMaths.
Read more >
Instant centre of rotation - Wikipedia
The instant center of rotation is the point fixed to a body undergoing planar movement that has zero velocity at a particular instant...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found