December 2018, updated July 2021
Keyboard – Lens Studio tool
Since there is no built-in keyboard feature in Lens Studio yet, I made this as a temporary workaround.
No programming is required to use the Keyboard, but it is possible to call certain functions
to interact with the keyboard through your own scripts (the list of features is at the end of this page).
The keyboard supports single-line and multi-line text, with as many lines as you’d like.
There is a SHIFT button for capitals, and there are two more panels for symbols and numbers:
And it has some customization options:
Usage
To get the text typed by the user on a Text component, add the ‘Get Keyboard Text’-script to an object.
To quickly change the look of the keys, edit the ‘Keyboard Keys’ material.
This material takes care of the toggle, space bar, and normal keys, in both states: pressed and idle.
To set a default text (and optional multi-line count), type it in the ‘Default Text Lines’ textbox in the Keyboard settings.
Javascript use (can be called at any time from any script in the project)
– Get the first line of text as a string (function, optional int argument to specify which line if multiline)
global.keyboard.getLine()
Examples:
global.keyboard.getLine() – reads first line of text (default)
global.keyboard.getLine(1) – reads second line of text
– Check if keyboard is currently visible (bool)
global.keyboard.isActive
– Toggle keyboard in/out animation (function)
global.keyboard.toggle()
– Get or set keyboard out text lines (array)
global.keyboard.lines
– Get the current line the user is typing in (Number)
global.keyboard.currentLine
– Check if the user is currently in the Symbols tab (bool)
global.keyboard.symbols
– Check if the user is currently using Caps Lock (bool)
global.keyboard.capslock
Keyboard in action
View this post on InstagramMade a customizable keyboard for a #snaplens in #lensstudio – I’ll share the project files some time soon A post shared by max (@maxeflats) on