BB.BaseBrush2D

Base 2D brush class extended by BB.ImageBrush2D, BB.LineBrush2D, etc...

Index

Methods

Constructor

BB.BaseBrush2D
(
  • [config]
)

Parameters:

  • [config] Object optional

    An optional config hash to initialize any of BB.BaseBrush2D's public properties

Example:

 var brush = new BB.BaseBrush2D({ width: 100, height: 100, color: new BB.Color(255, 0, 0) });

Properties

color BB.Color default:null

The brush's color.

height Number default:10

The brush's height.

hidden Boolean default:false

Wether or not to draw the brush to the screen. Toggle this variable to hide and show the brush.

rotation Number default:0

The brush's rotation in degrees. This property is not always used with each brush variant.

type String default:"base"

The type of brush. Defaults to "base" for BB.BaseBrush, "image" for BB.ImageBrush, etc... and should be treated as read-only.

width Number default:10

The brush's width.

x Number default:0

The brush's x position.

y Number default:0

The brush's y position.

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

Methods

draw ()

Base draw method. Usually called once per animation frame.

scale
(
  • amount
)

Multiplies width and height properties by amount.

Parameters:

  • amount Number

    Amount to scale width and height by

Example:

  var brush = new BB.BaseBrush2D({ width: 50, height: 100 });
  brush.scale(2);
  brush.width // 100
  brush.height // 200

update
(
  • controllerModule
)

Base update method. Usually called once per animation frame.

Parameters:

  • controllerModule Object

    An object with x and y properties and optionally an isDown boolean (used for beginning and ending strokeds/marks).

Example:

 var mouseInput = new BB.MouseInput(document.getElementById('canvas'));
 var pointer = new BB.Pointer(mouseInput);
 var brush = new BB.BaseBrush2D();

  // called once per animation frame (from somewhere else in your app)
 function update() {
    mouseInput.update();
    pointer.update();
    brush.update(pointer); // update the brush using the pointer
 }

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index