AWT

Source: AWT.js:32

File : AWT.js
Created : 12/04/2015
By : Francesc Busquets francesc@gmail.com

JClic.js
An HTML5 player of JClic activities
https://projectestac.github.io/jclic.js

  • License: EUPL-1.2

Other

Font

static
AWT.js:38

Font contains properties and provides methods to manage fonts

Parameters

  • family (string, optional, default: "'Arial'")
  • size (number, optional, default: 17)
  • bold (number, optional, default: 0)
  • italic (number, optional, default: 0)
  • variant (string, optional, default: "''")

Gradient

Contains parameters and methods to draw complex color gradients

Parameters

  • c1 (string) — The initial color, in any CSS-valid form.
  • c2 (string) — The final color, in any CSS-valid form.
  • angle (number, optional, default: 0) — The inclination of the gradient relative to the horizontal line.
  • cycles (number, optional, default: 1) — The number of times the gradient will be repeated.

Stroke

Contains properties used to draw lines in HTML canvas elements.

Parameters

  • lineWidth (number, optional, default: 1) — The line width of the stroke
  • lineCap (string, optional, default: "'butt'") — The line ending type. Possible values are: butt, round
    and square.
  • lineJoin (string, optional, default: "'miter'") — The type of drawing used when two lines join. Possible
    values are: round, bevel and miter.
  • miterLimit (number, optional, default: 10) — The ratio between the miter length and half lineWidth.

Point

Contains the x andy y coordinates of a point, and provides some useful methods.

Parameters

  • x (number | Point) — When x is an Point object, a clone of it will be created.
  • y (number, optional) — Not used when x is an Point

Dimension

This class encapsulates width and height properties.

Parameters

  • w (number | Point) — The width of this Dimension, or the upper-left vertex of a
    virtual Rectangle
  • h (number | Point) — The height of this Dimension, or the bottom-right vertex of a
    virtual Rectangle

Shape

staticabstract
AWT.js:820

Shape is a generic abstract class for rectangles, ellipses and stroke-free shapes.

Parameters

Rectangle

Extends: module:AWT.Shape

The rectangular module:AWT.Shape accepts five different sets of parameters:

Parameters

  • pos (Point | Rectangle | number | Array.<number>)
  • dim (Dimension | number, optional)
  • w (number, optional)
  • h (number, optional)

Example

CODE
<p>// Calling Rectangle() with different sets of parameters<br>
// A Point and a Dimension:<br>
new Rectangle(pos, dim)<br>
// Another Rectangle, to be cloned:<br>
new Rectangle(rect)<br>
// Two Point objects containing the coordinates of upper-left and lower-right vertexs:<br>
new Rectangle(p0, p1)<br>
// An array of four numbers with the coordinates of the same vertexs:<br>
new Rectangle([x0, y0, x1, y1])<br>
// Four single numbers, meaning the same coordinates as above:<br>
new Rectangle(x0, y0, x1, y1)</p>

Ellipse

Extends: module:AWT.Rectangle

The Ellipse shape has the same constructor options as Rectangle

Parameters

  • pos (Point | Rectangle | number | Array.<number>)
  • dim (Dimension | number, optional)
  • w (number, optional)
  • h (number, optional)

Path

Extends: module:AWT.Shape

A Path is a module:AWT.Shape formed by a serie of strokes, represented by
module:AWT.PathStroke objects

Parameters

PathStroke

PathStroke is the basic component of module:AWT.Path objects

Parameters

  • type (string) — The type of stroke. Possible values are: M (move to), L (line to),
    Q (quadratic to), B (bezier to) and X (close path).
  • points (Array.<module:AWT.Point>) — The array of module:AWT.Point objects used in this Stroke.

Action

This class encapsulates actions that can be linked to buttons, menus and other active objects

Parameters

  • name (string) — The name of this Action
  • actionPerformed (function) — The callback to be triggered by this Action

Timer

This class provides a timer that will launch a function at specific intervals

Parameters

  • actionPerformed (function) — The function to be triggered when the timer is enabled.
  • interval (number) — The interval between action calls, specified in milliseconds.
  • enabled (boolean, optional, default: false) — Flag to indicate if the timer will be initially enabled.

Container

Extends: module:AWT.Rectangle

Logic object that takes care of an "invalidated" rectangle that will be repainted
at the next update of a 2D object, usually an HTML Canvas.
Container has the same constructor options as Rectangle

Parameters

  • pos (Point | Rectangle | number | Array.<number>)
  • dim (Dimension | number, optional)
  • w (number, optional)
  • h (number, optional)