--毎フレーム更新する場合は64pixelが限度 local _textureSize = 64 local _Time = 0 local _useIsActive = false function timeCount() _Time = _Time + 1 if _Time > _textureSize then _Time = 0 end end function update() --Timer timeCount() -- useを押してなければ実行 if _useIsActive == false then --sinでmeterを動かす --meterY((math.sin(os.time()) + 1) * _textureSize * 0.5 + 0.5) --sinで円を描く circle((math.sin(os.time()) + 1) * _textureSize) end end function onUse() _useIsActive = true whiteNoise() end function onUnuse() _useIsActive = false end function circle(radius) local t = "" for y = 1, _textureSize do for x = 1, _textureSize do local p = "□" local x2 = x - _textureSize / 2 local y2 = y - _textureSize / 2 local r = radius / 2 if x * x + y * y < r * r then p = "■" end t = t..p end t = t.."\n" end vci.assets._ALL_SetText("Text", t) end function meterY(value) local t = "" for y = 1, _textureSize do for x = 1, _textureSize do local p = "□" --描く if (value > y) then p = "■" end t = t..p end t = t.."\n" end vci.assets._ALL_SetText("Text", t) end function meterX(value) local t = "" for y = 1, _textureSize do for x = 1, _textureSize do local p = "□" --描く if (value > x) then p = "■" end t = t..p end t = t.."\n" end vci.assets._ALL_SetText("Text", t) end function whiteNoise() local t = "" for y = 1, _textureSize do for x = 1, _textureSize do local p = "□" if math.random(0,1) == 0 then p = "■" end t = t..p end t = t.."\n" end vci.assets._ALL_SetText("Text", t) end