Last modified:
Built-In Namespace _global_
Field Attributes | Field Name and Description |
---|---|
Jitter3dUtilsInterface |
Instance of Jitter3dUtilsInterface.
|
Method Attributes | Method Name and Description |
---|---|
Maxobj |
$(stringref)
$ function - this function is not part of the official API.
|
void |
cpost(anyArguments)
Prints a message to the system console window.
|
Vec4 |
hslToRgba(h, s, l, a)
Converts an HSL color value to RGB.
|
void |
jgt_callbackfun(event)
jgt_callbackfun called with mouse events on destination by JitterListener.
|
void |
messnamed(objectName, messageName, anyArguments)
Sends a message to the named Max object.
|
Integer |
pointsort_dist(pa, pb)
Callback (helper) function to sort intersection points by z order.
|
void |
post(anyArguments)
Prints a representation of the arguments in the Max window.
|
void |
postprops(p)
This function posts every element of an array (all properties of an object).
|
Field Detail
{Jitter3dUtilsInterface}
Jitter3DUtils
Instance of Jitter3dUtilsInterface.
Jitter3dUtils: javascript module for doing Jitter 3d stuff
Defined in:
Jitter3dUtils: javascript module for doing Jitter 3d stuff
Defined in:
- Example:
// You can use this instance from anywhere in the code. // At least it should be possible var vlength = Jitter3DUtils.vlength2([1.,2.,3.]);
- See:
Method Detail
{Maxobj}
$
(stringref)
$ function - this function is not part of the official API.
I think it's very useful to get a specific element in patch.
Its from here http://blog.crondesign.com/2011/03/maxmsp-javascript-dollar-function.html
Defined in:
Its from here http://blog.crondesign.com/2011/03/maxmsp-javascript-dollar-function.html
Defined in:
- Example:
//SOURCE CODE: function $(stringref){ stringref=stringref.replace(/parent/gi, "parentpatcher") var path=stringref.split('.') var obj=this.patcher for(i in path){ if(path[i]=='parentpatcher'){ //up 1 level: obj=obj.parentpatcher }else{ obj=obj.getnamed(path[i]) if(i!=path.length-1){ //down 1 level: obj=obj.subpatcher() } } } return(obj) } //USAGE: //access 'myButton' object in current patcher $("myButton").message('set','new text!'): //access 'myButton' object in parent patcher $("parent.myButton").message('set','new text!'); //access 'myButton' object in child patcher $("myPatcher.myButton").message('set','new text!'); //access 'myButton' object in sibling patcher $("parent.myPatcher.myButton").message('set','new text!');
- Parameters:
- {String} stringref
- Varname of an object in patcher (or subpatcher)
- Returns:
- {Maxobj} The object you searched for.
- See:
{void}
cpost
(anyArguments)
Prints a message to the system console window. See post() below for further details about arguments.
- Example:
// These statements produce the following output in the console window: // 1 2 3 violet 900 1000 1100 \n // 4 5 6 a = new Array(900,1000,1100); cpost(1,2,3,"violet",a); cpost(); cpost(4,5,6);
- Parameters:
- {mixed} anyArguments
- optional, can be any type
- See:
{Vec4}
hslToRgba
(h, s, l, a)
Converts an HSL color value to RGB. Conversion formula
adapted from wikipedia HSL color space.
Assumes h, s, and l are contained in the set [0, 1] and
returns r, g, and b in the set [0, 255].
The code is from: http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
Defined in:
The code is from: http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
Defined in:
- Example:
// source code of this function hslToRgba = function (h, s, l, a) { var r, g, b; if (s == 0) { r = g = b = l; // achromatic } else { function hue2rgb(p, q, t) { if(t < 0) t += 1; if(t > 1) t -= 1; if(t < 1/6) return p + (q - p) * 6 * t; if(t < 1/2) return q; if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; return p; } var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; r = hue2rgb(p, q, h + 1/3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1/3); } return [r * 255, g * 255, b * 255, a]; }
- Parameters:
- {Number} h
- The hue
- {Number} s
- The saturation
- {Number} l
- The lightness
- {Number} a
- The alpha
- Returns:
- {Vec4} The RGB representation
{void}
jgt_callbackfun
(event)
jgt_callbackfun called with mouse events on destination by JitterListener.
get intersections of event with clients, then send event to client with
frontmost intersection, or clients which are marked unblockable. (JitterGUIUtils)
Defined in:
Defined in:
- Parameters:
- {Event} event
{void}
messnamed
(objectName, messageName, anyArguments)
Sends a message to the named Max object.
A named Max object is an object associated with a global symbol
(not an object with a patcher-specific name). For example,
Max receive objects are bound to global symbols.
The following code would send the message bang to the named object flower.
- Example:
messnamed("flower","bang”);
- Parameters:
- {String} objectName
- Name of object (js varname)
- {String} messageName
- Name of message
- {mixed} anyArguments
- optional, can be any type
- See:
{Integer}
pointsort_dist
(pa, pb)
Callback (helper) function to sort intersection points by z order. Needs precomputed distances!
(The object to be sortet need at least a proberty 'distance')
Called from jgt_callbackfun.
(JitterGUIUtils)
Defined in:
Defined in:
- Example:
point1 = {distance:1}; point2 = {distance:2}; pointArray = [point2,point1]; pointArray.sort(pointsort_dist); postprops(pointArray);
- Parameters:
- {Point} pa
- first point to compare
- {Point} pb
- second point to compare
- Returns:
- {Integer}
-1 if pa.distance > pb.distance,
1 if pa.distance < pb.distance,
0 if pa.distance == pb.distance
{void}
post
(anyArguments)
Prints a representation of the arguments in the Max window.
If
These statements produce the following output in the Max window:
post()
has no arguments, it prints starting on the next line.
Otherwise it prints the input on the current line separated by spaces.
Arrays are unrolled to one level as with outlet.
These statements produce the following output in the Max window:
1 2 3 violet 900 1000 1100 4 5 6If you want a line break in the middle of a call to post() you can use
"\n"
within a string (this is now a general feature of Max).
Also, post()
begins a new line if the last person to write to the Max window was not the js object.
- Example:
// These statements produce the following output in the Max window: // 1 2 3 violet 900 1000 1100 // 4 5 6 a = new Array(900,1000,1100); post(1,2,3,"violet",a); post(); post(4,5,6);
- Parameters:
- {mixed} anyArguments
- optional, can be any type
- See:
{void}
postprops
(p)
This function posts every element of an array (all properties of an object).
(JitterGUIUtils)
Defined in:
Defined in:
- Example:
function testPostprops(){ var obj = new Object(); obj["key1"] = "val1"; obj["key2"] = "val2"; // output should be: // key1 : val1 // key2 : val2 postprops(obj); //create a Maxobj and print properties var flonum = this.patcher.newobject("flonum"); postprops(flonum); this.patcher.remove(flonum); }
- Parameters:
- {Array} p
- The array or object to print out in MaxWindow