Key Concepts in Psychex ======================= The following page introduces the main components available in Psychex. There are 2 types of element in Psychex: - Canvas elements - DOM elements See below for more details on each. Canvas Elements --------------- Canvas elements are built upon the HTML canvas API. Think of these elements in exactly this way: like shapes painted onto a canvas. The underlying technology here means whatever is drawn can be removed and redrawn many times per second, allowing us to create animations and dynamic content in the browser. This API also gives us greater power when it comes to positioning content on the page. Like a blank canvas, elements can be placed by specifying their exact position - no more trying to remember how to centre elements in a *div*! Psychex aims to be customisable, while having a strong base of standard classes and utilities to build upon. The main building block in Psychex is the *Primitive*. A primitive is a single, simple object, such as a gemoetric shape (eg. a rectangle, circle, or line), an image, or some text. All primitives come with the same set of base classes, such as click listeners, and tools to edit styles. They can all be positioned and drawn in the same way. Primitives may be combined together to form more complex units. These more complex units provided within Psychex are typically referred to as either: - *Compounds*: utilities, or grouped objects that perform a wider function together - *Paradigms*: A common experimental paradigm or structure containing logic for that experiment, and with options for drawable components For instance, the Psychex class ``NArmBandit`` contains some standard logic for instantiating an N-Arm bandit task, and can have drawable objects added to it to render out each of the *arms*. This is an example of *paradigm* made up of *primitives* plus background logic. We also have a handful of other *utility* classes that contain common patterns. For instance, the ``Game`` class has methods for loading and saving data from a range of sources, such as via *HTTP* or using a tool like *JATOS*, and the *Fullscreen* class handles rules for keeping the game in fullscreen, with callbacks for when a player leaves early. DOM Elements ------------ Psychex also exposes DOM elements - classic HTML elements that you may be familiar with, such as