Tyr0
Tyr0

Reputation: 70

Rotate an image around a specific point

Is it possible to rotate an image around a specific point, rather than the center? I see options for RVG's, but not for Magick::Image's :/

http://www.simplesystems.org/RMagick/doc/rvgxform.html#rotate <- RVG pivot point

Upvotes: 1

Views: 416

Answers (2)

Nine Magics
Nine Magics

Reputation: 737

angle -= angleSpeed * delta;
image.x = target.x + sin(angle) * distanceFromTarget;
image.y = target.y + cos(angle) * distanceFromTarget;

Upvotes: 1

Jeeter
Jeeter

Reputation: 6105

you could try changing the anchor point of the image to where you want it to rotate around, instead of the center

Upvotes: 0

Related Questions