added missing property interface for expressions
diff --git a/player/index.html b/player/index.html
index 55dab93..d16e402 100644
--- a/player/index.html
+++ b/player/index.html
@@ -141,7 +141,9 @@
<script src="js/utils/expressions/expressionHelpers.js" data-builds="full,svg,canvas,html,canvas_worker"></script>
<script src="js/utils/expressions/ExpressionPropertyDecorator.js" data-builds="full,svg,canvas,html,canvas_worker"></script>
<script src="js/utils/expressions/ExpressionTextPropertyDecorator.js" data-builds="full,svg,canvas,html,canvas_worker"></script>
+ <script src="js/utils/expressions/PropertyInterface.js" data-builds="full,svg,canvas,html,canvas_worker"></script>
<script src="js/utils/expressions/ShapeInterface.js" data-builds="full,svg,canvas,html,canvas_worker"></script>
+ <script src="js/utils/expressions/shapes/ShapePathInterface.js" data-builds="full,svg,canvas,html,canvas_worker"></script>
<script src="js/utils/expressions/TextInterface.js" data-builds="full,svg,canvas,html,canvas_worker"></script>
<script src="js/utils/expressions/LayerInterface.js" data-builds="full,svg,canvas,html,canvas_worker"></script>
<script src="js/utils/expressions/CompInterface.js" data-builds="full,svg,canvas,html,canvas_worker"></script>
@@ -172,7 +174,7 @@
var animData = {
container: elem,
renderer: 'svg',
- loop: 3,
+ loop: false,
autoplay: true,
rendererSettings: {
progressiveLoad:false,
diff --git a/player/js/utils/expressions/EffectInterface.js b/player/js/utils/expressions/EffectInterface.js
index 8ce4dac..df573bc 100644
--- a/player/js/utils/expressions/EffectInterface.js
+++ b/player/js/utils/expressions/EffectInterface.js
@@ -13,8 +13,9 @@
effectElements.push(createGroupInterface(effectsData[i],elem.effectsManager.effectElements[i],propertyGroup,elem));
}
- return function(name){
- var effects = elem.data.ef || [], i = 0, len = effects.length;
+ var effects = elem.data.ef || [];
+ var groupInterface = function(name){
+ i = 0, len = effects.length;
while(i<len) {
if(name === effects[i].nm || name === effects[i].mn || name === effects[i].ix){
return effectElements[i];
@@ -22,6 +23,12 @@
i += 1;
}
};
+ Object.defineProperty(groupInterface, 'numProperties', {
+ get: function(){
+ return effects.length;
+ }
+ });
+ return groupInterface
}
}
@@ -37,7 +44,8 @@
}
function _propertyGroup(val) {
- if(val === 1){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
return groupInterface;
} else{
return propertyGroup(val-1);
@@ -68,10 +76,13 @@
}
});
}
- Object.defineProperty(groupInterface, 'numProperties', {
- get: function(){
- return data.np;
- }
+ Object.defineProperties(groupInterface, {
+ 'numProperties': {
+ get: function(){
+ return data.np;
+ }
+ },
+ '_name': { value: data.nm }
});
groupInterface.active = groupInterface.enabled = data.en !== 0;
return groupInterface;
@@ -87,7 +98,7 @@
}
if(element.p.setGroupProperty) {
- element.p.setGroupProperty(propertyGroup);
+ element.p.setGroupProperty(PropertyInterface('', propertyGroup));
}
return interfaceFunction;
diff --git a/player/js/utils/expressions/ExpressionManager.js b/player/js/utils/expressions/ExpressionManager.js
index d22e4ca..d77d95a 100644
--- a/player/js/utils/expressions/ExpressionManager.js
+++ b/player/js/utils/expressions/ExpressionManager.js
@@ -650,7 +650,6 @@
expression_function();
this.frameExpressionId = elem.globalData.frameId;
-
//TODO: Check if it's possible to return on ShapeInterface the .v value
if (scoped_bm_rt.propType === "shape") {
scoped_bm_rt = scoped_bm_rt.v;
diff --git a/player/js/utils/expressions/PropertyInterface.js b/player/js/utils/expressions/PropertyInterface.js
new file mode 100644
index 0000000..4946161
--- /dev/null
+++ b/player/js/utils/expressions/PropertyInterface.js
@@ -0,0 +1,19 @@
+var PropertyInterface = (function() {
+ return function(propertyName, propertyGroup) {
+
+ var interfaceFunction = {
+ _name: propertyName
+ }
+
+ function _propertyGroup(val){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
+ return interfaceFunction;
+ } else {
+ return propertyGroup(--val);
+ }
+ }
+
+ return _propertyGroup;
+ }
+}())
\ No newline at end of file
diff --git a/player/js/utils/expressions/ShapeInterface.js b/player/js/utils/expressions/ShapeInterface.js
index d975f68..0c5b8ab 100644
--- a/player/js/utils/expressions/ShapeInterface.js
+++ b/player/js/utils/expressions/ShapeInterface.js
@@ -19,7 +19,7 @@
}else if(shapes[i].ty == 'sr'){
arr.push(starInterfaceFactory(shapes[i],view[i],propertyGroup));
} else if(shapes[i].ty == 'sh'){
- arr.push(pathInterfaceFactory(shapes[i],view[i],propertyGroup));
+ arr.push(ShapePathInterface(shapes[i],view[i],propertyGroup));
} else if(shapes[i].ty == 'rc'){
arr.push(rectInterfaceFactory(shapes[i],view[i],propertyGroup));
} else if(shapes[i].ty == 'rd'){
@@ -46,7 +46,8 @@
}
};
interfaceFunction.propertyGroup = function(val){
- if(val === 1){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
return interfaceFunction;
} else{
return propertyGroup(val-1);
@@ -54,6 +55,8 @@
};
interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup);
interfaceFunction.numProperties = interfaces.length;
+ var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1],view.it[view.it.length - 1],interfaceFunction.propertyGroup);
+ interfaceFunction.transform = transformInterface;
interfaceFunction.propertyIndex = shape.cix;
interfaceFunction._name = shape.nm;
@@ -75,7 +78,8 @@
}
};
interfaceFunction.propertyGroup = function(val){
- if(val === 1){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
return interfaceFunction;
} else{
return propertyGroup(val-1);
@@ -117,21 +121,23 @@
'mn': { value: shape.mn }
});
- view.c.setGroupProperty(propertyGroup);
- view.o.setGroupProperty(propertyGroup);
+ view.c.setGroupProperty(PropertyInterface('Color', propertyGroup));
+ view.o.setGroupProperty(PropertyInterface('Opacity', propertyGroup));
return interfaceFunction;
}
function strokeInterfaceFactory(shape,view,propertyGroup){
function _propertyGroup(val){
- if(val === 1){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
return ob;
} else{
return propertyGroup(val-1);
}
}
function _dashPropertyGroup(val){
- if(val === 1){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
return dashOb;
} else{
return _propertyGroup(val-1);
@@ -177,15 +183,16 @@
'mn': { value: shape.mn }
});
- view.c.setGroupProperty(_propertyGroup);
- view.o.setGroupProperty(_propertyGroup);
- view.w.setGroupProperty(_propertyGroup);
+ view.c.setGroupProperty(PropertyInterface('Color', _propertyGroup));
+ view.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));
+ view.w.setGroupProperty(PropertyInterface('Stroke Width', _propertyGroup));
return interfaceFunction;
}
function trimInterfaceFactory(shape,view,propertyGroup){
function _propertyGroup(val){
- if(val == 1){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
return interfaceFunction;
} else {
return propertyGroup(--val);
@@ -193,9 +200,9 @@
}
interfaceFunction.propertyIndex = shape.ix;
- view.s.setGroupProperty(_propertyGroup);
- view.e.setGroupProperty(_propertyGroup);
- view.o.setGroupProperty(_propertyGroup);
+ view.s.setGroupProperty(PropertyInterface('Start', _propertyGroup));
+ view.e.setGroupProperty(PropertyInterface('End', _propertyGroup));
+ view.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));
function interfaceFunction(val){
if(val === shape.e.ix || val === 'End' || val === 'end'){
@@ -229,22 +236,23 @@
function transformInterfaceFactory(shape,view,propertyGroup){
function _propertyGroup(val){
- if(val == 1){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
return interfaceFunction;
} else {
return propertyGroup(--val);
}
}
- view.transform.mProps.o.setGroupProperty(_propertyGroup);
- view.transform.mProps.p.setGroupProperty(_propertyGroup);
- view.transform.mProps.a.setGroupProperty(_propertyGroup);
- view.transform.mProps.s.setGroupProperty(_propertyGroup);
- view.transform.mProps.r.setGroupProperty(_propertyGroup);
+ view.transform.mProps.o.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));
+ view.transform.mProps.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));
+ view.transform.mProps.a.setGroupProperty(PropertyInterface('Anchor Point', _propertyGroup));
+ view.transform.mProps.s.setGroupProperty(PropertyInterface('Scale', _propertyGroup));
+ view.transform.mProps.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));
if(view.transform.mProps.sk){
- view.transform.mProps.sk.setGroupProperty(_propertyGroup);
- view.transform.mProps.sa.setGroupProperty(_propertyGroup);
+ view.transform.mProps.sk.setGroupProperty(PropertyInterface('Skew', _propertyGroup));
+ view.transform.mProps.sa.setGroupProperty(PropertyInterface('Skew Angle', _propertyGroup));
}
- view.transform.op.setGroupProperty(_propertyGroup);
+ view.transform.op.setGroupProperty(PropertyInterface('Opacity', _propertyGroup));
function interfaceFunction(value){
if(shape.a.ix === value || value === 'Anchor Point'){
@@ -302,7 +310,8 @@
function ellipseInterfaceFactory(shape,view,propertyGroup){
function _propertyGroup(val){
- if(val == 1){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
return interfaceFunction;
} else {
return propertyGroup(--val);
@@ -310,8 +319,8 @@
}
interfaceFunction.propertyIndex = shape.ix;
var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
- prop.s.setGroupProperty(_propertyGroup);
- prop.p.setGroupProperty(_propertyGroup);
+ prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));
+ prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));
function interfaceFunction(value){
if(shape.p.ix === value){
return interfaceFunction.position;
@@ -336,7 +345,8 @@
function starInterfaceFactory(shape,view,propertyGroup){
function _propertyGroup(val){
- if(val == 1){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
return interfaceFunction;
} else {
return propertyGroup(--val);
@@ -344,14 +354,14 @@
}
var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
interfaceFunction.propertyIndex = shape.ix;
- prop.or.setGroupProperty(_propertyGroup);
- prop.os.setGroupProperty(_propertyGroup);
- prop.pt.setGroupProperty(_propertyGroup);
- prop.p.setGroupProperty(_propertyGroup);
- prop.r.setGroupProperty(_propertyGroup);
+ prop.or.setGroupProperty(PropertyInterface('Outer Radius', _propertyGroup));
+ prop.os.setGroupProperty(PropertyInterface('Outer Roundness', _propertyGroup));
+ prop.pt.setGroupProperty(PropertyInterface('Points', _propertyGroup));
+ prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));
+ prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));
if(shape.ir){
- prop.ir.setGroupProperty(_propertyGroup);
- prop.is.setGroupProperty(_propertyGroup);
+ prop.ir.setGroupProperty(PropertyInterface('Inner Radius', _propertyGroup));
+ prop.is.setGroupProperty(PropertyInterface('Inner Roundness', _propertyGroup));
}
function interfaceFunction(value){
@@ -409,7 +419,8 @@
function rectInterfaceFactory(shape,view,propertyGroup){
function _propertyGroup(val){
- if(val == 1){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
return interfaceFunction;
} else {
return propertyGroup(--val);
@@ -417,9 +428,9 @@
}
var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
interfaceFunction.propertyIndex = shape.ix;
- prop.p.setGroupProperty(_propertyGroup);
- prop.s.setGroupProperty(_propertyGroup);
- prop.r.setGroupProperty(_propertyGroup);
+ prop.p.setGroupProperty(PropertyInterface('Position', _propertyGroup));
+ prop.s.setGroupProperty(PropertyInterface('Size', _propertyGroup));
+ prop.r.setGroupProperty(PropertyInterface('Rotation', _propertyGroup));
function interfaceFunction(value){
if(shape.p.ix === value){
@@ -451,7 +462,8 @@
function roundedInterfaceFactory(shape,view,propertyGroup){
function _propertyGroup(val){
- if(val == 1){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
return interfaceFunction;
} else {
return propertyGroup(--val);
@@ -459,7 +471,7 @@
}
var prop = view;
interfaceFunction.propertyIndex = shape.ix;
- prop.rd.setGroupProperty(_propertyGroup);
+ prop.rd.setGroupProperty(PropertyInterface('Radius', _propertyGroup));
function interfaceFunction(value){
if(shape.r.ix === value || 'Round Corners 1' === value){
@@ -479,7 +491,8 @@
function repeaterInterfaceFactory(shape,view,propertyGroup){
function _propertyGroup(val){
- if(val == 1){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
return interfaceFunction;
} else {
return propertyGroup(--val);
@@ -487,8 +500,8 @@
}
var prop = view;
interfaceFunction.propertyIndex = shape.ix;
- prop.c.setGroupProperty(_propertyGroup);
- prop.o.setGroupProperty(_propertyGroup);
+ prop.c.setGroupProperty(PropertyInterface('Copies', _propertyGroup));
+ prop.o.setGroupProperty(PropertyInterface('Offset', _propertyGroup));
function interfaceFunction(value){
if(shape.c.ix === value || 'Copies' === value){
@@ -511,52 +524,16 @@
return interfaceFunction;
}
- function pathInterfaceFactory(shape,view,propertyGroup){
- var prop = view.sh;
- function _propertyGroup(val){
- if(val == 1){
- return interfaceFunction;
- } else {
- return propertyGroup(--val);
- }
- }
- prop.setGroupProperty(_propertyGroup);
-
- function interfaceFunction(val){
- if(val === 'Shape' || val === 'shape' || val === 'Path' || val === 'path' || val === 'ADBE Vector Shape' || val === 2){
- return interfaceFunction.path;
- }
- }
- Object.defineProperties(interfaceFunction, {
- 'path': {
- get: function(){
- if(prop.k){
- prop.getValue();
- }
- return prop;
- }
- },
- 'shape': {
- get: function(){
- if(prop.k){
- prop.getValue();
- }
- return prop;
- }
- },
- '_name': { value: shape.nm },
- 'ix': { value: shape.ix },
- 'propertyIndex': { value: shape.ix },
- 'mn': { value: shape.mn }
- });
- return interfaceFunction;
- }
-
return function(shapes,view,propertyGroup) {
var interfaces;
function _interfaceFunction(value){
if(typeof value === 'number'){
- return interfaces[value-1];
+ value = value === undefined ? 1 : value
+ if (value === 0) {
+ return propertyGroup
+ } else {
+ return interfaces[value-1];
+ }
} else {
var i = 0, len = interfaces.length;
while(i<len){
diff --git a/player/js/utils/expressions/shapes/ShapePathInterface.js b/player/js/utils/expressions/shapes/ShapePathInterface.js
new file mode 100644
index 0000000..661fe67
--- /dev/null
+++ b/player/js/utils/expressions/shapes/ShapePathInterface.js
@@ -0,0 +1,48 @@
+var ShapePathInterface = (
+
+ function() {
+
+ return function pathInterfaceFactory(shape,view,propertyGroup){
+ var prop = view.sh;
+ function _propertyGroup(val){
+ val = val === undefined ? 1 : val
+ if(val <= 0){
+ return interfaceFunction;
+ } else {
+ return propertyGroup(--val);
+ }
+ }
+ prop.setGroupProperty(PropertyInterface('Path', _propertyGroup));
+
+ function interfaceFunction(val){
+ if(val === 'Shape' || val === 'shape' || val === 'Path' || val === 'path' || val === 'ADBE Vector Shape' || val === 2){
+ return interfaceFunction.path;
+ }
+ }
+ Object.defineProperties(interfaceFunction, {
+ 'path': {
+ get: function(){
+ if(prop.k){
+ prop.getValue();
+ }
+ return prop;
+ }
+ },
+ 'shape': {
+ get: function(){
+ if(prop.k){
+ prop.getValue();
+ }
+ return prop;
+ }
+ },
+ '_name': { value: shape.nm },
+ 'ix': { value: shape.ix },
+ 'propertyIndex': { value: shape.ix },
+ 'mn': { value: shape.mn },
+ 'propertyGroup': {value: propertyGroup},
+ });
+ return interfaceFunction;
+ }
+ }()
+)
\ No newline at end of file
diff --git a/tasks/build.js b/tasks/build.js
index bdecf1e..49a76b9 100644
--- a/tasks/build.js
+++ b/tasks/build.js
@@ -477,6 +477,14 @@
builds: ['full','svg','canvas','html','canvas_worker']
},
{
+ src: 'js/utils/expressions/shapes/ShapePathInterface.js',
+ builds: ['full','svg','canvas','html','canvas_worker']
+ },
+ {
+ src: 'js/utils/expressions/PropertyInterface.js',
+ builds: ['full','svg','canvas','html','canvas_worker']
+ },
+ {
src: 'js/utils/expressions/ShapeInterface.js',
builds: ['full','svg','canvas','html','canvas_worker']
},