Backdrop

Backdrop

Class representing a Backdrop. Backdrops can be added to the Stage.

Constructor

new Backdrop(options)

constructor - Creates a Backdrop to be used by Stage objects.
Source:
Parameters:
Name Type Description
options object options for the backdrop.
Name Type Description
image string a URI (or data URI) for the backdrop image.
color string a css color string ('#ff0000', 'red')
Examples
let backdrop = new blockLike.Backdrop();
let backdrop = new blockLike.Backdrop({
  image: 'https://www.blocklike.org/images/backdrop.svg'
});
let backdrop = new blockLike.Backdrop({
  color: '#A2DAFF'
});

Extends

Methods

addClass(name)

addClass - adds a css class to costume.
Overrides:
Source:
Parameters:
Name Type Description
name string the css class name to add.
Examples
let costume = new blockLike.Costume();

costume.addClass('rainbow');
let backdrop = new blockLike.Backdrop();

backdrop.addClass('rainbow');

addTo(stage)

addTo - Adds the backdrop to the stage
Source:
Parameters:
Name Type Description
stage object which stage to add the backdrop too.
Example
let stage = new blockLike.Stage();
let backdrop = new blockLike.Backdrop();

backdrop.addTo(stage);

css(prop, value)

css - applies a CSS rule to a Costume or Backdrop.
Overrides:
Source:
Parameters:
Name Type Default Description
prop string the css property (e.g. color)
value string null the value for the css property (e.g. #ff8833)
Examples
let costume = new blockLike.Costume();

costume.css('font-size', '16px');
let backdrop = new blockLike.Backdrop();

backdrop.css('cursor', 'pointer');

hasClass(name) → {boolean}

hasClass - is the css class applied to the costume.
Overrides:
Source:
Parameters:
Name Type Description
name string the css class name.
Returns:
Type:
boolean
- is the css class name on the list.
Examples
let costume = new blockLike.Costume();

costume.hasClass('rainbow') ? costume.removeClass('rainbow') : costume.addClass('rainbow');
let backdrop = new blockLike.Backdrop();

backdrop.hasClass('rainbow') ? backdrop.removeClass('rainbow') : backdrop.addClass('rainbow');

removeClass(name)

removeClass - removes a css class from the costume.
Overrides:
Source:
Parameters:
Name Type Description
name string the css class name to remove.
Examples
let costume = new blockLike.Costume();

costume.hasClass('rainbow') ? costume.removeClass('rainbow') : costume.addClass('rainbow');
let backdrop = new blockLike.Backdrop();

backdrop.hasClass('rainbow') ? backdrop.removeClass('rainbow') : backdrop.addClass('rainbow');

removeFrom(stage)

removeFrom - Removes the backdrop to the stage
Source:
Parameters:
Name Type Description
stage object which stage to remove the backdrop from.
Example
let stage = new blockLike.Stage();
let backdrop = new blockLike.Backdrop();

backdrop.addTo(stage);
backdrop.removeFrom(stage);