29 | <% if (project.branding) { %>
30 | <%- file(project.branding.logo) %>
31 | <% } %>
32 | <% project.components.forEach(function(component){ %>
33 | <%- file(component) %>
34 | <% }) %>
35 |
36 |
37 | ").append(this.ctrl).append(this.ctrlLabel);
37 |
38 | this.ctrl.bind("change blur", function () { self._onChange(); });
39 | }
40 |
41 | CheckboxControl.prototype._onChange = function() {
42 | var val = this.ctrl.attr("checked") == "checked";
43 | this.setValue(val ? 1 : 0, false);
44 | };
45 |
46 | CheckboxControl.prototype._updateControls = function() {
47 | var value = this.getValue();
48 | if (!value)
49 | this.ctrl.removeAttr("checked");
50 | else
51 | this.ctrl.attr("checked", "checked");
52 | }
53 |
54 | CheckboxControl.prototype.pushControls = function(parent) {
55 | this.pushTableColumns(parent, this.ctrlParent);
56 | }
57 |
58 | Global.Controls.register("checkbox", CheckboxControl);
59 |
60 |
61 | })();
--------------------------------------------------------------------------------
/lib/controls/code_editor.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function(){
18 |
19 | function CodeEditor(el) {
20 | CodeEditor.$super.call(this);
21 |
22 | // For performance reasons we will keep the code-mirror editor in a absolute posioned element
23 | // attached directly to body. This way we will avoid long layouts and long paint times due to
24 | // flex-box implementation.
25 | // We will keep the original element around to make it easy to steal its coordinates.
26 | this.uiElement = el;
27 |
28 | this.element = $("
").addClass("code-editor").appendTo("#codemirror-editors-view");
29 | this.isSupported = true;
30 |
31 | if (typeof CodeMirror !== 'function'){
32 | console.warn("Missing CodeMirror library. See README file")
33 | this.isSupported = false;
34 | return
35 | }
36 |
37 | var self = this;
38 | this.editor = new CodeMirror(this.element[0], {
39 | lineNumbers: true,
40 | matchBrackets: true,
41 | mode: "text/x-csrc",
42 | onChange: function() {
43 | self.fire("valueChanged", [self.getValue()]);
44 | }
45 | });
46 | }
47 |
48 | Global.Utils.extend(CodeEditor).from(Global.EventDispatcher);
49 |
50 | $.extend(CodeEditor.prototype, {
51 | setValue: function(value) {
52 | this.editor.setValue(value);
53 | },
54 |
55 | getValue: function() {
56 | return this.editor.getValue();
57 | },
58 |
59 | setActive: function(active) {
60 | this.element.toggleClass("active-shader-view", active);
61 | if (active)
62 | this.refresh();
63 | },
64 |
65 | refresh: function() {
66 | if (!this.isSupported){
67 | return
68 | }
69 | var clientRect = this.uiElement[0].getBoundingClientRect();
70 | this.element.css({
71 | "left": clientRect.left,
72 | "top": clientRect.top,
73 | "width": clientRect.width,
74 | "height": clientRect.height
75 | });
76 | $(this.editor.getScrollerElement()).height(clientRect.height);
77 | this.editor.refresh();
78 | }
79 | });
80 |
81 | Global.CodeEditor = CodeEditor;
82 |
83 | })();
--------------------------------------------------------------------------------
/lib/controls/color_control.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function ColorControl(delegate, name, config) {
20 | ColorControl.$super.call(this, delegate, name, config);
21 | this.init();
22 | }
23 |
24 | Global.Utils.extend(ColorControl).from(Global.MultiControl);
25 |
26 | ColorControl.prototype.colorRange = function(field, after) {
27 | return {
28 | type: "range",
29 | min: 0,
30 | max: 1,
31 | step: 0.01,
32 | field: field,
33 | after: after
34 | };
35 | }
36 |
37 | ColorControl.prototype.init = function() {
38 | var self = this;
39 |
40 | this.colorColumnEl = $("
");
41 | this.colorPreviewEl = $("
")
42 | .appendTo(this.colorColumnEl);
43 |
44 | this.hasColorInput = (function(self){
45 | var smiley = ":)"
46 |
47 | // a valid color input will sanitize the smiley
48 | return smiley !== self.colorPreviewEl.val(smiley).val()
49 | })(this);
50 |
51 | if (!this.hasColorInput)
52 | this.colorPreviewEl.attr("disabled", "disabled");
53 |
54 | this.colorPreviewEl.change(function () { self._onChange(); });
55 |
56 | this.createControls({
57 | "r": this.colorRange(0),
58 | "g": this.colorRange(1),
59 | "b": this.colorRange(2),
60 | "a": this.colorRange(3)
61 | });
62 |
63 | this.label = $("
");
64 | this.editableLabel = this.createEditableLabel(this.label);
65 | this.controls.prepend(
66 | $("
")
67 | .append($(" ").text("Color"))
68 | .append($(" ").append(this.colorColumnEl))
69 | .append($(" ").append(this.label))
70 | );
71 |
72 | this.controls.addClass("param-color");
73 | }
74 |
75 | ColorControl.prototype._onChange = function() {
76 | var value = this.getValue();
77 | if (!value)
78 | return;
79 | var color = parseInt(this.colorPreviewEl.val().substr(1), 16);
80 | value[0] = ((color & 0xFF0000) >> 16) / 255;
81 | value[1] = ((color & 0x00FF00) >> 8) / 255;
82 | value[2] = ((color & 0x0000FF)) / 255;
83 | this.onValueChange();
84 | this._updateControls();
85 | }
86 |
87 | ColorControl.prototype.getValueForLabelEditor = function() {
88 | var v = this.getValue();
89 | if (!v)
90 | return;
91 |
92 | var colors = [Math.floor(v[0] * 255),
93 | Math.floor(v[1] * 255),
94 | Math.floor(v[2] * 255)];
95 | var val = "#" +
96 | toBase16(colors[0]) +
97 | toBase16(colors[1]) +
98 | toBase16(colors[2]);
99 |
100 | return val;
101 | }
102 |
103 | ColorControl.prototype.setValueFromLabelEditor = function(inputValue) {
104 | var value = this.getValue();
105 | if (!value)
106 | return;
107 | if (inputValue.length < 7 || inputValue.charAt(0) != "#")
108 | return;
109 | var color = parseInt(inputValue.substr(1), 16);
110 | if (isNaN(color))
111 | return;
112 |
113 | value[0] = ((color & 0xFF0000) >> 16) / 255;
114 | value[1] = ((color & 0x00FF00) >> 8) / 255;
115 | value[2] = ((color & 0x0000FF)) / 255;
116 |
117 | this.onValueChange();
118 | this._updateControls();
119 | }
120 |
121 | function toBase16(val) {
122 | var b16 = Math.round(val).toString(16);
123 | return (b16.length == 1) ? "0" + b16 : b16;
124 | }
125 |
126 | ColorControl.prototype.onMultiControlChanged = function() {
127 | var v = this.getValue();
128 | if (!v)
129 | return;
130 | var colors = [Math.floor(v[0] * 255),
131 | Math.floor(v[1] * 255),
132 | Math.floor(v[2] * 255),
133 | v[3]],
134 | colorCSS = "rgba(" + colors.join(", ") + ")";
135 | this.colorPreviewEl.css("background-color", "none");
136 | this.colorPreviewEl.css("background", "-webkit-linear-gradient(top, "+ colorCSS +" 0%, " + colorCSS + " 100%), url('style/img/color_bg.png')");
137 |
138 | var val = "#" +
139 | toBase16(colors[0]) +
140 | toBase16(colors[1]) +
141 | toBase16(colors[2]);
142 | this.colorPreviewEl.val(val);
143 |
144 | this.label.html(val);
145 | }
146 |
147 | Global.Controls.register("color", ColorControl);
148 |
149 | })();
--------------------------------------------------------------------------------
/lib/controls/editable_label.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function(){
18 | /*
19 | * binding should provide a "setValue" and "getValue".
20 | */
21 | function EditableLabel(binding, label) {
22 | this.binding = binding;
23 | this.label = label;
24 | this.init();
25 | }
26 |
27 | EditableLabel.prototype = {
28 | init: function() {
29 | var self = this;
30 | this.label.click(function() {
31 | if (self.binding.canEdit && !self.binding.canEdit())
32 | return false;
33 | self.label.hide();
34 | self.createEditorIfNeeded();
35 | self.editor.val(self.binding.getValueForLabelEditor());
36 | self.editor.show().select();
37 | return false;
38 | });
39 | },
40 |
41 | createEditorIfNeeded: function() {
42 | if (this.editor)
43 | return;
44 | var self = this;
45 | this.editor = $(" ")
46 | .hide()
47 | .change(function() {
48 | return self.onChange();
49 | })
50 | .focusout(function() {
51 | self.hide();
52 | }).keyup(function (e) {
53 | self.onKeyUp(e);
54 | });
55 | this.label.after(this.editor);
56 | },
57 |
58 | hide: function() {
59 | this.editor.hide();
60 | this.label.show();
61 | },
62 |
63 | onKeyUp: function(e) {
64 | if (e.which == 13) {
65 | this.hide();
66 | e.preventDefault();
67 | }
68 | if (!this.onChange()) {
69 | // Rewrite last known good value.
70 | this.editor.val(this.binding.getValue());
71 | this.editor.select();
72 | }
73 | },
74 |
75 | onChange: function() {
76 | var newVal = this.editor.val();
77 | if (this.binding.validate && ((newVal = this.binding.validate(newVal)) === null))
78 | return false;
79 | this.binding.setValueFromLabelEditor(newVal);
80 | return true;
81 | }
82 | }
83 |
84 | Global.EditableLabel = EditableLabel;
85 |
86 | })();
--------------------------------------------------------------------------------
/lib/controls/multi_control.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function MultiControl(delegate, name, config) {
20 | MultiControl.$super.call(this, delegate, name, config);
21 | }
22 |
23 | Global.Utils.extend(MultiControl).from(Global.BaseControl);
24 |
25 | MultiControl.prototype.createControls = function(controlConfig) {
26 | this.controls = $("");
27 |
28 | var subControls = [],
29 | self = this;
30 |
31 | $.each(controlConfig, function(name, config) {
32 | var ControlClass = Global.Controls.get(config.type);
33 | if (!ControlClass)
34 | return;
35 |
36 | var control = new ControlClass(self, name, config);
37 | subControls.push(control);
38 |
39 | var controlRowEl = $(" ").appendTo(self.controls),
40 | label = $("
").text(name).appendTo(controlRowEl);
41 |
42 | control.pushControls(controlRowEl);
43 | if (config.after)
44 | controlRowEl.append(config.after);
45 | });
46 |
47 | this.subControls = subControls;
48 | }
49 |
50 | MultiControl.prototype.valuesUpdated = function() {
51 | this.onValueChange();
52 | this.onMultiControlChanged();
53 | }
54 |
55 | MultiControl.prototype._updateControls = function() {
56 | var value = this.getValue();
57 | if (!value)
58 | return;
59 | this.onMultiControlChanged();
60 | $.each(this.subControls, function(i, control) {
61 | control.setSource(value);
62 | });
63 | }
64 |
65 | MultiControl.prototype.onMultiControlChanged = function() { }
66 |
67 | MultiControl.prototype.pushControls = function(parent) {
68 | this.pushTableColumns(parent, this.controls);
69 | }
70 |
71 | Global.MultiControl = MultiControl;
72 |
73 | })();
--------------------------------------------------------------------------------
/lib/controls/range_control.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function RangeControl(delegate, name, config) {
20 | RangeControl.$super.call(this, delegate, name, config);
21 | this.init();
22 | }
23 |
24 | Global.Utils.extend(RangeControl).from(Global.BaseControl);
25 |
26 | RangeControl.prototype.init = function() {
27 | var self = this;
28 |
29 | this.label = $("
");
30 | this.editableLabel = this.createEditableLabel(this.label);
31 |
32 | this.ctrl = $("
")
33 | .attr("id", "range-" + this.name)
34 | .attr("class", "range-" + this.name)
35 | .attr("value", "");
36 | this.updateConfig(this.config);
37 | this.ctrl.change(function () { self._onChange(); });
38 | }
39 |
40 | RangeControl.prototype.updateConfig = function(desc) {
41 | this.ctrl.attr("min", desc.min)
42 | .attr("max", desc.max)
43 | .attr("step", desc.step);
44 | }
45 |
46 | RangeControl.prototype._onChange = function() {
47 | var val = parseFloat(this.ctrl.val());
48 | if (isNaN(val))
49 | val = 0;
50 | this.setValue(val, false);
51 | }
52 |
53 | RangeControl.prototype._updateControls = function() {
54 | var value = parseFloat(this.getValue());
55 | if (isNaN(value))
56 | value = 0;
57 | this.label.html(Math.round(100 * value) / 100);
58 | this.ctrl.val(value);
59 | }
60 |
61 | RangeControl.prototype.pushControls = function(parent) {
62 | this.pushTableColumns(parent, this.ctrl, this.label);
63 | }
64 |
65 | RangeControl.prototype.validate = function(value) {
66 | var val = parseFloat(value);
67 | if (isNaN(value) || value < this.min || value > this.max)
68 | return null;
69 | return val;
70 | }
71 |
72 | Global.Controls.register("range", RangeControl);
73 |
74 | })();
--------------------------------------------------------------------------------
/lib/controls/text_control.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function TextControl(delegate, name, config) {
20 | TextControl.$super.call(this, delegate, name, config);
21 | this.init();
22 | }
23 |
24 | Global.Utils.extend(TextControl).from(Global.BaseControl);
25 |
26 | TextControl.prototype.init = function() {
27 | var self = this;
28 |
29 | this.validatorEl = $("
");
30 |
31 | this.ctrl = $("
")
32 | .attr("id", "text-" + this.name)
33 | .attr("value", "");
34 | this.ctrl.bind("change click blur", function (ev) { self._onChange(ev); });
35 | }
36 |
37 | TextControl.prototype._onChange = function(ev) {
38 | var val = this.ctrl.val();
39 | if (this.validate(val) === null) {
40 | if (ev.type == "blur")
41 | this._updateControls();
42 | return;
43 | }
44 | this.setValue(val, false);
45 | };
46 |
47 | TextControl.prototype._updateControls = function() {
48 | var value = this.getValue();
49 | this.ctrl.val(value);
50 | }
51 |
52 | TextControl.prototype.pushControls = function(parent) {
53 | this.pushTableColumns(parent, this.ctrl);
54 | }
55 |
56 | TextControl.prototype.validate = function(value) {
57 | this.validatorEl.css("-webkit-filter", "none");
58 | this.validatorEl.css("-webkit-filter", "custom(url(test), t " + value + ")");
59 |
60 | var parsedValue = this.validatorEl.css("-webkit-filter");
61 | console.log(parsedValue);
62 | if (parsedValue === null || parsedValue == "none")
63 | return null;
64 | return value;
65 | }
66 |
67 | Global.Controls.register("unknown", TextControl);
68 | Global.Controls.register("text", TextControl);
69 |
70 | })();
--------------------------------------------------------------------------------
/lib/controls/transform_control.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function TransformControl(delegate, name, config) {
20 | TransformControl.$super.call(this, delegate, name, config);
21 | this.init();
22 | }
23 |
24 | Global.Utils.extend(TransformControl).from(Global.MultiControl);
25 |
26 | TransformControl.prototype.range = function(field, min, max, step) {
27 | return {
28 | type: "range",
29 | min: min,
30 | max: max,
31 | step: step,
32 | field: field
33 | };
34 | }
35 |
36 | TransformControl.prototype.rotationRange = function(field) {
37 | return this.range(field, -180, 180, 1);
38 | }
39 |
40 | TransformControl.prototype.init = function() {
41 | this.createControls({
42 | "rotateX": this.rotationRange("rotationX"),
43 | "rotateY": this.rotationRange("rotationY"),
44 | "rotateZ": this.rotationRange("rotationZ"),
45 | "scale": this.range("scale", 0.0, 5, 0.1),
46 | "perspective": this.range("perspective", 0.0, 2000, 1)
47 | });
48 | this.controls.addClass("param-transform");
49 | }
50 |
51 | Global.Controls.register("transform", TransformControl);
52 |
53 | })();
--------------------------------------------------------------------------------
/lib/controls/vector_control.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function vectorControlFactory(itemsCount) {
20 |
21 | function VectorControl(delegate, name, config) {
22 | VectorControl.$super.call(this, delegate, name, config);
23 | this.init();
24 | }
25 |
26 | Global.Utils.extend(VectorControl).from(Global.MultiControl);
27 |
28 | VectorControl.prototype.itemRange = function(field) {
29 | return {
30 | type: "range",
31 | min: this.config.min,
32 | max: this.config.max,
33 | step: this.config.step,
34 | field: field
35 | };
36 | }
37 |
38 | VectorControl.prototype.updateConfig = function(desc) {
39 | $.each(this.subControls, function(i, control) {
40 | control.updateConfig(desc);
41 | });
42 | }
43 |
44 | VectorControl.prototype.init = function() {
45 | var self = this,
46 | items = {},
47 | labels = ["x", "y", "z", "w"];
48 | for (var i = 0; i < itemsCount; ++i)
49 | items[labels[i]] = this.itemRange(i);
50 | this.createControls(items);
51 | }
52 |
53 | return VectorControl;
54 | }
55 |
56 |
57 | Global.Controls.register("vec2", vectorControlFactory(2));
58 | Global.Controls.register("vec3", vectorControlFactory(3));
59 | Global.Controls.register("vec4", vectorControlFactory(4));
60 |
61 | })();
--------------------------------------------------------------------------------
/lib/controls/warp_control.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function WarpControl(delegate, name, config) {
20 | WarpControl.$super.call(this, delegate, name, config);
21 | this.init();
22 | }
23 |
24 | Global.Utils.extend(WarpControl).from(Global.BaseControl);
25 |
26 | WarpControl.prototype.init = function() {
27 | var desc = this.config,
28 | self = this;
29 |
30 | this.ctrl = $("
")
31 | .attr("id", "param-" + this.name);
32 |
33 | this.canvas = Global.WarpHelpers.buildWarpCanvas(this.ctrl, 180, 180, function() {
34 | self._onChange();
35 | });
36 | }
37 |
38 | WarpControl.prototype._onChange = function() {
39 | this.onValueChange();
40 | }
41 |
42 | WarpControl.prototype._updateControls = function() {
43 | var value = this.getValue();
44 | if (!(value instanceof Array) && !(value instanceof Global.ActiveCollection))
45 | return;
46 | this.canvas.setPoints(value);
47 | this.canvas.redraw();
48 | }
49 |
50 | WarpControl.prototype.pushControls = function(parent) {
51 | this.pushTableColumns(parent, this.ctrl);
52 | }
53 |
54 | Global.Controls.register("warp", WarpControl);
55 |
56 | })();
--------------------------------------------------------------------------------
/lib/models/filter.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function(){
18 |
19 | function Filter(name, config) {
20 | Filter.$super.call(this);
21 | this.name = name;
22 | this.config = config;
23 | this.active = false;
24 | }
25 |
26 | Global.Utils.extend(Filter).from(Global.EventDispatcher);
27 |
28 | $.extend(Filter.prototype, {
29 | filterType: function() {
30 | return this.config.type ? this.config.type.fn : "custom";
31 | },
32 |
33 | isBuiltin: function() {
34 | return this.config.isBuiltin;
35 | },
36 |
37 | isFork: function() {
38 | return !!this.config.isFork;
39 | },
40 |
41 | toggleFilter: function() {
42 | this.setActive(!this.active);
43 | },
44 |
45 | setActive: function(value) {
46 | if (this.active == value)
47 | return;
48 | this.active = value;
49 | this.fire("filterStateChanged", [this.active]);
50 | },
51 |
52 | setSource: function(value) {
53 | this.source = value;
54 | this.fire("filterSourceChanged", [value]);
55 | },
56 |
57 | valuesUpdated: function(paramName) {
58 | this.fire("valuesUpdated", [paramName]);
59 | },
60 |
61 | removeFilter: function() {
62 | this.fire("filterRemoved");
63 | }
64 | });
65 |
66 | Global.Filter = Filter;
67 |
68 | })();
--------------------------------------------------------------------------------
/lib/models/github.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function GitHub() {
20 | GitHub.$super.call(this);
21 | $(window).bind("message", this.onReceivedMesssage.bind(this));
22 | }
23 |
24 | Global.Utils.extend(GitHub).from(Global.EventDispatcher);
25 |
26 | $.extend(GitHub.prototype, {
27 | clientId: "9d5764d5b3fb3dbea0d6",
28 |
29 | url: "https://api.github.com",
30 | gistUrl: "https://gist.github.com",
31 | loginUrl: "https://github.com/login/oauth/authorize",
32 | tokenUrl: "https://github.com/login/oauth/access_token",
33 |
34 | postGist: function(access_token, id, publicGist, name, files, callback) {
35 | var xhr = new XMLHttpRequest(),
36 | data = {
37 | "description": name,
38 | "files": files
39 | },
40 | url = this.url + "/gists?client_id=" + encodeURIComponent(this.clientId),
41 | method = "POST";
42 | if (id) {
43 | url += "/" + encodeURIComponent(id);
44 | method = "PATCH";
45 | } else {
46 | data["public"] = publicGist;
47 | }
48 | if (access_token)
49 | url += "?access_token=" + encodeURIComponent(access_token);
50 | xhr.onreadystatechange = function() {
51 | if (xhr.readyState != 4)
52 | return;
53 | var response = JSON.parse(xhr.responseText);
54 | callback(response);
55 | };
56 |
57 | xhr.open(method, url);
58 | xhr.send(JSON.stringify(data));
59 | },
60 |
61 | readGist: function(url, callback) {
62 | var id = this.extractGistIdFromUrl(url);
63 | if (!id)
64 | return;
65 | var xhr = new XMLHttpRequest(),
66 | requestUrl = this.url + "/gists/" + encodeURIComponent(id) + "?client_id=" + encodeURIComponent(this.clientId);
67 | xhr.onreadystatechange = function() {
68 | if (xhr.readyState != 4 || xhr.status != 200)
69 | return;
70 | if (xhr.status == 400 || xhr.status == 404){
71 | callback(xhr.status, null)
72 | return;
73 | }
74 | var response = JSON.parse(xhr.responseText);
75 | callback(null, response);
76 | };
77 | xhr.open("GET", requestUrl);
78 | xhr.send(null);
79 | },
80 |
81 | _lastState: null,
82 | getLoginUrl: function() {
83 | this._lastState = Math.random();
84 | return this.loginUrl + "?client_id=" + encodeURIComponent(this.clientId) + "&scope=gist&state=" + encodeURIComponent(this._lastState);
85 | },
86 |
87 | onReceivedMesssage: function(event) {
88 | if (event.origin != location.origin)
89 | return;
90 | var data = event.data;
91 | if (data.state != this._lastState) {
92 | console.error("Invalid state read from github.")
93 | return;
94 | }
95 | if (!data.github.access_token) {
96 | this.fire("login", ["Invalid token"]);
97 | return;
98 | }
99 | this.fire("login", [null, data.github.access_token]);
100 | },
101 |
102 | // Extracts the gistId out of urls of the form:
103 | // https://gist.github.com/:userId/:gistId
104 | // https://gist.github.com/:userId/:gistId/ (A single trailing slash is allowed.)
105 | extractGistIdFromUrl: function(url)
106 | {
107 | var id = url.replace(new RegExp("^" + this.gistUrl + "/([^/]*)/([^/]*)/?$"), "$2");
108 | if (id == url) {
109 | // Nothing was extracted.
110 | return null;
111 | }
112 | return id;
113 | }
114 | });
115 |
116 | Global.GitHub = GitHub;
117 |
118 |
119 | })();
--------------------------------------------------------------------------------
/lib/models/keyframe.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function(){
18 |
19 | function Keyframe(filterList, time, value) {
20 | this.filterList = filterList;
21 | this.value = value;
22 | this.time = time;
23 | this.generated = false;
24 | }
25 |
26 | Keyframe.prototype = {
27 | makeGeneratedClone: function(time) {
28 | var keyframe = new Global.Keyframe(this.filterList, time, Global.Utils.clone(this.value));
29 | keyframe.generated = true;
30 | return keyframe;
31 | },
32 |
33 | blend: function(otherKeyframe, position, time) {
34 | var self = this,
35 | resultKeyframe = this.makeGeneratedClone(time),
36 | A = self.value,
37 | B = otherKeyframe.value,
38 | C = resultKeyframe.value;
39 | $.each(this.filterList.filters, function(index, filter) {
40 | if (!filter.active || filter.config.isLoading)
41 | return;
42 | var filterName = filter.name;
43 | C[filterName] = filter.config.blendParams(A[filterName], B[filterName], position);
44 | });
45 | return resultKeyframe;
46 | },
47 |
48 | getFilterValues: function(filter) {
49 | if (!this.value.hasOwnProperty(filter.name))
50 | this.value[filter.name] = {};
51 | return this.value[filter.name];
52 | },
53 |
54 | addFilterDefaultValue: function(filter) {
55 | this.value[filter.name] = Global.Utils.clone(filter.config.defaultValues());
56 | },
57 |
58 | removeFilterValue: function(filter) {
59 | delete this.value[filter.name];
60 | },
61 |
62 | updateKeyframeAfterConfigChange: function(filter, configChange) {
63 | var filterValues = this.getFilterValues(filter);
64 | $.each(configChange.deletedKeys, function(i, name) {
65 | delete filterValues[name];
66 | });
67 | $.each(configChange.addedValues, function(name, value) {
68 | if (filterValues.hasOwnProperty(name))
69 | return;
70 | filterValues[name] = value;
71 | });
72 | $.each(configChange.changedValues, function(name, value) {
73 | console.log("changed ", filter, name, value);
74 | filterValues[name] = value;
75 | });
76 | }
77 | };
78 |
79 | Global.Keyframe = Keyframe;
80 |
81 |
82 | })();
--------------------------------------------------------------------------------
/lib/utils/color_scheme.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function roundedValue(value) {
20 | if (typeof value == "number")
21 | return Math.round(value * 1000) / 1000;
22 | return value;
23 | }
24 |
25 | var noColoring = {
26 | parameterName: Global.Utils.identity,
27 | value: function(value, unit) {
28 | return roundedValue(value) + ((unit !== undefined) ? unit : "");
29 | },
30 | fn: function(fn, args) {
31 | var valueArgs = [];
32 | $.each(args, function(key, value) { valueArgs.push(noColoring.value(value)); });
33 | return fn + "(" + valueArgs.join(", ") + ")";
34 | },
35 | builtinFn: function(fn, args) {
36 | var valueArgs = [];
37 | $.each(args, function(key, value) { valueArgs.push(noColoring.value(value)); });
38 | return fn + "(" + valueArgs.join(" ") + ")";
39 | },
40 | uri: Global.Utils.identity,
41 | keyword: Global.Utils.identity,
42 | keyframe: function(percent, filters) {
43 | return percent + " {\n" +
44 | " -webkit-filter: " + filters.join(" ") + ";\n" +
45 | "}";
46 | }
47 | };
48 |
49 | var colorTheme = {
50 | parameterName: function(name) {
51 | return "
" + name + " ";
52 | },
53 | value: function(value, unit) {
54 | return "
" + roundedValue(value) + " " +
55 | ((unit !== undefined) ? ("
" + unit + " ") : "");
56 | },
57 | fn: function(fn, args) {
58 | var valueArgs = [];
59 | $.each(args, function(key, value) { valueArgs.push(colorTheme.value(value)); });
60 | return "
" + fn +
61 | " ( " +
62 | valueArgs.join(", ") + " ) ";
63 | },
64 | builtinFn: function(fn, args) {
65 | var valueArgs = [];
66 | $.each(args, function(key, value) { valueArgs.push(colorTheme.value(value)); });
67 | return "
" + fn +
68 | " ( " +
69 | valueArgs.join(" ") + " ) ";
70 | },
71 | _dataURL: /^data:/,
72 | uri: function(uri) {
73 | var className = "";
74 | if (this._dataURL.test(uri))
75 | className = " data-uri";
76 | return "
" + uri + " ";
77 | },
78 | keyword: function(value) {
79 | return "
" + value + " ";
80 | },
81 | keyframe: function(percent, filters) {
82 | return "
"+
83 | "
" + percent + " " +
84 | "
{ " +
85 | "
" +
86 | "-webkit-filter : " +
87 | filters.join(" ") +
88 | " ;
} ";
89 | }
90 | };
91 |
92 | Global.ColorSchemes = {
93 | noColoring: noColoring,
94 | colorTheme: colorTheme
95 | };
96 |
97 | })();
--------------------------------------------------------------------------------
/lib/utils/config.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function(){
18 |
19 | function Config() {
20 | }
21 | Global.Config = Config;
22 |
23 | Config.prototype.load = function(config) {
24 | this.filters = config;
25 | }
26 |
27 | })();
--------------------------------------------------------------------------------
/lib/utils/css_generators.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | Global.CSSGenerators = {};
20 |
21 | Global.CSSGenerators.identity = Global.Utils.identity;
22 |
23 | Global.CSSGenerators.transform = function(v, colors) {
24 | return [
25 | colors.fn("perspective", [colors.value(Global.Utils.checkDefaultNumber(v.perspective, 1000))]),
26 | colors.fn("scale", [colors.value(Global.Utils.checkDefaultNumber(v.scale, 1))]),
27 | colors.fn("rotateX", [colors.value(Global.Utils.checkDefaultNumber(v.rotationX, 0), "deg")]),
28 | colors.fn("rotateY", [colors.value(Global.Utils.checkDefaultNumber(v.rotationY, 0), "deg")]),
29 | colors.fn("rotateZ", [colors.value(Global.Utils.checkDefaultNumber(v.rotationZ, 0), "deg")])].join(" ");
30 | }
31 |
32 | Global.CSSGenerators.filterArray = function(values, colors) {
33 | return colors.fn("array", values);
34 | }
35 |
36 | Global.CSSGenerators.vector = function(values, colors) {
37 | return $.map(values, function(val) { return colors.value(val); }).join(" ");
38 | }
39 |
40 | Global.CSSGenerators.color = function(values, colors) {
41 | return colors.fn("rgba", $.map(values, function(val, index) {
42 | if (index < 3)
43 | return colors.value(Math.round(val * 255));
44 | return colors.value(val);
45 | }));
46 | }
47 |
48 | Global.CSSGenerators.warpArray = function(values, colors) {
49 | return Global.WarpHelpers.generateWarpArray(values, colors);
50 | }
51 |
52 | })();
--------------------------------------------------------------------------------
/lib/utils/event_dispatcher.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function EventDispatcher() {
20 | this._events = {};
21 | }
22 |
23 | EventDispatcher.prototype = {
24 | fire: function(name, data) {
25 | var listeners = this.getListenersList(name),
26 | self = this;
27 | if (!listeners)
28 | return;
29 | listeners = $.map(listeners, function(fn) { return fn; });
30 | $.each(listeners, function(i, fn) {
31 | if (data)
32 | fn.apply(this, data);
33 | else
34 | fn.call(this);
35 | });
36 | },
37 |
38 | getListenersList: function(name, create) {
39 | if (create && !this._events[name])
40 | this._events[name] = [];
41 | return this._events[name];
42 | },
43 |
44 | on: function(name, fn) {
45 | var listeners = this.getListenersList(name, true);
46 | if (listeners.indexOf(fn) != -1)
47 | return;
48 | listeners.push(fn);
49 | return fn;
50 | },
51 |
52 | off: function(name, fn) {
53 | var listeners = this.getListenersList(name),
54 | index = listeners.indexOf(fn);
55 | if (index == -1)
56 | return;
57 | listeners.splice(index, 1);
58 | return fn;
59 | }
60 | };
61 |
62 | Global.EventDispatcher = EventDispatcher;
63 |
64 | })();
--------------------------------------------------------------------------------
/lib/utils/local_storage.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function FileEntry(storage, path, name) {
20 | this.storage = storage;
21 | this.path = path;
22 | this.name = name;
23 | }
24 |
25 | FileEntry.prototype = {
26 | toURL: function(value) {
27 | return "data:text/plain;base64," + Global.Utils.encodeBase64(value || "");
28 | }
29 | };
30 |
31 | function LocalStorage() {
32 | this.storage = window.localStorage;
33 | this.files = this.readFileSystem();
34 | }
35 |
36 | LocalStorage.prototype = {
37 | descriptor: "filesystem",
38 |
39 | register: function(callback) {
40 | callback(this);
41 | },
42 |
43 | saveFileSystem: function() {
44 | if (!this.storage)
45 | return;
46 | this.storage.setItem(this.descriptor, JSON.stringify(this.files));
47 | },
48 |
49 | readFileSystem: function() {
50 | if (!this.storage)
51 | return null;
52 | var fileSystem = this.storage.getItem(this.descriptor);
53 | if (!fileSystem)
54 | return {
55 | root: {},
56 | filesCount: 0
57 | };
58 | return JSON.parse(fileSystem);
59 | },
60 |
61 | getDirectoryEntry: function(path, create) {
62 | if (!this.files)
63 | return;
64 | var entry = this.files.root;
65 | for (var i = 0; i < path.length; ++i) {
66 | var folderName = path[i];
67 | if (entry.hasOwnProperty(folderName)) {
68 | entry = entry[folderName];
69 | continue;
70 | }
71 | if (!create)
72 | return null;
73 | entry = entry[folderName] = {};
74 | }
75 | return entry;
76 | },
77 |
78 | splitPath: function(path) {
79 | return path.split("/");
80 | },
81 |
82 | saveFileEntry: function(entry, value) {
83 | if (!this.storage)
84 | return;
85 | var filePath = entry.path,
86 | fileName = entry.name,
87 | dirEntry = this.getDirectoryEntry(filePath, true);
88 | var key = dirEntry[fileName];
89 | if (!key) {
90 | var fileId = "file" + (++this.files.filesCount);
91 | key = dirEntry[fileName] = {
92 | fileId: fileId,
93 | name: fileName
94 | };
95 | this.saveFileSystem();
96 | }
97 | this.storage.setItem(key.fileId, value);
98 | },
99 |
100 | removeFileEntry: function(entry, value) {
101 | if (!this.storage)
102 | return;
103 | var filePath = entry.path,
104 | fileName = entry.name,
105 | dirEntry = this.getDirectoryEntry(filePath, true);
106 | var key = dirEntry[fileName];
107 | if (!key)
108 | return;
109 | delete dirEntry[fileName];
110 | this.saveFileSystem();
111 | this.storage.removeItem(key);
112 | },
113 |
114 | loadFileEntry: function(entry) {
115 | if (!this.storage)
116 | return null;
117 | var filePath = entry.path,
118 | fileName = entry.name,
119 | dirEntry = this.getDirectoryEntry(filePath, false);
120 | if (!dirEntry)
121 | return null;
122 | var key = dirEntry[fileName];
123 | if (!key)
124 | return null;
125 | return this.storage.getItem(key.fileId);
126 | },
127 |
128 | get: function(path, callback) {
129 | var self = this;
130 | this.getEntry(path,
131 | function(err, entry) {
132 | if (err) {
133 | callback(err);
134 | return;
135 | }
136 | self.readFile(entry, callback);
137 | });
138 | },
139 |
140 | getEntry: function(path, callback) {
141 | var filePath = this.splitPath(path),
142 | fileName = filePath.pop();
143 | callback(null, new FileEntry(this, filePath, fileName));
144 | },
145 |
146 | readFile: function(entry, callback) {
147 | callback(null, this.loadFileEntry(entry));
148 | },
149 |
150 | save: function(path, data, callback) {
151 | var self = this;
152 | this.getEntry(path, function(err, entry) {
153 | self.saveFileEntry(entry, data);
154 | if (callback)
155 | callback(null, entry);
156 | });
157 | },
158 |
159 | list: function(path, callback) {
160 | var filePath = this.splitPath(path),
161 | dirEntry = this.getDirectoryEntry(filePath, true),
162 | list = [],
163 | self = this;
164 | if (!dirEntry)
165 | return callback(null, []);
166 | $.each(dirEntry, function(i, entry) {
167 | list.push(new FileEntry(self, filePath, entry.name));
168 | });
169 | callback(null, list);
170 | },
171 |
172 | createDirectory: function(path, callback) {
173 | var filePath = this.splitPath(path),
174 | dirEntry = this.getDirectoryEntry(filePath, true);
175 | callback(null, path);
176 | },
177 |
178 | deleteFile: function(path, callback) {
179 | var self = this;
180 | this.getEntry(path, function(err, entry) {
181 | self.removeFileEntry(entry);
182 | callback(null);
183 | });
184 | }
185 | }
186 |
187 | Global.LocalStorage = LocalStorage;
188 | })();
--------------------------------------------------------------------------------
/lib/utils/mixers.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function(){
18 |
19 | var mixers = {
20 | mixNumber: function(a, b, t) {
21 | return a * (1 - t) + b * t;
22 | },
23 |
24 | mixVector: function(a, b, t) {
25 | var r = [];
26 | for (var i=0; i
")
30 | .addClass("panel-container")
31 | .data("item", this);
32 |
33 | this.tabListEl = $("
")
34 | .addClass("panel-tab-list")
35 | .appendTo(this.el);
36 | },
37 |
38 | add: function(panel) {
39 | this.items.push(panel);
40 | this.tabListEl.append(panel.tabEl);
41 | this.el.append(panel.el);
42 | panel.setContainer(this);
43 | if (this.items.length == 1)
44 | panel.setActive(true);
45 | return this;
46 | },
47 |
48 | setHeight: function(height) {
49 | this.el.css("-webkit-box-flex", "0")
50 | .css("-webkit-flex", 1)
51 | .css("height", height);
52 | return this;
53 | },
54 |
55 | setActiveTab: function(tab) {
56 | $.each(this.items, function(i, item) {
57 | if (item == tab)
58 | return;
59 | item.setActive(false);
60 | });
61 | },
62 |
63 | setIsDocumentArea: function() {
64 | this.isDocumentArea = true;
65 | return this;
66 | },
67 |
68 | addClass: function(className) {
69 | this.el.addClass(className)
70 | return this;
71 | },
72 |
73 | removeTabs: function() {
74 | this.tabListEl.remove()
75 | return this;
76 | },
77 |
78 | setFixed: function() {
79 | this.isFixed = true;
80 | return this;
81 | }
82 | });
83 |
84 | Global.DockContainer = DockContainer;
85 |
86 | })();
--------------------------------------------------------------------------------
/lib/views/dock_panel.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function DockPanel(name) {
20 | DockPanel.$super.call(this);
21 | this.name = name;
22 | this.initPanel();
23 | this.active = false;
24 | }
25 |
26 | Global.Utils.extend(DockPanel).from(Global.EventDispatcher);
27 |
28 | $.extend(DockPanel.prototype, {
29 | initPanel: function() {
30 | var self = this;
31 | this.el = $("
")
32 | .addClass("panel-view");
33 | this.tabEl = $("
")
34 | .addClass("panel-tab")
35 | .text(this.name)
36 | .click(function() {
37 | self.setActive(true);
38 | return false;
39 | });
40 | },
41 |
42 | setActive: function(active) {
43 | this.active = active;
44 | this.el.toggleClass("active", active);
45 | this.tabEl.toggleClass("active", active);
46 | if (active && this.container)
47 | this.container.setActiveTab(this);
48 | this.fire("activeStateChanged", [active]);
49 | },
50 |
51 | setContainer: function(container) {
52 | this.container = container;
53 | }
54 | });
55 |
56 | Global.DockPanel = DockPanel;
57 |
58 | })();
--------------------------------------------------------------------------------
/lib/views/dock_view.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function DockView(containerEl) {
20 | this.containerEl = containerEl.addClass("dock-root");
21 | DockView.$super.call(this, null, "horizontal");
22 | Global.DockView.UsingNewFlexBox = (containerEl.css("display") == "-webkit-flex");
23 | }
24 |
25 | Global.Utils.extend(DockView).from(Global.DockColumn);
26 |
27 | $.extend(DockView.prototype, {
28 | add: function(panel) {
29 | var column = this.addVerticalColumn();
30 | return column.add(panel);
31 | }
32 | });
33 |
34 | Global.DockView = DockView;
35 |
36 | })();
--------------------------------------------------------------------------------
/lib/views/filter_item_view.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function(){
18 |
19 | function FilterItemView(filter) {
20 | this.filter = filter;
21 | this.filter.on("filterStateChanged", this.onFilterStateChanged.bind(this));
22 | this.filter.on("filterSourceChanged", this.onFilterSourceChanged.bind(this));
23 | this.filter.config.on("configChanged", this.onFilterConfigChanged.bind(this));
24 | this.init();
25 | }
26 |
27 | FilterItemView.prototype = {
28 | init: function() {
29 | var self = this;
30 |
31 | this._buildParamsControls();
32 |
33 | this.el = (this.el || $("
"))
34 | .toggleClass("builtin-filter", this.filter.isBuiltin())
35 | .toggleClass("custom-filter", !this.filter.isBuiltin())
36 | .toggleClass("forked-filter", this.filter.isFork())
37 | .toggleClass('current', this.filter.active)
38 | .toggleClass('loading', !!this.filter.config.isLoading)
39 | .data("filterItemView", this);
40 |
41 | if (!this.deleteButton) {
42 | this.deleteButton = $("
").text("Delete").appendTo(this.el)
43 | .click(function() {
44 | self.filter.removeFilter();
45 | });
46 | }
47 |
48 | if (!this.dragPoint)
49 | this.dragPoint = $("
").appendTo(this.el);
50 |
51 | this.stateCheckbox = $("
")
52 | .click(function(e) {
53 | self.filter.toggleFilter();
54 | });
55 |
56 | if (!this.stateToggle)
57 | this.stateToggle = $("
")
58 | .append(this.stateCheckbox)
59 | .append($("")
60 | .append($("
"))
61 | )
62 | .appendTo(this.el)
63 |
64 | if (!this.labelEl) {
65 | this.labelEl = $("
")
66 | .appendTo(this.el)
67 | }
68 |
69 | this.labelEl.text(this.filter.config.label);
70 |
71 | if (!this.configEl)
72 | this.configEl = $("
").appendTo(this.el);
73 | this.configEl.empty().append(this.controlsEl);
74 | },
75 |
76 | onFilterConfigChanged: function() {
77 | this.init();
78 | },
79 |
80 | onFilterStateChanged: function(active) {
81 | if (active) {
82 | this.el.addClass('current');
83 | this.stateCheckbox.attr("checked", true)
84 | this.configEl.hide().slideDown(100);
85 | } else {
86 | this.el.removeClass('current');
87 | this.stateCheckbox.attr("checked", false)
88 | this.configEl.slideUp(100);
89 | }
90 | },
91 |
92 | /**
93 | * Builds shader controls for the given set of parameter values
94 | * and description
95 | */
96 | _buildParamsControls: function () {
97 | var table = $(""),
98 | self = this,
99 | controls = [],
100 | config = this.filter.config;
101 | this.controls = controls;
102 | this.controlsEl = table;
103 | if (config.isLoading)
104 | return;
105 | $.each(config.params, function (name) {
106 | var filterParam = config.config[name],
107 | type = filterParam.type || 'range';
108 | if (type == 'hidden' || type == "unknown")
109 | return;
110 |
111 | var EditorClass = Global.Controls.get(type);
112 | if (!EditorClass)
113 | return;
114 | var editor = new EditorClass(self, name, filterParam);
115 | controls.push({
116 | name: name,
117 | editor: editor
118 | });
119 | var tr = $(" ").appendTo(table).append(" " + name + ": ").addClass("progress-bar-interior").appendTo(this.progressBarEl);
23 | }
24 |
25 | LoadingProgressView.prototype = {
26 | setValue: function(value) {
27 | var progress = Math.round(Math.max(0, Math.min(1, value)) * 100) + "%";
28 | this.progressBarInteriorEl.css("width", progress);
29 | this.labelEl.text("Loading " + progress);
30 | },
31 | hide: function() {
32 | $(this.el).hide();
33 | }
34 | };
35 |
36 | Global.LoadingProgressView = LoadingProgressView;
37 |
38 | })();
--------------------------------------------------------------------------------
/lib/views/logo_view.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function LogoView(filterDock, filterStore) {
20 | this.filterDock = filterDock;
21 | this.filterStore = filterStore;
22 | this.filterDockToggleEl = $("#filter-store-toggle");
23 | this.importFilterEl = $("#import-filter");
24 | this.importFilterEl.click(this.onImportFilterClicked.bind(this));
25 | this.outsideLayerEl = $("
").addClass("clicks-catcher");
26 | this.dockPanel = new Global.DockPanel("Logo");
27 | this.logoEl = $("#logo").appendTo(this.dockPanel.el);
28 | this.init();
29 | }
30 |
31 | LogoView.prototype = {
32 | init: function() {
33 | this.filterDock.containerEl.hide();
34 | this.outsideLayerEl.click(this.hideFilterDock.bind(this));
35 | this.filterDockToggleEl.click(this.showFilterDock.bind(this));
36 | },
37 |
38 | showFilterDock: function() {
39 | this.filterDockToggleEl.addClass("selected");
40 |
41 | var offset = this.filterDockToggleEl.offset(),
42 | width = this.filterDockToggleEl.outerWidth(),
43 | height = this.filterDockToggleEl.outerHeight();
44 | this.filterDock.containerEl
45 | .css("left", offset.left + width / 2)
46 | .css("top", offset.top + height);
47 |
48 | this.filterDock.containerEl.show();
49 | this.filterDock.containerEl.before(this.outsideLayerEl);
50 |
51 | return false;
52 | },
53 |
54 | hideFilterDock: function() {
55 | this.filterDockToggleEl.removeClass("selected");
56 | this.outsideLayerEl.detach();
57 | this.filterDock.containerEl.hide();
58 |
59 | return false;
60 | },
61 |
62 | onImportFilterClicked: function() {
63 | var url = prompt("GitHub gist ID or url: ");
64 | if (!url)
65 | return;
66 | this.filterStore.loadFromGitHub(url, function(err, filter) {
67 | if (err)
68 | console.error(err);
69 | });
70 | }
71 | }
72 |
73 | Global.LogoView = LogoView;
74 |
75 | })();
--------------------------------------------------------------------------------
/lib/views/preset_store_view.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function PresetStoreView(presetStore) {
20 | this.presetStore = presetStore;
21 | this.dockPanel = new Global.DockPanel("Presets");
22 |
23 | this.activeAnimationEl = $("#active-animation");
24 | this.animationsEl = $("#animations");
25 | this.saveAsEl = $("#save-animation");
26 |
27 | this.animationsContainerEl = $("#animations-container").appendTo(this.dockPanel.el);
28 |
29 | this.presetsByName = {};
30 |
31 | this.outsideLayerEl = $("
").addClass("clicks-catcher");
32 |
33 | // move the animations el to the upper most layer
34 | this.animationsEl.appendTo(document.body);
35 |
36 | this.init();
37 | }
38 |
39 | PresetStoreView.prototype = {
40 | init: function() {
41 | this.saveAsEl.click(this.onSaveAsClicked.bind(this));
42 | this.presetStore.on("presetsLoaded", this.onPresetsLoaded.bind(this));
43 | this.presetStore.on("presetAdded", this.onPresetAdded.bind(this));
44 | this.presetStore.on("presetRemoved", this.onPresetRemoved.bind(this));
45 | this.presetStore.on("activePresetChanged", this.onActivePresetChanged.bind(this));
46 |
47 | this.animationsEl.hide();
48 | this.outsideLayerEl.click(this.hidePresets.bind(this));
49 | this.activeAnimationEl.click(this.showPresets.bind(this));
50 | },
51 |
52 | showPresets: function() {
53 | var topOffset = this.activeAnimationEl.offset(),
54 | height = this.activeAnimationEl.outerHeight(),
55 | width = this.activeAnimationEl.outerWidth();
56 | this.animationsEl.css("top", topOffset.top + height);
57 | this.animationsEl.css("left", topOffset.left);
58 | this.animationsEl.css("width", width);
59 | this.animationsEl.show();
60 | this.animationsEl.before(this.outsideLayerEl);
61 | },
62 |
63 | hidePresets: function() {
64 | this.animationsEl.hide();
65 | this.outsideLayerEl.detach();
66 | },
67 |
68 | enableSaveAs: function(){
69 | this.saveAsEl.removeClass('disabled');
70 | },
71 |
72 | onSaveAsClicked: function() {
73 | if (this.presetStore.savePresetAs())
74 | this.saveAsEl.addClass('disabled');
75 | return false;
76 | },
77 |
78 | onDeleteClicked: function(preset) {
79 | this.presetStore.deletePreset(preset);
80 | this.hidePresets();
81 | },
82 |
83 | onPresetsLoaded: function() {
84 | this.animationsContainerEl.show();
85 | },
86 |
87 | onPresetAdded: function(preset) {
88 | var key = "_" + preset;
89 | if (this.presetsByName.hasOwnProperty(key))
90 | return;
91 | var el = $("
")
92 | .append($('
')
93 | .text(preset)
94 | .append($('')
95 | .addClass('icon icon-remove')
96 | .click(function(){
97 | var message = "Are you sure you want to delete the '"+ preset +"' preset?";
98 | if(window.confirm(message))
99 | this.onDeleteClicked(preset)
100 | }.bind(this))
101 | )
102 | )
103 | .click(this.onPresetNameClicked.bind(this, preset))
104 | .appendTo(this.animationsEl);
105 | this.presetsByName[key] = el;
106 | return el;
107 | },
108 |
109 | onPresetNameClicked: function(preset) {
110 | this.hidePresets();
111 | this.presetStore.loadPreset(preset);
112 | return false;
113 | },
114 |
115 | onPresetRemoved: function(preset) {
116 | var key = "_" + preset,
117 | removedEl = this.presetsByName[key];
118 | if (!removedEl)
119 | return;
120 | delete this.presetsByName[key];
121 | removedEl.remove();
122 | },
123 |
124 | onActivePresetChanged: function(newPreset, oldPreset) {
125 | var oldEl = this.presetsByName["_" + oldPreset],
126 | newEl = this.presetsByName["_" + newPreset];
127 | if (oldEl)
128 | oldEl.removeClass("current");
129 | if (!newEl)
130 | newEl = this.onPresetAdded(newPreset);
131 | newEl.addClass("current");
132 | this.activeAnimationEl.text(newPreset);
133 | }
134 |
135 | };
136 |
137 | Global.PresetStoreView = PresetStoreView;
138 |
139 | })();
--------------------------------------------------------------------------------
/lib/views/shader_code_editor_view.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | (function() {
18 |
19 | function ShaderCodeEditorView(angleLib, shaderType, codeEditorEl, errorsPanelEl) {
20 | ShaderCodeEditorView.$super.call(this, codeEditorEl);
21 | this.angleLib = angleLib;
22 | this.shaderType = shaderType;
23 | this.codeEditorEl = codeEditorEl;
24 | this.errorsPanelEl = errorsPanelEl;
25 | this.lastCompileErrorMarkers = [];
26 | this.on("valueChanged", this.onShaderTextChanged.bind(this));
27 | }
28 |
29 | Global.Utils.extend(ShaderCodeEditorView).from(Global.CodeEditor);
30 |
31 | $.extend(ShaderCodeEditorView.prototype, {
32 |
33 | onShaderTextChanged: function(newValue) {
34 | var self = this;
35 |
36 | // Remove old errors.
37 | this.errorsPanelEl.empty();
38 | $.each(this.lastCompileErrorMarkers, function(i, error) {
39 | self.editor.clearMarker(error.gutterMarker);
40 | error.inlineMarker.clear();
41 | });
42 | this.lastCompileErrorMarkers = [];
43 |
44 | this.angleLib.compile(this.shaderType, newValue, function(err, data) {
45 | if (err) {
46 | console.error(err);
47 | return;
48 | }
49 |
50 | // If the code changed since we requested this result, just ignore it.
51 | if (data.original != self.getValue())
52 | return;
53 |
54 | if (!data.errors) {
55 | self.fire("uniformsDetected", [data.uniforms]);
56 | return;
57 | }
58 |
59 | $("
").addClass("header").text(Global.Utils.upperCaseFirstLetter(self.shaderType) +
60 | " shader errors").appendTo(self.errorsPanelEl);
61 |
62 | $.each(data.errors, function(i, error) {
63 | $(" ")
64 | .append($(" ").text(error.type))
65 | .append($(" ").text(error.error))
66 | .appendTo(self.errorsPanelEl);
67 |
68 | var pos = self.editor.posFromIndex(error.index),
69 | inlineMarker = self.editor.markText(pos, {line: pos.line, ch: pos.ch + 1}, "error-bookmark"),
70 | gutterMarker = self.editor.setMarker(pos.line, "%N%", "error-line");
71 | self.lastCompileErrorMarkers.push({
72 | inlineMarker: inlineMarker,
73 | gutterMarker: gutterMarker
74 | });
75 | });
76 | });
77 | }
78 |
79 | });
80 |
81 | Global.ShaderCodeEditorView = ShaderCodeEditorView;
82 |
83 | })();
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "CSSFilterLab",
3 | "version": "0.1.0",
4 | "author": {
5 | "name": "Adobe Systems Inc."
6 | },
7 | "licenses": [
8 | {
9 | "type": "Apache License 2.0"
10 | }
11 | ],
12 | "dependencies": {
13 | "grunt": "0.3.x",
14 | "grunt-contrib": "~0.2.0",
15 | "grunt-css": "~0.2.1",
16 | "grunt-contrib-sass": "~0.1.1",
17 | "ejs": "~0.8.3"
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "homepage": "http://html.adobe.com/webplatform/graphics/customfilters/",
3 | "third_party_libs": [
4 | "third_party/jquery/jquery-1.8.0.min.js",
5 | "third_party/jquery/jquery-ui-1.8.23.custom.min.js"
6 | ],
7 | "third_party_unminified_libs": [
8 | "third_party/CodeMirror/lib/codemirror.js",
9 | "third_party/CodeMirror/mode/clike/clike.js"
10 | ],
11 | "third_party_css": [
12 | "third_party/CodeMirror/lib/codemirror.css"
13 | ],
14 | "tests": [
15 | "tests/tests.js"
16 | ],
17 | "scripts": [
18 | "configs.js",
19 | "lib/utils/utils.js",
20 | "lib/utils/event_dispatcher.js",
21 | "lib/application.js",
22 | "lib/controls/base_control.js",
23 | "lib/controls/code_editor.js",
24 | "lib/controls/multi_control.js",
25 | "lib/controls/color_control.js",
26 | "lib/controls/checkbox_control.js",
27 | "lib/controls/vector_control.js",
28 | "lib/controls/editable_label.js",
29 | "lib/controls/range_control.js",
30 | "lib/controls/transform_control.js",
31 | "lib/controls/text_control.js",
32 | "lib/controls/warp_control.js",
33 | "lib/models/active_object.js",
34 | "lib/models/animation.js",
35 | "lib/models/preset_store.js",
36 | "lib/models/filter_config.js",
37 | "lib/models/filter.js",
38 | "lib/models/filter_store.js",
39 | "lib/models/filter_list.js",
40 | "lib/models/github.js",
41 | "lib/models/keyframe.js",
42 | "lib/utils/angle_lib.js",
43 | "lib/utils/color_scheme.js",
44 | "lib/utils/config.js",
45 | "lib/utils/css_generators.js",
46 | "lib/utils/local_storage.js",
47 | "lib/utils/mixers.js",
48 | "lib/utils/timer.js",
49 | "lib/utils/warp_helpers.js",
50 | "lib/views/filter_store_view.js",
51 | "lib/views/active_filter_list_view.js",
52 | "lib/views/css_code_view.js",
53 | "lib/views/filter_item_view.js",
54 | "lib/views/preset_store_view.js",
55 | "lib/views/loading_progress_view.js",
56 | "lib/views/logo_view.js",
57 | "lib/views/help_view.js",
58 | "lib/views/import_filter_view.js",
59 | "lib/views/shader_editor_view.js",
60 | "lib/views/shader_code_editor_view.js",
61 | "lib/views/timeline_view.js",
62 | "lib/views/dock_column.js",
63 | "lib/views/dock_view.js",
64 | "lib/views/dock_container.js",
65 | "lib/views/dock_panel.js"
66 | ],
67 | "components": [
68 | "html/filters-list.html",
69 | "html/fork-github.html",
70 | "html/header-bar.html",
71 | "html/logo.html",
72 | "html/main.html",
73 | "html/shader-editor.html",
74 | "html/timeline.html"
75 | ],
76 | "popups": [
77 | "html/browser-popup.html",
78 | "html/github-popup.html",
79 | "html/help-popup.html"
80 | ],
81 | "qunit": [
82 | "html/qunit.html"
83 | ],
84 | "qunit_lib": "http://code.jquery.com/qunit/qunit-1.10.0.js",
85 | "qunit_css": "http://code.jquery.com/qunit/qunit-1.10.0.css"
86 | }
87 |
--------------------------------------------------------------------------------
/shaders/fragment/burn.fs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | * Copyright (c) 2012 Branislav Ulicny
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | precision mediump float;
19 |
20 | /*
21 | * WebGL Noise (Start)
22 | * From: https://github.com/ashima/webgl-noise
23 | */
24 |
25 | /*
26 | * Copyright (C) 2011 by Ashima Arts (Simplex noise)
27 | * Copyright (C) 2011 by Stefan Gustavson (Classic noise)
28 | *
29 | * Permission is hereby granted, free of charge, to any person obtaining a copy
30 | * of this software and associated documentation files (the "Software"), to deal
31 | * in the Software without restriction, including without limitation the rights
32 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
33 | * copies of the Software, and to permit persons to whom the Software is
34 | * furnished to do so, subject to the following conditions:
35 | *
36 | * The above copyright notice and this permission notice shall be included in
37 | * all copies or substantial portions of the Software.
38 | *
39 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
42 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
44 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
45 | * THE SOFTWARE.
46 | */
47 |
48 | vec4 permute(vec4 x)
49 | {
50 | return mod(((x * 34.0) + 1.0) * x, 289.0);
51 | }
52 |
53 | vec4 taylorInvSqrt(vec4 r)
54 | {
55 | return 1.79284291400159 - 0.85373472095314 * r;
56 | }
57 |
58 | float snoise(vec3 v)
59 | {
60 | const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);
61 | const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
62 |
63 | // First corner
64 |
65 | vec3 i = floor(v + dot(v, C.yyy));
66 | vec3 x0 = v - i + dot(i, C.xxx);
67 |
68 | // Other corners
69 |
70 | vec3 g = step(x0.yzx, x0.xyz);
71 | vec3 l = 1.0 - g;
72 | vec3 i1 = min(g.xyz, l.zxy);
73 | vec3 i2 = max(g.xyz, l.zxy);
74 |
75 | vec3 x1 = x0 - i1 + 1.0 * C.xxx;
76 | vec3 x2 = x0 - i2 + 2.0 * C.xxx;
77 | vec3 x3 = x0 - 1. + 3.0 * C.xxx;
78 |
79 | // Permutations
80 |
81 | i = mod(i, 289.0);
82 | vec4 p = permute(permute(permute(
83 | i.z + vec4(0.0, i1.z, i2.z, 1.0))
84 | + i.y + vec4(0.0, i1.y, i2.y, 1.0))
85 | + i.x + vec4(0.0, i1.x, i2.x, 1.0));
86 |
87 | // Gradients
88 | // (N*N points uniformly over a square, mapped onto an octahedron.)
89 |
90 | float n_ = 1.0 / 7.0; // N=7
91 |
92 | vec3 ns = n_ * D.wyz - D.xzx;
93 |
94 | vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)
95 |
96 | vec4 x_ = floor(j * ns.z);
97 | vec4 y_ = floor(j - 7.0 * x_); // mod(j,N)
98 |
99 | vec4 x = x_ *ns.x + ns.yyyy;
100 | vec4 y = y_ *ns.x + ns.yyyy;
101 | vec4 h = 1.0 - abs(x) - abs(y);
102 |
103 | vec4 b0 = vec4(x.xy, y.xy);
104 | vec4 b1 = vec4(x.zw, y.zw);
105 |
106 |
107 | vec4 s0 = floor(b0) * 2.0 + 1.0;
108 | vec4 s1 = floor(b1) * 2.0 + 1.0;
109 | vec4 sh = -step(h, vec4(0.0));
110 |
111 | vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
112 | vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
113 |
114 | vec3 p0 = vec3(a0.xy, h.x);
115 | vec3 p1 = vec3(a0.zw, h.y);
116 | vec3 p2 = vec3(a1.xy, h.z);
117 | vec3 p3 = vec3(a1.zw, h.w);
118 |
119 | // Normalise gradients
120 |
121 | vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
122 | p0 *= norm.x;
123 | p1 *= norm.y;
124 | p2 *= norm.z;
125 | p3 *= norm.w;
126 |
127 | // Mix final noise value
128 |
129 | vec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);
130 | m = m * m;
131 | return 42.0 * dot(m*m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
132 | }
133 |
134 | /*
135 | * WebGL Noise (End)
136 | */
137 |
138 | // Uniforms passed in from CSS
139 |
140 | uniform float amount;
141 | uniform float randomSeed;
142 |
143 | // Varyings passed in from vertex shader
144 |
145 | varying vec2 v_uv;
146 |
147 | // Construct height map out of base noise function.
148 |
149 | float surface(vec2 p, float time)
150 | {
151 | vec3 coord = vec3(p, time);
152 |
153 | float n = 0.3;
154 |
155 | n += 0.5 * abs(snoise(coord * 128.0));
156 | n += 0.25 * abs(snoise(coord * 256.0));
157 | n += 0.125 * abs(snoise(coord * 512.0));
158 |
159 | return n;
160 | }
161 |
162 | // Main
163 |
164 | void main()
165 | {
166 | // Compute height.
167 | float n = surface(0.035 * v_uv, randomSeed);
168 |
169 | // Compute color.
170 | vec4 c = vec4(0.0);
171 |
172 | if (n < amount + 0.2) {
173 | c.rgb = vec3(n * 0.95);
174 | c.a = 1.0;
175 |
176 | if (n < 0.45)
177 | c.a = 0.0;
178 | } else if (n < amount + 0.275) {
179 | c = vec4(1.0, 0.5, 0.5, 1.0);
180 | } else {
181 | c = vec4(1.0);
182 | }
183 |
184 | css_ColorMatrix = mat4(c.r, 0.0, 0.0, 0.0,
185 | 0.0, c.g, 0.0, 0.0,
186 | 0.0, 0.0, c.b, 0.0,
187 | 0.0, 0.0, 0.0, c.a);
188 | }
189 |
--------------------------------------------------------------------------------
/shaders/fragment/crumple.fs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | * Copyright (c) 2012 Branislav Ulicny.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | precision mediump float;
19 |
20 | // Uniform values from CSS
21 |
22 | uniform float amount;
23 |
24 | // Varyings passed in from vertex shader
25 |
26 | varying vec2 v_uv;
27 | varying float v_height;
28 | varying float v_light;
29 |
30 | // Main
31 |
32 | void main()
33 | {
34 | const float a = 1.0;
35 | float r, g, b;
36 |
37 | // Depth variant
38 | /*
39 | float n = 1.0 - v_height;
40 | float v = mix(1.0, n, amount);
41 | r = g = b = v;
42 | */
43 |
44 | // Light variant
45 | float n = v_light;
46 | float v = mix(1.0, n * n, amount);
47 | r = g = b = sqrt(v);
48 |
49 | // Set color matrix
50 | css_ColorMatrix = mat4(r, 0.0, 0.0, 0.0,
51 | 0.0, g, 0.0, 0.0,
52 | 0.0, 0.0, b, 0.0,
53 | 0.0, 0.0, 0.0, a);
54 | }
55 |
--------------------------------------------------------------------------------
/shaders/fragment/curtains.fs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | precision mediump float;
18 |
19 | // Uniforms passed in from CSS
20 |
21 | uniform float amount;
22 |
23 | // Varyings
24 |
25 | varying float v_lighting;
26 | varying float xpos;
27 |
28 | // Main
29 |
30 | void main()
31 | {
32 | float alpha = abs(xpos) <= (amount * 0.5) ? 0.0 : 1.0;
33 |
34 | /* Remove any perspective artifacts */
35 | if (amount == 1.0) alpha = 0.0;
36 |
37 | css_ColorMatrix = mat4(
38 | vec4(v_lighting, 0.0, 0.0, 0.0),
39 | vec4(0.0, v_lighting, 0.0, 0.0),
40 | vec4(0.0, 0.0, v_lighting, 0.0),
41 | vec4(0.0, 0.0, 0.0, alpha)
42 | );
43 | }
44 |
--------------------------------------------------------------------------------
/shaders/fragment/dissolve.fs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | * Copyright (c) 2012 Branislav Ulicny
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | precision mediump float;
19 |
20 | /*
21 | * WebGL Noise (Start)
22 | * From: https://github.com/ashima/webgl-noise
23 | */
24 |
25 | /*
26 | * Copyright (C) 2011 by Ashima Arts (Simplex noise)
27 | * Copyright (C) 2011 by Stefan Gustavson (Classic noise)
28 | *
29 | * Permission is hereby granted, free of charge, to any person obtaining a copy
30 | * of this software and associated documentation files (the "Software"), to deal
31 | * in the Software without restriction, including without limitation the rights
32 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
33 | * copies of the Software, and to permit persons to whom the Software is
34 | * furnished to do so, subject to the following conditions:
35 | *
36 | * The above copyright notice and this permission notice shall be included in
37 | * all copies or substantial portions of the Software.
38 | *
39 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
42 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
44 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
45 | * THE SOFTWARE.
46 | */
47 |
48 | vec4 permute(vec4 x)
49 | {
50 | return mod(((x * 34.0) + 1.0) * x, 289.0);
51 | }
52 |
53 | vec4 taylorInvSqrt(vec4 r)
54 | {
55 | return 1.79284291400159 - 0.85373472095314 * r;
56 | }
57 |
58 | float snoise(vec3 v)
59 | {
60 | const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);
61 | const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
62 |
63 | // First corner
64 |
65 | vec3 i = floor(v + dot(v, C.yyy));
66 | vec3 x0 = v - i + dot(i, C.xxx);
67 |
68 | // Other corners
69 |
70 | vec3 g = step(x0.yzx, x0.xyz);
71 | vec3 l = 1.0 - g;
72 | vec3 i1 = min(g.xyz, l.zxy);
73 | vec3 i2 = max(g.xyz, l.zxy);
74 |
75 | vec3 x1 = x0 - i1 + 1.0 * C.xxx;
76 | vec3 x2 = x0 - i2 + 2.0 * C.xxx;
77 | vec3 x3 = x0 - 1. + 3.0 * C.xxx;
78 |
79 | // Permutations
80 |
81 | i = mod(i, 289.0);
82 | vec4 p = permute(permute(permute(
83 | i.z + vec4(0.0, i1.z, i2.z, 1.0))
84 | + i.y + vec4(0.0, i1.y, i2.y, 1.0))
85 | + i.x + vec4(0.0, i1.x, i2.x, 1.0));
86 |
87 | // Gradients
88 | // (N*N points uniformly over a square, mapped onto an octahedron.)
89 |
90 | float n_ = 1.0 / 7.0; // N=7
91 |
92 | vec3 ns = n_ * D.wyz - D.xzx;
93 |
94 | vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)
95 |
96 | vec4 x_ = floor(j * ns.z);
97 | vec4 y_ = floor(j - 7.0 * x_); // mod(j,N)
98 |
99 | vec4 x = x_ *ns.x + ns.yyyy;
100 | vec4 y = y_ *ns.x + ns.yyyy;
101 | vec4 h = 1.0 - abs(x) - abs(y);
102 |
103 | vec4 b0 = vec4(x.xy, y.xy);
104 | vec4 b1 = vec4(x.zw, y.zw);
105 |
106 |
107 | vec4 s0 = floor(b0) * 2.0 + 1.0;
108 | vec4 s1 = floor(b1) * 2.0 + 1.0;
109 | vec4 sh = -step(h, vec4(0.0));
110 |
111 | vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
112 | vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
113 |
114 | vec3 p0 = vec3(a0.xy, h.x);
115 | vec3 p1 = vec3(a0.zw, h.y);
116 | vec3 p2 = vec3(a1.xy, h.z);
117 | vec3 p3 = vec3(a1.zw, h.w);
118 |
119 | // Normalise gradients
120 |
121 | vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
122 | p0 *= norm.x;
123 | p1 *= norm.y;
124 | p2 *= norm.z;
125 | p3 *= norm.w;
126 |
127 | // Mix final noise value
128 |
129 | vec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);
130 | m = m * m;
131 | return 42.0 * dot(m*m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
132 | }
133 |
134 | /*
135 | * WebGL Noise (End)
136 | */
137 |
138 | // Uniforms passed in from CSS
139 |
140 | uniform float amount;
141 |
142 | // Varyings
143 |
144 | varying vec2 v_uv;
145 |
146 | // Construct height map out of base noise function
147 |
148 | float surface(vec2 p, float time)
149 | {
150 | vec3 coord = vec3(p, -time * 0.001125);
151 |
152 | float n = 0.5;
153 |
154 | //n += 0.5 * abs(snoise(coord * 128.0));
155 | n += 0.25 * abs(snoise(coord * 256.0));
156 | n += 0.5 * abs(snoise(coord * 512.0));
157 | n += 0.25 * abs(snoise(coord * 1024.0));
158 | //n += 0.125 * abs(snoise(coord * 2048.0));
159 |
160 | return n;
161 | }
162 |
163 | // Main
164 |
165 | void main()
166 | {
167 | float time = 0.075 + amount * 0.75;
168 | float n = surface(0.035 * v_uv, time) * v_uv.y;
169 | bool isVisible = (n >= 1.25 * amount);
170 | css_ColorMatrix = isVisible ? mat4(1.0) : mat4(0.0);
171 | }
172 |
--------------------------------------------------------------------------------
/shaders/fragment/fold.fs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | precision mediump float;
18 |
19 | // Uniforms passed in from CSS
20 |
21 | uniform vec4 backColor;
22 | uniform float useColoredBack;
23 |
24 | // Varyings
25 |
26 | varying float v_lighting;
27 |
28 | // Main
29 |
30 | void main()
31 | {
32 | if (!gl_FrontFacing && useColoredBack >= 0.5)
33 | css_MixColor = v_lighting * backColor;
34 | else
35 | css_MixColor = vec4(v_lighting);
36 | css_MixColor.a = 1.0;
37 | }
38 |
--------------------------------------------------------------------------------
/shaders/fragment/page-curl.fs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | precision mediump float;
18 |
19 | // Uniforms passed in from CSS.
20 |
21 | uniform float bleedThrough;
22 |
23 | // Varyings
24 |
25 | varying vec3 v_normal;
26 | varying float v_gradient;
27 |
28 | // Main
29 |
30 | void main()
31 | {
32 | if (gl_FrontFacing) {
33 | // Front shadows.
34 | css_MixColor = vec4(vec3(0.0), 1.0 - v_normal.z);
35 | } else {
36 | // Back shine.
37 | float gradient = clamp(v_gradient, 0.0, 1.0);
38 | css_MixColor = vec4(vec3(1.0), gradient * bleedThrough + (1.0 - bleedThrough));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/shaders/fragment/rolling-scroll.fs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | precision mediump float;
18 |
19 | // Uniforms passed in from CSS
20 |
21 | uniform vec4 backColor;
22 | uniform float useColoredBack;
23 |
24 | // Varyings
25 |
26 | varying float v_lighting;
27 |
28 | // Main.
29 |
30 | void main()
31 | {
32 | if (!gl_FrontFacing && useColoredBack >= 0.5)
33 | css_MixColor = backColor;
34 |
35 | css_MixColor *= vec4(vec3(v_lighting), 1.0);
36 | }
37 |
--------------------------------------------------------------------------------
/shaders/fragment/spherify.fs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | * Copyright (c) 2012 Branislav Ulicny
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | precision mediump float;
19 |
20 | // Uniforms passed in from CSS
21 |
22 | uniform float amount;
23 | uniform vec4 lightColor;
24 | uniform float ambientLight;
25 |
26 | // Varyings
27 |
28 | varying float v_light;
29 |
30 | // Main
31 |
32 | void main()
33 | {
34 | float lightIntensity = sqrt(v_light + ambientLight);
35 | css_MixColor = vec4(lightIntensity * lightColor.rgb, 1.0);
36 | }
37 |
--------------------------------------------------------------------------------
/shaders/fragment/tile-explosion.fs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | precision mediump float;
18 |
19 | // Uniforms passed in in from CSS
20 |
21 | uniform float t;
22 | uniform float fade;
23 |
24 | // Main
25 |
26 | void main()
27 | {
28 | // As t increases from [0 -> 0.5 -> 1],
29 | // fadeFactor increases and then decreases from [0 -> 1 -> 0].
30 | float fadeFactor = 2.0 * t;
31 | if (fadeFactor > 1.0)
32 | fadeFactor = 2.0 - fadeFactor;
33 |
34 | float currentFade = 1.0 - fadeFactor * fade;
35 | css_ColorMatrix = mat4(1.0);
36 | css_ColorMatrix[3][3] = currentFade;
37 | }
38 |
--------------------------------------------------------------------------------
/shaders/fragment/tile-flip.fs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | * Copyright (c) 2012 Branislav Ulicny
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | precision mediump float;
19 |
20 | // Uniform values from CSS
21 |
22 | uniform float amount;
23 | uniform float tileOutline;
24 |
25 | // Built-in uniforms
26 |
27 | uniform vec2 u_meshSize;
28 | uniform vec2 u_textureSize;
29 |
30 | // Varyings passed in from vertex shader
31 |
32 | varying float v_depth;
33 | varying vec2 v_uv;
34 |
35 | // Main
36 |
37 | void main()
38 | {
39 | // FIXME: Must swap x and y as a workaround for:
40 | // https://bugs.webkit.org/show_bug.cgi?id=96285
41 | vec2 u_meshSize = u_meshSize.yx;
42 |
43 | vec4 c = vec4(1.0);
44 |
45 | // Fade out.
46 | c.a = 1.0 - v_depth;
47 |
48 | // Show grid outline.
49 | if (tileOutline >= 0.5) {
50 | float cell_width = u_textureSize.x / u_meshSize.y;
51 | float cell_height = u_textureSize.y / u_meshSize.x;
52 | float dd = 1.0;
53 |
54 | if (mod(v_uv.x * u_textureSize.x + dd, cell_width) < 2.0
55 | || mod(v_uv.y * u_textureSize.y + dd, cell_height) < 2.0) {
56 | if (amount > 0.0)
57 | c.rgb = vec3(1.0 - sqrt(amount));
58 | }
59 | }
60 | css_ColorMatrix = mat4(c.r, 0.0, 0.0, 0.0,
61 | 0.0, c.g, 0.0, 0.0,
62 | 0.0, 0.0, c.b, 0.0,
63 | 0.0, 0.0, 0.0, c.a);
64 | }
65 |
--------------------------------------------------------------------------------
/shaders/fragment/tile-shuffle.fs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | void main()
18 | {
19 | }
20 |
--------------------------------------------------------------------------------
/shaders/fragment/warp.fs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | precision mediump float;
18 |
19 | // Uniforms passed in from CSS
20 |
21 | uniform vec4 backColor;
22 | uniform float useColoredBack;
23 |
24 | // Main
25 |
26 | void main()
27 | {
28 | if (!gl_FrontFacing && useColoredBack >= 0.5)
29 | css_MixColor = backColor;
30 | }
31 |
--------------------------------------------------------------------------------
/shaders/vertex/burn.vs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | * Copyright (c) 2012 Branislav Ulicny
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | precision mediump float;
19 |
20 | // Built-in attributes
21 |
22 | attribute vec4 a_position;
23 | attribute vec2 a_texCoord;
24 | attribute vec2 a_meshCoord;
25 |
26 | // Built-in uniforms
27 |
28 | uniform mat4 u_projectionMatrix;
29 |
30 | // Uniforms passed in from CSS
31 |
32 | uniform mat4 transform;
33 | uniform float amount;
34 |
35 | // Constants
36 |
37 | const float PI = 3.1415926;
38 |
39 | // Varyings
40 |
41 | varying vec2 v_uv;
42 |
43 | // Main
44 |
45 | void main()
46 | {
47 | float curve = abs(cos(a_meshCoord.x * PI * 6.0));
48 |
49 | vec4 pos = a_position;
50 | pos.z = 100.0 * amount * (curve - 1.0);
51 |
52 | gl_Position = u_projectionMatrix * transform * pos;
53 |
54 | v_uv = a_texCoord;
55 | }
56 |
--------------------------------------------------------------------------------
/shaders/vertex/curtains.vs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | precision mediump float;
18 |
19 | // Built-in attributes.
20 |
21 | attribute vec4 a_position;
22 | attribute vec2 a_texCoord;
23 | attribute vec2 a_meshCoord;
24 |
25 | // Built-in uniforms.
26 |
27 | uniform mat4 u_projectionMatrix;
28 | uniform vec2 u_textureSize;
29 |
30 | // Uniforms passed-in from CSS
31 |
32 | uniform mat4 transform;
33 | uniform float numFolds;
34 | uniform float foldSize;
35 | uniform float amount;
36 |
37 | // Varyings
38 |
39 | varying float v_lighting;
40 | varying float xpos;
41 |
42 | // Constants
43 |
44 | const float PI = 3.1415629;
45 |
46 | // Main
47 |
48 | void main()
49 | {
50 | vec4 pos = a_position;
51 |
52 | pos.x += (pos.x < 0.0 ? -1.0 : 1.0) * amount * (0.5 - abs(pos.x));
53 | xpos = pos.x;
54 |
55 | float cyclePos = sin(abs(a_position.x) * PI * 4.0 * numFolds);
56 | pos.z = foldSize * amount * cyclePos * 16.0;
57 |
58 | v_lighting = max(1.0 - amount, 0.5 * (cyclePos + 1.0));
59 |
60 | gl_Position = u_projectionMatrix * transform * pos;
61 | }
62 |
--------------------------------------------------------------------------------
/shaders/vertex/dissolve.vs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | * Copyright (c) 2012 Branislav Ulicny
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | precision mediump float;
19 |
20 | // Built-in attributes
21 |
22 | attribute vec4 a_position;
23 | attribute vec2 a_texCoord;
24 | attribute vec2 a_meshCoord;
25 |
26 | // Built-in uniforms
27 |
28 | uniform vec2 u_meshSize;
29 | uniform mat4 u_projectionMatrix;
30 |
31 | // Uniforms passed in from CSS
32 |
33 | uniform mat4 transform;
34 | uniform float amount;
35 |
36 | // Varyings
37 |
38 | varying vec2 v_uv;
39 |
40 | // Main
41 |
42 | void main()
43 | {
44 | vec4 pos = a_position;
45 | gl_Position = u_projectionMatrix * transform * pos;
46 | v_uv = a_texCoord;
47 | }
48 |
--------------------------------------------------------------------------------
/shaders/vertex/fold.vs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | precision mediump float;
18 |
19 | // Built-in attributes.
20 |
21 | attribute vec4 a_position;
22 | attribute vec2 a_texCoord;
23 | attribute vec2 a_meshCoord;
24 |
25 | // Built-in uniforms.
26 |
27 | uniform mat4 u_projectionMatrix;
28 | uniform vec2 u_textureSize;
29 |
30 | // Uniforms passed-in from CSS
31 |
32 | uniform mat4 transform;
33 |
34 | uniform float direction;
35 |
36 | uniform float mapDepth;
37 | uniform float mapCurve;
38 | uniform float minSpacing;
39 |
40 | uniform float t;
41 | uniform float spins;
42 | uniform float phase;
43 | uniform float shadow;
44 |
45 | // Varyings
46 |
47 | varying float v_lighting;
48 |
49 | // Constants
50 |
51 | const float PI = 3.1415629;
52 |
53 | // Main
54 |
55 | void main()
56 | {
57 | vec4 pos = a_position;
58 | pos.z = -cos(a_meshCoord.x * PI * 8.0) * mapDepth * t - mapDepth * t / 2.0;
59 |
60 | float scaleX = mix(t - mapCurve, 1.0, sin(a_meshCoord.y * PI * spins + phase));
61 | scaleX = mix(1.0, minSpacing, t * scaleX);
62 |
63 | pos.x = pos.x * scaleX;
64 |
65 | v_lighting = min(1.0, cos(a_meshCoord.x * PI * 8.0 + PI) + shadow);
66 |
67 | gl_Position = u_projectionMatrix * transform * pos;
68 | }
69 |
--------------------------------------------------------------------------------
/shaders/vertex/page-curl.vs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /*
18 | * This shader is largely based on XBPageCurl.
19 | * From: https://github.com/xissburg/XBPageCurl
20 | *
21 | * XBPageCurl's copyright notice and license is included below.
22 | */
23 |
24 | /*
25 | * Copyright (C) 2011 xissburg, http://xissburg.com
26 | *
27 | * Permission is hereby granted, free of charge, to any person obtaining a copy
28 | * of this software and associated documentation files (the "Software"), to deal
29 | * in the Software without restriction, including without limitation the rights
30 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31 | * copies of the Software, and to permit persons to whom the Software is
32 | * furnished to do so, subject to the following conditions:
33 | *
34 | * The above copyright notice and this permission notice shall be included in
35 | * all copies or substantial portions of the Software.
36 | *
37 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
43 | */
44 |
45 | precision mediump float;
46 |
47 | // Built-in attributes
48 |
49 | attribute vec4 a_position;
50 | attribute vec2 a_texCoord;
51 |
52 | // Built-in uniforms
53 |
54 | uniform mat4 u_projectionMatrix;
55 |
56 | // Uniforms passed in from CSS
57 |
58 | uniform mat4 transform;
59 | uniform vec2 curlPosition;
60 | uniform float curlDirection;
61 | uniform float curlRadius;
62 |
63 | // Varyings
64 |
65 | varying vec3 v_normal;
66 | varying float v_gradient;
67 |
68 | // Constants
69 |
70 | const float PI = 3.1415926;
71 |
72 | // Helper functions
73 |
74 | float rad(float deg)
75 | {
76 | return deg * PI / 180.0;
77 | }
78 |
79 | // Main
80 |
81 | void main()
82 | {
83 | vec4 position = a_position;
84 |
85 | // Turn the curl direction into a vector.
86 | float radCurlDirection = rad(curlDirection);
87 | vec2 curlDirection = normalize(vec2(cos(radCurlDirection), sin(radCurlDirection)));
88 |
89 | vec2 n = vec2(curlDirection.y, -curlDirection.x);
90 | vec2 w = position.xy - curlPosition;
91 | float d = dot(w, n);
92 |
93 | vec2 dv = n * (2.0*d - PI*curlRadius);
94 | // Projection angle (dr)
95 | float dr = d/curlRadius;
96 | float s = sin(dr);
97 | float c = cos(dr);
98 | // Projection of vertex on the curl axis projected on the xy plane (proj)
99 | vec2 proj = position.xy - n*d;
100 | vec3 center = vec3(proj, curlRadius);
101 |
102 | // d > 0.0 (br1)
103 | float br1 = clamp(sign(d), 0.0, 1.0);
104 | // d > PI*u_curlRadius (br2)
105 | float br2 = clamp(sign(d - PI*curlRadius), 0.0, 1.0);
106 |
107 | vec3 vProj = vec3(s*n.x, s*n.y, 1.0 - c)*curlRadius;
108 | vProj.xy += proj;
109 | vec4 v = mix(position, vec4(vProj, position.w), br1);
110 | v = mix(v, vec4(position.x - dv.x, position.y - dv.y, 2.0*curlRadius, a_position.w), br2);
111 |
112 | v_normal = mix(vec3(0.0, 0.0, 1.0), (center - v.xyz)/curlRadius, br1);
113 | v_normal = mix(v_normal, vec3(0.0, 0.0, -1.0), br2);
114 | v_normal = normalize(v_normal);
115 |
116 | // Scale the z axis appropriately for perspective values around 1000.
117 | v.z *= 500.0;
118 |
119 | // Position the vertex.
120 | gl_Position = u_projectionMatrix * transform * v;
121 |
122 | // Pass the backface gradient intensity to the fragment shader.
123 | vec2 vw = v.xy - curlPosition;
124 | float vd = dot(vw, -n);
125 | v_gradient = -vd/curlRadius;
126 | }
127 |
--------------------------------------------------------------------------------
/shaders/vertex/spherify.vs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | * Copyright (c) 2012 Branislav Ulicny
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | precision mediump float;
19 |
20 | // Built-in attributes
21 |
22 | attribute vec4 a_position;
23 | attribute vec2 a_texCoord;
24 | attribute vec2 a_meshCoord;
25 |
26 | // Built-in uniforms
27 |
28 | uniform vec2 u_textureSize;
29 | uniform mat4 u_projectionMatrix;
30 |
31 | // Uniforms passed in from CSS
32 |
33 | uniform mat4 transform;
34 | uniform float amount;
35 | uniform float sphereRadius;
36 | uniform vec3 sphereAxis;
37 | uniform float sphereRotation;
38 | uniform vec3 lightPosition;
39 |
40 | // Varyings
41 |
42 | varying float v_light;
43 |
44 | // Constants
45 |
46 | const float PI = 3.1415926;
47 |
48 | // Helpers.
49 |
50 | float rad(float deg)
51 | {
52 | return deg * PI / 180.0;
53 | }
54 |
55 | // Rotate vector.
56 |
57 | vec3 rotateVectorByQuaternion(vec3 v, vec4 q)
58 | {
59 | vec3 dest = vec3(0.0);
60 |
61 | float x = v.x, y = v.y, z = v.z;
62 | float qx = q.x, qy = q.y, qz = q.z, qw = q.w;
63 |
64 | // Calculate quaternion * vector.
65 | float ix = qw * x + qy * z - qz * y,
66 | iy = qw * y + qz * x - qx * z,
67 | iz = qw * z + qx * y - qy * x,
68 | iw = -qx * x - qy * y - qz * z;
69 |
70 | // Calculate result * inverse quaternion.
71 | dest.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
72 | dest.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
73 | dest.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
74 |
75 | return dest;
76 | }
77 |
78 | // Convert rotation.
79 |
80 | vec4 axisAngleToQuaternion(vec3 axis, float angle)
81 | {
82 | vec4 dest = vec4(0.0);
83 |
84 | float halfAngle = angle / 2.0;
85 | float s = sin(halfAngle);
86 |
87 | dest.x = axis.x * s;
88 | dest.y = axis.y * s;
89 | dest.z = axis.z * s;
90 | dest.w = cos(halfAngle);
91 |
92 | return dest;
93 | }
94 |
95 | vec3 computeSpherePosition(vec3 p, vec2 uv, float r)
96 | {
97 | vec3 np;
98 |
99 | float ro = uv.x * 2.0 * PI + PI * 0.5;
100 | float fi = uv.y * PI;
101 |
102 | np.x = r * sin(fi) * cos(ro);
103 | np.z = -r * sin(fi) * sin(ro);
104 | np.y = r * cos(fi);
105 |
106 | return np;
107 | }
108 |
109 | vec3 rotatePosition(vec3 p, float aspect, vec3 axis, float angle)
110 | {
111 | vec3 centroid = vec3(0.0, 0.0, 0.0);
112 |
113 | float r = amount * angle;
114 |
115 | vec4 rotation = vec4(axis, r);
116 | vec4 qRotation = axisAngleToQuaternion(normalize(rotation.xyz), rotation.w);
117 |
118 | vec3 pos = rotateVectorByQuaternion((p - centroid) * vec3(aspect, 1.0, 1.0), qRotation) * vec3(1.0/aspect, 1.0, 1.0) + centroid;
119 |
120 | return pos;
121 | }
122 |
123 | // Main
124 |
125 | void main()
126 | {
127 | vec4 position = a_position;
128 | float aspect = u_textureSize.x / u_textureSize.y;
129 |
130 | // Map plane to sphere using UV coordinates.
131 | vec3 spherePosition = computeSpherePosition(position.xyz, vec2(a_texCoord.x, 1.0 - a_texCoord.y), sphereRadius);
132 | spherePosition *= vec3(1.0 / aspect, 1.0, 1.0);
133 |
134 | // Blend plane and sphere.
135 | position.xyz = mix(position.xyz, spherePosition, amount);
136 |
137 | // Rotate sphere.
138 | position.xyz = rotatePosition(position.xyz, aspect, sphereAxis, rad(sphereRotation));
139 |
140 | // Set vertex position.
141 | gl_Position = u_projectionMatrix * transform * position;
142 |
143 | // Compute lighting.
144 | vec3 lightPosNorm = normalize(lightPosition);
145 | vec3 planeNormal = lightPosNorm;
146 | vec3 sphereNormal = normalize(position.xyz);
147 | vec3 normal = normalize(mix(planeNormal, sphereNormal, amount));
148 | float intensity = mix(1.0, 2.5, amount);
149 | float light = intensity * max(dot(normal, lightPosNorm), 0.0);
150 |
151 | // Pass varying to fragment shader.
152 | v_light = light;
153 | }
154 |
--------------------------------------------------------------------------------
/shaders/vertex/tile-explosion.vs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | precision mediump float;
18 |
19 | // Built-in attributes
20 |
21 | attribute vec4 a_position;
22 | attribute vec2 a_texCoord;
23 | attribute vec2 a_meshCoord;
24 | attribute vec3 a_triangleCoord;
25 |
26 | // Built-in uniforms
27 |
28 | uniform vec4 u_meshBox;
29 | uniform vec2 u_tileSize;
30 | uniform vec2 u_meshSize;
31 |
32 | uniform mat4 u_projectionMatrix;
33 | uniform vec2 u_textureSize;
34 |
35 | // Uniforms passed in from CSS
36 |
37 | uniform mat4 transform;
38 | uniform float t;
39 | uniform float explosiveness;
40 | uniform vec3 tileRotation;
41 | uniform vec2 center;
42 |
43 | // Constants
44 |
45 | // Noise used to have the tiles move a little bit when they are out of the explosion sphere.
46 | const float noise = 200.0;
47 |
48 | // Helper functions
49 |
50 | mat4 translate(vec3 t) {
51 | return mat4(
52 | 1.0, 0.0, 0.0, 0.0,
53 | 0.0, 1.0, 0.0, 0.0,
54 | 0.0, 0.0, 1.0, 0.0,
55 | t.x, t.y, t.z, 1.0);
56 | }
57 |
58 | mat4 rotateX(float f) {
59 | return mat4(
60 | 1.0, 0.0, 0.0, 0.0,
61 | 0.0, cos(f), sin(f), 0.0,
62 | 0.0, -sin(f), cos(f), 0.0,
63 | 0.0, 0.0, 0.0, 1.0);
64 | }
65 |
66 | mat4 rotateY(float f) {
67 | return mat4(
68 | cos(f), 0.0, -sin(f), 0.0,
69 | 0.0, 1.0, 0.0, 0.0,
70 | sin(f), 0, cos(f), 0.0,
71 | 0.0, 0.0, 0.0, 1.0);
72 | }
73 |
74 | mat4 rotateZ(float f) {
75 | return mat4(
76 | cos(f), sin(f), 0.0, 0.0,
77 | -sin(f), cos(f), 0.0, 0.0,
78 | 0.0, 0.0, 1.0, 0.0,
79 | 0.0, 0.0, 0.0, 1.0);
80 | }
81 |
82 | mat4 scale(vec3 f) {
83 | return mat4(
84 | f.x, 0.0, 0.0, 0.0,
85 | 0.0, f.y, 0.0, 0.0,
86 | 0.0, 0.0, f.z, 0.0,
87 | 0.0, 0.0, 0.0, 1.0);
88 | }
89 |
90 | mat4 rotate(vec3 a) {
91 | return rotateX(a.x) * rotateY(a.y) * rotateZ(a.z);
92 | }
93 |
94 | // Random function based on the tile coordinate. This will return the same value
95 | // for all the vertices in the same tile (i.e., two triangles).
96 |
97 | float random(vec2 scale)
98 | {
99 | // Use the fragment position for a different seed per-pixel.
100 | return fract(sin(dot(vec2(a_triangleCoord.x, a_triangleCoord.y), scale)) * 4000.0);
101 | }
102 |
103 | // Main
104 |
105 | // This effect is using a center point for an 'explosion' effect. The further a point is from the
106 | // center, the more it moves along the x and y axis, radially. The closer to the explosion, the move
107 | // the point moves along the z axis.
108 |
109 | void main()
110 | {
111 | // r is dependent on the tile coordinates.
112 | float r = random(vec2(10.0, 80.0));
113 |
114 | // Complete tile transform
115 | mat4 ttfx = mat4(1.0);
116 |
117 | // R is the explosion sphere radius
118 | float p = 2.0 * t;
119 | if (p > 1.0)
120 | p = 2.0 - p;
121 |
122 | float R2 = p * max(u_textureSize.x, u_textureSize.y);
123 | R2 *= R2;
124 |
125 | float dx = abs(center.x - a_meshCoord.x) * u_textureSize.x;
126 | float dy = abs(center.y - a_meshCoord.y) * u_textureSize.y;
127 | float d2 = dx * dx + dy * dy;
128 |
129 | // Find the tile center.
130 | vec3 trc = vec3(u_meshBox.x + u_tileSize.x * (a_triangleCoord.x + 0.5),
131 | u_meshBox.y + u_tileSize.y * (a_triangleCoord.y + 0.5),
132 | 0.0);
133 |
134 | // Rotate about the tile center along the z-axis
135 | ttfx = translate(trc) *
136 | rotate(radians(vec3(tileRotation.x * r * p, 2.0 * tileRotation.y * r * p, 0.5 * r * p * tileRotation.z))) *
137 | translate(-trc);
138 |
139 | ttfx = translate(vec3(0.0, 0.0, p * explosiveness * sqrt(abs(R2 - d2)) * (0.8 + 0.4 * r))) * ttfx;
140 | ttfx = translate(vec3(0.0, 0.0, (-0.5 + r) * noise * p)) * ttfx;
141 |
142 | gl_Position = u_projectionMatrix * transform * ttfx * a_position;
143 | }
144 |
--------------------------------------------------------------------------------
/shaders/vertex/tile-flip.vs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c)2012 Adobe Systems Incorporated. All rights reserved.
3 | * Copyright (c)2012 Branislav Ulicny
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | precision mediump float;
19 |
20 | // Built-in attributes
21 |
22 | attribute vec4 a_position;
23 | attribute vec2 a_texCoord;
24 | attribute vec3 a_triangleCoord;
25 |
26 | // Built-in uniforms
27 |
28 | uniform mat4 u_projectionMatrix;
29 | uniform vec2 u_meshSize;
30 | uniform vec2 u_textureSize;
31 |
32 | // Uniform passed in from CSS
33 |
34 | uniform mat4 transform;
35 | uniform float amount;
36 | uniform float randomness;
37 | uniform vec3 flipAxis;
38 |
39 | // Varyings
40 |
41 | varying float v_depth;
42 | varying vec2 v_uv;
43 |
44 | // Constants
45 |
46 | const float PI2 = 1.5707963267948966;
47 |
48 | // Create perspective matrix
49 |
50 | mat4 perspectiveMatrix(float p)
51 | {
52 | float perspective = - 1.0 / p;
53 | return mat4(
54 | 1.0, 0.0, 0.0, 0.0,
55 | 0.0, 1.0, 0.0, 0.0,
56 | 0.0, 0.0, 1.0, perspective,
57 | 0.0, 0.0, 0.0, 1.0
58 | );
59 | }
60 |
61 | // Rotate vector
62 |
63 | vec3 rotateVectorByQuaternion(vec3 v, vec4 q)
64 | {
65 | vec3 dest = vec3(0.0);
66 |
67 | float x = v.x, y = v.y, z = v.z;
68 | float qx = q.x, qy = q.y, qz = q.z, qw = q.w;
69 |
70 | // Calculate quaternion * vector.
71 |
72 | float ix = qw * x + qy * z - qz * y,
73 | iy = qw * y + qz * x - qx * z,
74 | iz = qw * z + qx * y - qy * x,
75 | iw = -qx * x - qy * y - qz * z;
76 |
77 | // Calculate result * inverse quaternion.
78 |
79 | dest.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;
80 | dest.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;
81 | dest.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;
82 |
83 | return dest;
84 | }
85 |
86 | // Convert rotation.
87 |
88 | vec4 axisAngleToQuaternion(vec3 axis, float angle)
89 | {
90 | vec4 dest = vec4(0.0);
91 |
92 | float halfAngle = angle / 2.0;
93 | float s = sin(halfAngle);
94 |
95 | dest.x = axis.x * s;
96 | dest.y = axis.y * s;
97 | dest.z = axis.z * s;
98 | dest.w = cos(halfAngle);
99 |
100 | return dest;
101 | }
102 |
103 | // Random function based on the tile coordinate.
104 | // This will return the same value for all the vertices in the same tile (i.e. two triangles).
105 |
106 | float random(vec2 scale)
107 | {
108 | // Use the fragment position as a different seed per-pixel.
109 | return fract(sin(dot(vec2(a_triangleCoord.x, a_triangleCoord.y), scale)) * 4000.0);
110 | }
111 |
112 | // Main
113 |
114 | void main()
115 | {
116 | // FIXME: We must swap x and y as a workaround for:
117 | // https://bugs.webkit.org/show_bug.cgi?id=96285
118 | vec2 u_meshSize = u_meshSize.yx;
119 |
120 | vec4 pos = a_position;
121 | float aspect = u_textureSize.x / u_textureSize.y;
122 |
123 | float cx = a_triangleCoord.x / u_meshSize.y - 0.5 + 0.5 / u_meshSize.y;
124 | float cy = a_triangleCoord.y / u_meshSize.x - 0.5 + 0.5 / u_meshSize.x;
125 |
126 | vec3 centroid = vec3(cx, cy, 0.0);
127 | float r = random(vec2(10.0, 80.0));
128 | float rr = mix(0.0, PI2, amount * (1.0 + randomness * r));
129 |
130 | vec4 rotation = vec4(flipAxis, rr);
131 | vec4 qRotation = axisAngleToQuaternion(normalize(rotation.xyz), rotation.w);
132 |
133 | vec3 newPosition = rotateVectorByQuaternion((pos.xyz - centroid)* vec3(aspect, 1., 1.0), qRotation) * vec3(1.0 / aspect, 1.0, 1.0) + centroid;
134 | pos.xyz = newPosition;
135 |
136 | gl_Position = u_projectionMatrix * transform * pos;
137 |
138 | // Pass varyings to the fragment shader.
139 | v_depth = abs(rr)/ PI2;
140 | v_uv = a_texCoord;
141 | }
142 |
--------------------------------------------------------------------------------
/shaders/vertex/tile-shuffle.vs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | precision mediump float;
18 |
19 | // Built-in attributes
20 |
21 | attribute vec4 a_position;
22 | attribute vec2 a_texCoord;
23 | attribute vec3 a_triangleCoord;
24 |
25 | // Uniforms
26 |
27 | uniform mat4 u_projectionMatrix;
28 | uniform vec2 u_textureSize;
29 |
30 | // Uniforms passed in from CSS
31 |
32 | uniform mat4 matrix;
33 | uniform float t;
34 | uniform float amount;
35 |
36 | // Random function based on the tile coordinate. This will return the same value
37 | // for all the vertices in the same tile (i.e., two triangles).
38 |
39 | float random(vec2 scale)
40 | {
41 | // Use the fragment position for a different seed per-pixel.
42 | return fract(sin(dot(vec2(a_triangleCoord.x, a_triangleCoord.y), scale)) * 4000.0);
43 | }
44 |
45 | // Main
46 |
47 | void main()
48 | {
49 | float r = random(vec2(10.0, 80.0));
50 |
51 | vec4 pos = a_position;
52 |
53 | float dz = -amount * t * r;
54 | vec3 tc = a_triangleCoord;
55 |
56 | if (mod(tc.x + tc.y, 2.0) == 0.0) {
57 | dz = amount * t * r;
58 | }
59 |
60 | pos.z += dz;
61 |
62 | gl_Position = u_projectionMatrix * matrix * pos;
63 | }
64 |
--------------------------------------------------------------------------------
/shaders/vertex/warp.vs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | precision mediump float;
18 |
19 | // Built-in attributes
20 |
21 | attribute vec2 a_meshCoord;
22 |
23 | // Built-in uniforms
24 |
25 | uniform mat4 u_projectionMatrix;
26 | uniform vec4 u_meshBox;
27 |
28 | // Constants
29 |
30 | const int cols = 4;
31 | const int rows = 4;
32 | const int n = rows - 1;
33 | const int m = cols - 1;
34 |
35 | // Uniforms passed in from CSS
36 |
37 | uniform mat4 matrix;
38 | uniform float k[cols * rows * 3];
39 |
40 | // Helper functions
41 |
42 | float factor_fn(int n)
43 | {
44 | return (n < 2) ? 1.0 : ((n < 3) ? 2.0 : 6.0);
45 | }
46 |
47 | float binomialCoefficient(int n, int i)
48 | {
49 | return factor_fn(n) / (factor_fn(i) * factor_fn(n-i));
50 | }
51 |
52 | float calculateB(int i, int n, float u)
53 | {
54 | float bc = binomialCoefficient(n, i);
55 | // Adding 0.000001 to avoid having pow(0, 0) which is undefined.
56 | return bc * pow(u + 0.000001, float(i)) * pow(1.0 - u + 0.00001, float(n - i));
57 | }
58 |
59 | vec3 calculate(float u, float v)
60 | {
61 | vec3 result = vec3(0.0);
62 | vec2 offset = vec2(u_meshBox.x + u_meshBox.z / 2.0,
63 | u_meshBox.y + u_meshBox.w / 2.0);
64 |
65 | for (int i = 0; i <= n; ++i) {
66 | for (int j = 0; j <= m; ++j) {
67 | float c = calculateB(i, n, u) * calculateB(j, m, v);
68 | int z = (j * rows + i) * 3;
69 | vec3 point = vec3(k[z] * u_meshBox.z + offset.x, k[z + 1] * u_meshBox.w + offset.y, k[z + 2]);
70 | result += c * point;
71 | }
72 | }
73 | return result;
74 | }
75 |
76 | // Main.
77 |
78 | void main()
79 | {
80 | vec3 pos = calculate(a_meshCoord.x, a_meshCoord.y);
81 | gl_Position = u_projectionMatrix * matrix * vec4(pos, 1.0);
82 | }
83 |
--------------------------------------------------------------------------------
/style/font/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
2 |
3 | This Font Software is licensed under the SIL Open Font License, Version 1.1.
4 |
5 | This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
6 |
7 |
8 | -----------------------------------------------------------
9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10 | -----------------------------------------------------------
11 |
12 | PREAMBLE
13 | The goals of the Open Font License (OFL) are to stimulate worldwide
14 | development of collaborative font projects, to support the font creation
15 | efforts of academic and linguistic communities, and to provide a free and
16 | open framework in which fonts may be shared and improved in partnership
17 | with others.
18 |
19 | The OFL allows the licensed fonts to be used, studied, modified and
20 | redistributed freely as long as they are not sold by themselves. The
21 | fonts, including any derivative works, can be bundled, embedded,
22 | redistributed and/or sold with any software provided that any reserved
23 | names are not used by derivative works. The fonts and derivatives,
24 | however, cannot be released under any other type of license. The
25 | requirement for fonts to remain under this license does not apply
26 | to any document created using the fonts or their derivatives.
27 |
28 | DEFINITIONS
29 | "Font Software" refers to the set of files released by the Copyright
30 | Holder(s) under this license and clearly marked as such. This may
31 | include source files, build scripts and documentation.
32 |
33 | "Reserved Font Name" refers to any names specified as such after the
34 | copyright statement(s).
35 |
36 | "Original Version" refers to the collection of Font Software components as
37 | distributed by the Copyright Holder(s).
38 |
39 | "Modified Version" refers to any derivative made by adding to, deleting,
40 | or substituting -- in part or in whole -- any of the components of the
41 | Original Version, by changing formats or by porting the Font Software to a
42 | new environment.
43 |
44 | "Author" refers to any designer, engineer, programmer, technical
45 | writer or other person who contributed to the Font Software.
46 |
47 | PERMISSION & CONDITIONS
48 | Permission is hereby granted, free of charge, to any person obtaining
49 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
50 | redistribute, and sell modified and unmodified copies of the Font
51 | Software, subject to the following conditions:
52 |
53 | 1) Neither the Font Software nor any of its individual components,
54 | in Original or Modified Versions, may be sold by itself.
55 |
56 | 2) Original or Modified Versions of the Font Software may be bundled,
57 | redistributed and/or sold with any software, provided that each copy
58 | contains the above copyright notice and this license. These can be
59 | included either as stand-alone text files, human-readable headers or
60 | in the appropriate machine-readable metadata fields within text or
61 | binary files as long as those fields can be easily viewed by the user.
62 |
63 | 3) No Modified Version of the Font Software may use the Reserved Font
64 | Name(s) unless explicit written permission is granted by the corresponding
65 | Copyright Holder. This restriction only applies to the primary font name as
66 | presented to the users.
67 |
68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69 | Software shall not be used to promote, endorse or advertise any
70 | Modified Version, except to acknowledge the contribution(s) of the
71 | Copyright Holder(s) and the Author(s) or with their explicit written
72 | permission.
73 |
74 | 5) The Font Software, modified or unmodified, in part or in whole,
75 | must be distributed entirely under this license, and must not be
76 | distributed under any other license. The requirement for fonts to
77 | remain under this license does not apply to any document created
78 | using the Font Software.
79 |
80 | TERMINATION
81 | This license becomes null and void if any of the above conditions are
82 | not met.
83 |
84 | DISCLAIMER
85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93 | OTHER DEALINGS IN THE FONT SOFTWARE.
94 |
--------------------------------------------------------------------------------
/style/font/SourceCodePro-Regular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceCodePro-Regular.otf
--------------------------------------------------------------------------------
/style/font/SourceSansPro-Black.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceSansPro-Black.otf
--------------------------------------------------------------------------------
/style/font/SourceSansPro-BlackIt.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceSansPro-BlackIt.otf
--------------------------------------------------------------------------------
/style/font/SourceSansPro-Bold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceSansPro-Bold.otf
--------------------------------------------------------------------------------
/style/font/SourceSansPro-BoldIt.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceSansPro-BoldIt.otf
--------------------------------------------------------------------------------
/style/font/SourceSansPro-ExtraLight.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceSansPro-ExtraLight.otf
--------------------------------------------------------------------------------
/style/font/SourceSansPro-ExtraLightIt.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceSansPro-ExtraLightIt.otf
--------------------------------------------------------------------------------
/style/font/SourceSansPro-It.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceSansPro-It.otf
--------------------------------------------------------------------------------
/style/font/SourceSansPro-Light.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceSansPro-Light.otf
--------------------------------------------------------------------------------
/style/font/SourceSansPro-LightIt.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceSansPro-LightIt.otf
--------------------------------------------------------------------------------
/style/font/SourceSansPro-Regular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceSansPro-Regular.otf
--------------------------------------------------------------------------------
/style/font/SourceSansPro-Semibold.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceSansPro-Semibold.otf
--------------------------------------------------------------------------------
/style/font/SourceSansPro-SemiboldIt.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/font/SourceSansPro-SemiboldIt.otf
--------------------------------------------------------------------------------
/style/img/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/arrow.png
--------------------------------------------------------------------------------
/style/img/bg_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/bg_dark.png
--------------------------------------------------------------------------------
/style/img/checkbox_checked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/checkbox_checked.png
--------------------------------------------------------------------------------
/style/img/checkbox_checked_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/checkbox_checked_dark.png
--------------------------------------------------------------------------------
/style/img/checkbox_unchecked.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/checkbox_unchecked.png
--------------------------------------------------------------------------------
/style/img/checkbox_unchecked_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/checkbox_unchecked_dark.png
--------------------------------------------------------------------------------
/style/img/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/close.png
--------------------------------------------------------------------------------
/style/img/color_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/color_bg.png
--------------------------------------------------------------------------------
/style/img/drop-down-triangle-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/drop-down-triangle-dark.png
--------------------------------------------------------------------------------
/style/img/drop-down-triangle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/drop-down-triangle.png
--------------------------------------------------------------------------------
/style/img/edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/edit.png
--------------------------------------------------------------------------------
/style/img/f_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/f_logo.png
--------------------------------------------------------------------------------
/style/img/fork.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/fork.png
--------------------------------------------------------------------------------
/style/img/grabber.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/grabber.png
--------------------------------------------------------------------------------
/style/img/keyframe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/keyframe.png
--------------------------------------------------------------------------------
/style/img/pause.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/pause.png
--------------------------------------------------------------------------------
/style/img/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/play.png
--------------------------------------------------------------------------------
/style/img/pop-up-triangle-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/pop-up-triangle-dark.png
--------------------------------------------------------------------------------
/style/img/pop-up-triangle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/pop-up-triangle.png
--------------------------------------------------------------------------------
/style/img/remove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/remove.png
--------------------------------------------------------------------------------
/style/img/spinner-lrg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/spinner-lrg.png
--------------------------------------------------------------------------------
/style/img/stamp1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/stamp1.png
--------------------------------------------------------------------------------
/style/img/thumb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adobe/cssfilterlab/1841f610ff5d77171f77030546d704c1482b5ffb/style/img/thumb.png
--------------------------------------------------------------------------------
/style/src/_dock.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | .panel-view {
18 | display: none;
19 | }
20 |
21 | .panel-view.active {
22 | @include flex;
23 | @include northstar-bg;
24 | display: block;
25 | border-top: 1px solid rgba(255,255,255,.15);
26 | color: white;
27 | z-index: 0;
28 | position: relative;
29 | overflow: hidden;
30 | }
31 |
32 | .panel-view.active > :first-child {
33 | position: absolute;
34 | width: 100%;
35 | height: 100%;
36 | overflow: auto;
37 | top: 0px;
38 | left: 0px;
39 | margin: 0px;
40 | }
41 |
42 | .panel-tab-list {
43 | @include hbox;
44 | @include noflex;
45 | background: #2b2d2d;
46 | }
47 |
48 | /* Disable CSS Custom Filters. */
49 | #filter-dock .panel-tab-list {
50 | display: none;
51 | }
52 |
53 | .panel-tab {
54 | border-radius: 4px 4px 0 0;
55 | padding: 5px 10px;
56 | border-top: 1px solid rgba(0,0,0,0);
57 | border-right: transparent;
58 | color: #aaa;
59 | text-shadow: 0 1px 0 #000;
60 | font-size: 12px;
61 | cursor: pointer;
62 | white-space: nowrap;
63 |
64 | &.active{
65 | @include northstar-bg;
66 | position: relative;
67 | z-index: 10;
68 | border-top: 1px solid #6a6a6a;
69 | border-bottom: 2px solid #494D4E;
70 | border-right: 1px solid #555;
71 | color: white;
72 | text-shadow: 0 -1px 0 #000;
73 | top: 1px;
74 | padding-top:4px;
75 | }
76 | }
77 |
78 | .panel-container {
79 | z-index: 0;
80 | @include vbox;
81 | @include flex;
82 | }
83 |
84 | .panel-column {
85 | @include flexbox;
86 | @include flex;
87 | position: relative;
88 | }
89 |
90 | .panel-column.horizontal,
91 | .panel-column.horizontal > .panel-column-items {
92 | @include hbox;
93 | }
94 |
95 | .panel-column.vertical,
96 | .panel-column.vertical > .panel-column-items {
97 | @include vbox;
98 | }
99 |
100 | .panel-column-header {
101 | @include noflex;
102 | font-weight: bold;
103 | color: white;
104 | padding: 8px;
105 | background: $baseColorDark;
106 | }
107 |
108 | .panel-column-title {
109 | font-weight: normal;
110 | text-shadow: 0 -1px 0 #000;
111 | }
112 |
113 | .panel-column-close-button {
114 | float: right;
115 | }
116 |
117 | .panel-column-items {
118 | @include flexbox;
119 | @include flex;
120 | }
121 |
122 | .panel-column.horizontal > .panel-column-items > .panel-separator {
123 | width: 1px;
124 | @include noflex;
125 | background: #1f1f1f;
126 | border-right: 1px solid rgba(0,0,0,0);
127 | border-left: 1px solid rgba(0,0,0,0);
128 | cursor: col-resize;
129 | }
130 |
131 | .panel-column.vertical > .panel-column-items > .panel-separator {
132 | height: 3px;
133 | @include noflex;
134 | background: #1f1f1f;
135 | cursor: row-resize;
136 | }
137 |
138 | /* trim down on needless resizing handles */
139 | .panel-separator:first-of-type,
140 | .panel-column-handle {
141 | display: none;
142 | }
143 |
144 | .light {
145 |
146 | section{
147 | background: white;
148 | }
149 |
150 | .panel-tab-list{
151 | background: #D4D7D7;
152 | border-bottom: 1px solid #c4c6c6;
153 | }
154 |
155 | .panel-tab,
156 | .panel-view.active{
157 | background: #DFE2E2;
158 | border-top: 1px solid #DFE2E2;
159 | }
160 |
161 | .panel-view.active {
162 | color: black;
163 | }
164 |
165 | .panel-tab{
166 | border: none;
167 | color: $baseColorDark;
168 | margin: -1px 0 0;
169 | text-shadow: 0 1px 0 white;
170 | background: none;
171 | border-right: none;
172 |
173 | &.active{
174 | background: #DFE2E2;
175 | border-top: 1px solid #c4c6c6;
176 | border-right: 1px solid #c4c6c6;
177 | border-left: 1px solid #c4c6c6;
178 | border-radius: 4px 4px 0 0;
179 | box-shadow: inset 0 1px 0 #FFF;
180 |
181 | &:first-child{
182 | border-left: none;
183 | };
184 | }
185 | }
186 | }
187 |
188 | #main-view .light .panel-separator {
189 | border: none;
190 | background: #bcbcbc !important;
191 | }
192 |
193 | #active-filters {
194 | overflow-x: hidden;
195 | }
196 |
--------------------------------------------------------------------------------
/style/src/_params.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | table.paramsTable {
18 | border-collapse: collapse;
19 | border: none;
20 | margin: 6px 0;
21 | width: 100%;
22 |
23 | td {
24 | border: none;
25 | height: 27px;
26 | line-height: 27px;
27 | color: #bfbfbf;
28 | font-weight: normal;
29 | font-size: 12px;
30 | padding: 1px 4px 1px 2px;
31 | text-shadow: 0px -1px 0 rgba(0, 0, 0, 0.8);
32 | vertical-align: middle;
33 | text-align: right;
34 | -webkit-font-smoothing: antialiased;
35 | }
36 |
37 | .field-column {
38 | text-align: left;
39 | }
40 |
41 | tr.field {
42 |
43 | .multi-control-table {
44 | width: 100%;
45 | }
46 |
47 | td.field-label {
48 | padding: 0 6px 0 0;
49 | text-align: right;
50 | width: 75px;
51 | max-width: 75px;
52 | @include prefixProperty(text-overflow, ellipsis);
53 | overflow: hidden;
54 | }
55 |
56 | td.field-value-label {
57 | width: 65px;
58 | padding-right: 5px;
59 | text-align: left;
60 | }
61 | }
62 |
63 | tr.header {
64 | font-weight: bold;
65 | background: rgba(0, 0, 0, 0.2);
66 | color: white;
67 | text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.2);
68 | }
69 |
70 | .param-color-preview {
71 | cursor: pointer;
72 | @include prefixProperty(appearance, none);
73 | width: 100%;
74 | height: 21px;
75 | margin: 10px 0 0 0px;
76 | border: 1px solid rgba(0,0,0,.8);
77 | border-radius: 3px;
78 | color: transparent;
79 | @include prefixProperty(box-shadow, inset 0 1px 2px rgba(0, 0, 0, 0.4));
80 | }
81 |
82 | .param-color-preview::-webkit-color-swatch-wrapper {
83 | display: none;
84 | }
85 |
86 | .warp-control {
87 | background-color: #202020;
88 | border-radius: 4px;
89 | border: 1px solid black;
90 | @include prefixProperty(box-shadow, inset 0 0 1px black);
91 | }
92 |
93 | input[type=range] {
94 | @extend .approx-slider, .approx-slider.dark;
95 | width: 98%;
96 | }
97 |
98 | input[type=range].vertical {
99 | @include prefixProperty(transform, rotate(90deg));
100 | @include prefixProperty(transform-origin, 0 50%);
101 | margin: 0 0 0 15px;
102 | }
103 |
104 | .value-label {
105 | text-align: left;
106 | margin: 0 0 0 3px;
107 | padding: 0 3px 0 2px;
108 | text-shadow: 0 1px 0 #000;
109 | font-size: 1.1em;
110 | cursor: pointer;
111 | text-decoration: underline;
112 | }
113 |
114 | .value-editor {
115 | margin: 0 0 0 3px;
116 | height: 21px;
117 | @include prefixProperty(box-shadow, 0px 0px 3px 1px black);
118 | outline: none;
119 | border: none;
120 | width: 100%;
121 | padding: 0 3px;
122 | border-radius: 3px;
123 | background: rgba(255,255,255,.15);
124 | color: #fff;
125 | text-align: left;
126 | }
127 | .param-color-editor{
128 | @extend .value-editor;
129 | @include prefixProperty(transition, all 0.2s ease-out);
130 | padding: 0 3px 0 3px;
131 | width: 55px;
132 | }
133 |
134 | .multi-control-table.param-color {
135 | input[type='range'] {
136 | height: 5px;
137 | }
138 | .range-r {
139 | background: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(245, 248, 250, 0.1))),
140 | -webkit-gradient(linear, left top, right top, from(#000), to(#f00));
141 | }
142 |
143 | .range-g {
144 | background: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(245, 248, 250, 0.1))),
145 | -webkit-gradient(linear, left top, right top, from(#000), to(#0f0));
146 | }
147 |
148 | .range-b {
149 | background: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(245, 248, 250, 0.1))),
150 | -webkit-gradient(linear, left top, right top, from(#000), to(#00f));
151 | }
152 |
153 | .range-a {
154 | background: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(245, 248, 250, 0.1))),
155 | -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0)), to(#fff)),
156 | -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.4)), to(rgba(245, 248, 250, 0.4))),
157 | url(../img/color_bg.png);
158 | }
159 | }
160 | }
161 |
--------------------------------------------------------------------------------
/style/src/_utils.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | $baseColorLight: #494D4E /* Slate Gray */;
18 | $baseColorDark: #3B3F41 /* Slate Gray */;
19 | $selectedBg: rgba(0,0,0,.24) /* Slate Gray */;
20 |
21 | @mixin prefixProperty($property, $value){
22 | -webkit-#{$property}: $value;
23 | -moz-#{$property}: $value;
24 | -ms-#{$property}: $value;
25 | -o-#{$property}: $value;
26 | #{$property}: $value;
27 | }
28 |
29 | @mixin prefixValue($property, $value){
30 | #{$property}: -webkit-#{$value};
31 | #{$property}: -moz-#{$value};
32 | #{$property}: -ms-#{$value};
33 | #{$property}: -o-#{$value};
34 | #{$property}: #{$value};
35 | }
36 |
37 | @mixin flexbox{
38 | @include prefixValue(display, box);
39 | /* Flex needs to be last, so that we use the new flex-box when it's available */
40 | /* FIXME: Disable the new flex box for now. It seems like stable versions of Chromium don't have the whole implementation yet. */
41 | /* @include prefixValue(display, flex); */
42 | }
43 |
44 | @mixin flex($value: 1){
45 | @include prefixProperty(flex, $value);
46 | @include prefixProperty(box-flex, $value);
47 | }
48 |
49 | @mixin noflex{
50 | @include prefixProperty(box-flex, 0);
51 | @include prefixProperty(flex, none);
52 | }
53 |
54 | @mixin hbox{
55 | @include flexbox;
56 | @include prefixProperty(box-orient, horizontal);
57 | @include prefixProperty(flex-direction, row);
58 | }
59 |
60 | @mixin vbox{
61 | @include flexbox;
62 | @include prefixProperty(box-orient, vertical);
63 | @include prefixProperty(flex-direction, column);
64 | }
65 |
66 | @mixin valign{
67 | @include prefixProperty(box-align, center);
68 | }
69 |
70 | @mixin align-end{
71 | @include prefixProperty(box-align, end);
72 | margin-bottom: 0;
73 | }
74 |
75 | @mixin user-select($value: auto){
76 | -webkit-touch-callout: $value;
77 | -webkit-user-select: $value;
78 | -khtml-user-select: $value;
79 | -moz-user-select: $value;
80 | -ms-user-select: $value;
81 | user-select: $value;
82 | }
83 |
84 | @mixin northstar-bg{
85 | background: $baseColorDark url("../img/bg_dark.png");
86 | background-repeat: repeat-x;
87 | }
88 |
89 | @mixin list-reset{
90 | margin: 0;
91 | padding: 0;
92 | list-style: none;
93 |
94 | & > li{
95 | margin: 0;
96 | padding: 0;
97 | }
98 | }
99 |
100 | @mixin box-shadow{
101 | box-shadow: 0 3px 15px 3px rgba(0,0,0,.4);
102 | }
103 |
--------------------------------------------------------------------------------
/tests/tests.js:
--------------------------------------------------------------------------------
1 | test("making sure qunit works", function() {
2 | ok(1 == "1", "Passed!");
3 | });
--------------------------------------------------------------------------------
/third_party/angle/LICENSE:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2002-2010 The ANGLE Project Authors.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions
6 | // are met:
7 | //
8 | // Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | //
11 | // Redistributions in binary form must reproduce the above
12 | // copyright notice, this list of conditions and the following
13 | // disclaimer in the documentation and/or other materials provided
14 | // with the distribution.
15 | //
16 | // Neither the name of TransGaming Inc., Google Inc., 3DLabs Inc.
17 | // Ltd., nor the names of their contributors may be used to endorse
18 | // or promote products derived from this software without specific
19 | // prior written permission.
20 | //
21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 | // POSSIBILITY OF SUCH DAMAGE.
33 |
--------------------------------------------------------------------------------