visual tweaks

This commit is contained in:
kepler155c@gmail.com
2019-04-15 11:49:43 -04:00
parent b116e56676
commit 61e2a2e8bf
2 changed files with 37 additions and 17 deletions

View File

@@ -30,20 +30,41 @@ local hex = {
['e'] = 0xCC4C4C4F, ['e'] = 0xCC4C4C4F,
-- ['f'] = 0x191919FF, -- transparent -- ['f'] = 0x191919FF, -- transparent
} }
local canvas = device['plethora:glasses'] and device['plethora:glasses'].canvas()
if canvas then local function update()
canvas.clear() -- assuming we are the first to use the canvas local canvas = device['plethora:glasses'] and device['plethora:glasses'].canvas()
local w, h = canvas.getSize() if canvas then
canvas.group = canvas.addGroup({ w - 30, h - 30 }) local Tween = require('ui.tween')
local function drawLine(k, line)
for i = 1, #line do canvas.clear()
local pix = hex[line:sub(i, i)] local w, h = canvas.getSize()
if pix then local pos = { x = w / 2, y = h / 2 - 30 }
canvas.group.addRectangle(i*1.5, k*2.25, 1.5, 2.25, pix) local group = canvas.addGroup(pos)
local function drawLine(k, line)
for i = 1, #line do
local pix = hex[line:sub(i, i)]
if pix then
group.addRectangle(i*1.5, k*2.25, 1.5, 2.25, pix)
end
end end
end end
end
for k,line in ipairs(opus) do for k,line in ipairs(opus) do
drawLine(k, line) drawLine(k, line)
end
os.sleep(.5)
local tween = Tween.new(40, pos, { x = w - 60, y = h - 30 }, 'outBounce')
repeat
local finished = tween:update(1)
os.sleep(0)
group.setPosition(pos.x, pos.y)
until finished
end end
end end
kernel.run({
title = 'opus',
env = _ENV,
hidden = true,
fn = update,
})

View File

@@ -33,7 +33,7 @@ local function fish()
local held = owner.heldItem and owner.heldItem.getMetadata() local held = owner.heldItem and owner.heldItem.getMetadata()
if held and held.rawName == 'item.fishingRod' then if held and held.rawName == 'item.fishingRod' then
if icon then if icon then
icon.setItem('minecraft:fish', 1) icon.setItem('minecraft:fish', math.random(0, 3))
end end
kinetic.use(.2) kinetic.use(.2)
print('casting') print('casting')
@@ -43,11 +43,10 @@ local function fish()
else else
if icon then if icon then
icon.setItem('minecraft:fishing_rod') icon.setItem('minecraft:fishing_rod')
icon.setScale(1)
end end
print('waiting for fishing rod to be selected') print('waiting for fishing rod to be selected')
end end
scale = 1
icon.setScale(1)
os.sleep(1) os.sleep(1)
else else
if meta.y < depth then if meta.y < depth then
@@ -67,4 +66,4 @@ pcall(fish)
if icon then if icon then
icon.remove() icon.remove()
end end