-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreatePattern.js
55 lines (55 loc) · 1.26 KB
/
createPattern.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
module.exports = {
name: "createPattern",
ns: "canvas",
async: true,
title: "Create Pattern",
description: "A DOM element to use as the source image for the pattern. This can be any element, although typically you'll use an Image or <canvas>",
phrases: {
active: "Creating pattern"
},
ports: {
input: {
context: {
title: "Context",
type: "CanvasRenderingContext2D",
required: true
},
element: {
title: "Element",
async: true,
type: "HTMLElement",
fn: function __ELEMENT__(data, source, state, input, $, output) {
var r = function() {
output({
out: $.create($.context.createImageData($.element, $.repetition)),
context: $.get('context')
});
}.call(this);
return {
state: state,
return: r
};
}
},
repetition: {
title: "Repetition",
"enum": ["repeat",
"repeat-x",
"repeat-y",
"no-repeat"
]
}
},
output: {
context: {
title: "Context",
type: "CanvasRenderingContext2D"
},
out: {
title: "Object",
type: "object"
}
}
},
state: {}
}