doodle.utils

Description:

utils

Class Functions

create_scene_path (node:Node, array:Array, clearArray:boolean) :Array

Creates a scene graph path from a given node and all it's descendants.

Parameters

  1. node:Node –
  2. array:Array – Array to store the path nodes in.
  3. clearArray:boolean – Empty array passed as parameter before storing nodes in it.

Returns

  • Array – The array passed to the function (modified in place).

Throws

  • TypeError –
hex_to_rgb (color:Color) :Array

Parameters

  1. color:Color –

Returns

  • Array – [r, g, b]

Throws

  • TypeError –
hex_to_rgb_str (color:Color, alpha:number) :string

Parameters

  1. color:Color –
  2. alpha:number –

Returns

  • string –

Throws

  • TypeError –
rgb_str_to_hex (rgb:string) :string

Parameters

  1. rgb:string –

Returns

  • string –

Throws

  • TypeError –
rgb_str_to_rgb (color:Color) :Array

Parameters

  1. color:Color –

Returns

  • Array –

Throws

  • TypeError –
  • SyntaxError –
rgb_to_hex (r:number, g:number, b:number) :string

Parameters

  1. r:number –
  2. g:number –
  3. b:number –

Returns

  • string –

Throws

  • TypeError –
rgb_to_rgb_str (r:number, g:number, b:number, a:number) :string

Parameters

  1. r:number –
  2. g:number –
  3. b:number –
  4. a:number –

Returns

  • string –

Throws

  • TypeError –
set_element_property (element:HTMLElement, property:string, value:*, type:string) :*

Parameters

  1. element:HTMLElement –
  2. property:string –
  3. value:* –
  4. type:string – 'css'|'html' Set CSS property or HTML attribute.

Returns

  • * –

Throws

  • TypeError –
  • SyntaxError –
get_style_property (element:HTMLElement, property:string, useComputedStyle:boolean) :*

Returns css property of element, it's own or inherited.

Parameters

  1. element:HTMLElement –
  2. property:string –
  3. useComputedStyle:boolean –

Returns

  • * –

Throws

  • TypeError –
  • ReferenceError –
get_element (element:HTMLElement|string) :HTMLElement

Returns HTML element from id name or element itself.

Parameters

  1. element:HTMLElement|string –

Returns

  • HTMLElement –
get_element_property (element:HTMLElement, property:string, returnType:string, useComputedStyle:boolean) :*

Returns property of an element. CSS properties take precedence over HTML attributes.

Parameters

  1. element:HTMLElement –
  2. property:string –
  3. returnType:string – 'int'|'float' Return type.
  4. useComputedStyle:boolean –

Returns

  • * –

Throws

  • ReferenceError –