testObject1
This page is designed to serve as a reference implementation for the Lenscript engine.
In Lenscript an implementation of the engine into a specific platform is referred to as an interface. The underlying engine is designed to be interface agnostic, supporting custom grammar to enable bespoke implementations of natural language scripting into any platform.
In this demo a browser specific grammar has been loaded, and the above interface allows you to interact with that grammar to run triggers and actions.
The browser grammar for this page can be found here. The implementation code for both this UI and its interaction with the Lenscript engine can be found here.
Refer to the documentation for information.
The following triggers and actions have been implemented:
Trigger Name | Description | Example |
---|---|---|
started | Fired when the object is created | when started |
touchStart | Fired when the mouse is pressed down on the object | when touch started |
touchEnd | Fired when the mouse was previously held down on the object, and then is released | when touched |
hoverStart | Fired when the mouse enters the objects bounding box | when hover started |
hovering | Fired when the mouse is moved over the object | when hovering |
hoverEnd | Fired when the mouse leaves the objects bounding box | when hovered |
grabStart | Fired when a drag operation starts on the object | when grabbed |
grabbing | Fired while the object is being dragged | when grabbing |
grabEnd | Fired when a drag operation ends on the object | when dropped |
Action Name | Description | Parameters | Example |
---|---|---|---|
remember | Saves a value to an objects variable store. This value can only be read by this object | name: the name of the variable, value: the value to stored (all values are cast to strings) | when touched remember counter 1, remember name Bob |
save | Saves a value to an global scene variable store. These values can be read by all objects | name: the name of the variable, value: the value to stored (all values are cast to strings) | when touched remember counter 1, save name Bob |
become | Transition the object to another state | name: the name of the new state | when touched then become 2, become second |
visibility | Set the visibility for the object | value: visible or hidden | when touched then set visibility hidden |
bgColor | Set the background color of the object | value: hex color, color name, or rgb values separated by a space | when touched then set bg color #ff0000, set bg color red, set bg color 255 0 0 |
textColor | Set the text color of the object | value: hex color, color name, or rgb values separated by a space | when touched then set text color #ff0000, set text color red, set text color 255 0 0 |
rotation | Set the rotation of the object | value: the rotation of the object, in degrees | when touched then set rotation 45 |
scale | Set the scale of the object | value: the scale of the object, as a multiplier (ex: 2 is 2x scale) | when touched then set scale 2 |