Ollin

Input

Sketches driven by the mouse, the trackpad, and the keyboard.

ExampleWhat it shows
PanAndZooma generated chart that holds more than one screen shows, so you drag to pan and scroll to zoom. The place names are set at a text size of four units, six for the larger places, which reads as a smudge at the opening view and is crisp four zoom steps in (viewControl, viewZoom)
RepelGrida grid of dots that move away from the cursor (mouseX/mouseY)
Keyssteer a dot with WASD or the arrow keys, both read through one moveAxis call. Space changes the color (keyPressed), and releasing any key flashes a ring (keyReleased)
Pena broad-edged nib that reads a tablet: the chisel lies across the way the pen leans, the press sets how wide, the eraser end takes ink away, and a panel says what the stylus is sending (stylus, pressure)
PinchAndTurntwo fingers on the trackpad size and spin a rose (pinchScale, turnAngle), and the turn clicks its petal count a notch every fifteen degrees (fingersTurned)
TypedTexttype and the words land on the canvas, the way a text field takes them: an accent typed with a dead key, the emoji viewer's pick, and Chinese or Japanese through an input method arrive as text (typedText, textTyped), the reading still being composed shows underlined (composingText), and a panel sets the last key beside the last text it typed
Draggrab, drag, and throw balls. It uses the press and release hooks, draws the per-frame mouse - previousMouse delta as a stretch arrow, and averages the release velocity over the last few frames

Run one with swift run Example-Input-<Name>, for example swift run Example-Input-RepelGrid.

↑↓ move ↩ open