-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetAttributes.js
171 lines (171 loc) · 4.75 KB
/
setAttributes.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
module.exports = {
name: "setAttributes",
ns: "canvas",
async: true,
title: "Set Attributes",
description: "Sets one or more attributes",
phrases: {
active: "Setting attributes"
},
ports: {
input: {
context: {
title: "Context",
type: "CanvasRenderingContext2D",
required: true
},
"in": {
title: "Attributes",
type: "object",
async: true,
required: true,
properties: {
fillStyle: {
type: "string",
title: "Fill Style",
description: "Color or style to use inside shapes. Default #000 (black).",
format: "color",
"default": "#000"
},
font: {
type: "string",
title: "Font",
"default": "10px sans-serif"
},
globalAlpha: {
type: "number",
title: "Global Alpha",
description: "globalAlpha float Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).",
"default": 1
},
globalCompositeOperation: {
title: "Global Composite Operation",
description: "With globalAlpha applied this sets how shapes and images are drawn onto the existing bitmap.",
"enum": ["source-atop",
"source-in",
"source-out",
"source-over",
"destination-atop",
"destination-in",
"destination-out",
"destination-over",
"lighter",
"darker",
"copy",
"xor"
],
"default": "source-over"
},
lineCap: {
"enum": ["butt",
"round",
"square"
],
title: "Line Cap",
description: "Type of endings on the end of lines.",
"default": "butt"
},
lineDashOffset: {
type: "number",
title: "Line Dash Offset",
description: "Specifies where to start a dasharray on a line."
},
lineJoin: {
"enum": ["miter",
"round",
"bevel"
],
title: "Line Join",
description: "Defines the type of corners where two lines meet.",
"default": "miter"
},
lineWidth: {
type: "number",
title: "Line Width",
description: "Width of lines",
"default": 1
},
miterLimit: {
type: "number",
title: "Miter Limit",
"default": 10
},
shadowBlur: {
type: "number",
title: "Shadow Blur",
description: "float Specifies the blurring effect.",
"default": 0
},
shadowColor: {
type: "string",
title: "Shadow Color",
description: "Color of the shadow. Default fully-transparent black.",
format: "color",
"default": 0
},
shadowOffsetX: {
type: "number",
title: "Shadow Offset X",
description: "Horizontal distance the shadow will be offset.",
"default": 0
},
shadowOffsetY: {
type: "number",
title: "Shadow Offset Y",
description: "Vertical distance the shadow will be offset.",
"default": 0
},
strokeStyle: {
type: "string",
title: "Stroke style",
description: "Color or style to use for the lines around shapes.",
format: "color",
"default": "#000"
},
textAlign: {
"enum": ["start",
"end",
"left",
"right",
"center"
],
title: "Text Align",
"default": "start"
},
textBaseline: {
"enum": ["top",
"hanging",
"middle",
"alphabetic",
"ideographic",
"bottom"
],
title: "Text Baseline",
"default": "alphabetic"
}
},
fn: function __IN__(data, source, state, input, $, output) {
var r = function() {
for (var k in $.in) {
$.context[k] = $.in[k];
}
output({
context: $.get('context')
});
}.call(this);
return {
state: state,
return: r
};
}
}
},
output: {
context: {
title: "Context",
type: "CanvasRenderingContext2D"
}
}
},
state: {}
}