Slot and animation - color/alpha out of range fix. Normalizing color and alpha during load as both need to be in 0-1 range in the main loop.

This commit is contained in:
scape 2013-11-04 17:49:30 +01:00
parent 8d991356fe
commit 70193d6e39

16
spine-lua/SkeletonJson.lua Normal file → Executable file
View File

@ -111,10 +111,10 @@ function SkeletonJson.new (attachmentLoader)
local color = slotMap["color"] local color = slotMap["color"]
if color then if color then
slotData:setColor( slotData:setColor(
tonumber(color:sub(1, 2), 16), tonumber(color:sub(1, 2), 16)/255,
tonumber(color:sub(3, 4), 16), tonumber(color:sub(3, 4), 16)/255,
tonumber(color:sub(5, 6), 16), tonumber(color:sub(5, 6), 16)/255,
tonumber(color:sub(7, 8), 16) tonumber(color:sub(7, 8), 16)/255
) )
end end
@ -264,10 +264,10 @@ function SkeletonJson.new (attachmentLoader)
local color = valueMap["color"] local color = valueMap["color"]
timeline:setFrame( timeline:setFrame(
keyframeIndex, time, keyframeIndex, time,
tonumber(color:sub(1, 2), 16), tonumber(color:sub(1, 2), 16)/255,
tonumber(color:sub(3, 4), 16), tonumber(color:sub(3, 4), 16)/255,
tonumber(color:sub(5, 6), 16), tonumber(color:sub(5, 6), 16)/255,
tonumber(color:sub(7, 8), 16) tonumber(color:sub(7, 8), 16)/255
) )
readCurve(timeline, keyframeIndex, valueMap) readCurve(timeline, keyframeIndex, valueMap)
keyframeIndex = keyframeIndex + 1 keyframeIndex = keyframeIndex + 1