Live2LOVE
LÖVE module to load and render Live2D Cubism 2 models.
Due to Live2D restrictions, this library must be compiled from source. Furthermore, source modification to LÖVE is needed for iOS and Android to package.preload
this library.
Examples
If you have model definition file live2d/model.json
local Live2LOVE = require("Live2LOVE")
local model
function love.load()
-- Live2LOVE fully respect love.filesystem
-- so loading from fused game works out-of-the-box
model = Live2LOVE.loadModel("live2d/model.json")
model:setMotion("idle", "loop")
end
function love.draw()
-- Model drawing also respects love.graphics
-- state, so you can render model to Canvas (enable stencil bufffer!)
-- or apply Shader to it. Furthermore, graphics transformation is also
-- applied to the model.
-- Push stack
love.graphics.push("all")
-- make the model cyan-masked, and 75% opaque
love.graphics.setColor(0, 1, 1, 1, 0.75)
-- Scale down the model by 50%
love.graphics.scale(0.5, 0.5)
-- Rotate it by 30 degrees
love.graphics.rotate(math.pi/6)
-- Move it to +300+200
love.graphics.translate(300, 200)
-- Draw the model
model:draw()
-- Pop stack
love.graphics.pop()
end
Links
- GitHub repository
- Documentation (incomplete)
- Forum post
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info