1. A method of attributing behavior to at least one user interface element of a plurality of user interface elements of a user interface, wherein the plurality of user interface elements is defined in a layered graphical representation of the user interface, the layered graphical representation specifying a plurality of graphical layers, the method comprising: designating, based on a selection by a user of at least one of the plurality of graphical layers, the at least one of the plurality of graphical layers as an initial state of the user interface, wherein the at least one of the plurality of graphical layers defines the at least one user interface element; setting, based on user input, at least one property of the initial state of the user interface, wherein the at least one property specifies at least one event and at least one behavior action of an interaction rule associated with the initial state wherein, in response to the initial state being displayed and at least one of the at least one event being detected, at least one of the at least one behavior action is executed in accordance with the interaction rule associated with the initial state, and wherein the at least one behavior action is configured to display a second state instead of the initial state wherein another at least one of the plurality of graphical layers is designated as the second state; recording the initial state of the user interface and the at least one property of the initial state of the user interface in a persistent datastore; and wherein the method is performed by a computer.