Skip to content

Instantly share code, notes, and snippets.

@andr-ew
Last active September 21, 2021 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andr-ew/1c8bc88e260eace46e69615c3874513e to your computer and use it in GitHub Desktop.
Save andr-ew/1c8bc88e260eace46e69615c3874513e to your computer and use it in GitHub Desktop.
nest_ z-index example
include 'nest_/lib/nest/core'
include 'nest_/lib/nest/norns'
include 'nest_/lib/nest/grid'
-- when a nest draws affordances, it sorts them by increasing z values and draws them in that order
n = nest_ {
higher = _grid.number {
x = { 1, 16 },
y = 1,
lvl = 15,
z = 0 -- 0 is the default value for z, so it doesn't need to be set explicitly
},
lower = _grid.range { -- (hold down two keys in row 1 to use the range affordance)
x = { 1, 16 },
y = 1,
lvl = 8,
z = -1 -- setting z to anything less than 0 ensures it to be drawn underneath
}
} :connect { g = grid.connect() }
--both affordances still receive input from key presses. if you want more control over this, you can use fingers to filter by the number of concurrent keypresses
function init() n:init() end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment