Available since LÖVE 11.0
This function is not supported in earlier versions.
Creates a new Transform object.
Creates a Transform with no transformations applied. Call methods on the returned object to apply transformations.
transform = love.math.newTransform( )
None.
Transform transformCreates a Transform with the specified transformation applied on creation.
transform = love.math.newTransform( x, y, angle, sx, sy, ox, oy, kx, ky )
number xnumber ynumber angle (0)number sx (1)number sy (sx)number ox (0)number oy (0)number kx (0)number ky (0)Transform transformCreates a new Transform object and uses it to position and rotate a rectangle around its center.
function love.load()
rectwidth = 100
rectheight = 100
-- arguments are: x, y, angle, scalex, scaley, offsetx, offsety
transform = love.math.newTransform(100, 100, math.pi/4, 1, 1, rectwidth / 2, rectheight / 2)
end
function love.draw()
love.graphics.applyTransform(transform)
love.graphics.rectangle("fill", 0, 0, rectwidth, rectheight)
end
© 2006–2020 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.math.newTransform