Skip to content
Erik edited this page Aug 31, 2013 · 1 revision

WikiAPI ReferenceLed

A Led is a simple led.

# iopctrl.led()

Constructs a new led.

# led(selection)

Apply the led to a selection or transition. The selection must contain an SVG or G element. For example:

d3.select("body").append("svg")
    .attr("width", 20)
    .attr("height", 20)
  .append("g")
    .attr("class", "led")
    .call(led);

# led.on([state])

If state is specified, sets the led state to on or off and returns the led. If state is not specified, returns the current state.

# led.width([width])

If width is specified, sets the width and returns the led. If width is not specified, returns the current width.

# led.height([height])

If height is specified, sets the height and returns the led. If height is not specified, returns the current height.

# led.round([round])

If round is specified, sets the rounding of the corners and returns the led. If round is not specified, returns the current rounding.

# led.color([color])

If color is specified, sets the led color and returns the led. If color is not specified, returns the current color.

# led.transitionDuration([transitionDuration])

If transitionDuration is specified, sets the transition duration betwwen on and off state and returns the led. If transitionDuration is not specified, returns the current transitionDuration.

Clone this wiki locally