Where can I find visual tutorial about transform and translate.
I'm trail and error now with a simple thing.
I have multiple images frames that I want to center using their max width (the frames don't have the same with).
That part is working, and the animation is playing perfect, and the animation is moving oke.
But what I don't want is that using a offset X and offset Y, will give the image the wrong x and y coordinates.
For example:
Code: Select all
local x = 400 -- dynamic
local y = 500 -- dynamic
local maxWidth = self:calcFrameMaxWidth()
local maxHeight = self:calcFrameMaxHeight()
local ox = (maxWidth / 2) - currentFrameOffset.x -- dynamic
local oy = (maxHeight / 2) - currentFrameOffset.y -- dynamic
love.graphics.draw(
self.image,
self:getQuad(),
x,
y,
0,
1,
1,
ox, -- some small dynamic alignments
oy -- some small dynamic alignments
)
So I think I need to use something like translate or transform. And try some trail and error things like
Code: Select all
love.graphics.push()
-- love.graphics.translate(?, ?)
-- local transform = love.math.newTransform(0, 0, 0, 1, 1, ox, oy)
-- love.graphics.applyTransform(transform)
love.graphics.draw(
self.image,
self:getQuad(),
10,
10,
0,
1,
1,
ox, -- some small dynamic alignments
oy -- some small dynamic alignments
)
love.graphics.pop()
Then I though, maybe I need to re-create the image using another canvas, but I read that using multiple canvasses is not supported for all devices, so I don't want to use that.