added transform value at time
diff --git a/player/index.html b/player/index.html
index 60c2f38..1a4c2e6 100644
--- a/player/index.html
+++ b/player/index.html
@@ -180,7 +180,7 @@
container: elem,
renderer: 'svg',
loop: false,
- autoplay: true,
+ autoplay: false,
rendererSettings: {
progressiveLoad:false,
preserveAspectRatio: 'xMidYMid meet',
@@ -209,6 +209,8 @@
console.log(error)
})
+ setTimeout(()=>anim.goToAndStop(10, true), 250);
+
function createAudio(assetPath) {
return new Howl({
src: [assetPath]
diff --git a/player/js/3rd_party/transformation-matrix.js b/player/js/3rd_party/transformation-matrix.js
index b3936ed..dd11ebf 100644
--- a/player/js/3rd_party/transformation-matrix.js
+++ b/player/js/3rd_party/transformation-matrix.js
@@ -319,7 +319,11 @@
if(this.isIdentity()) {
arr = [x,y,z];
} else {
- arr = [x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]];
+ arr = [
+ x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],
+ x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],
+ x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]
+ ];
}
return arr;
}
diff --git a/player/js/utils/expressions/EffectInterface.js b/player/js/utils/expressions/EffectInterface.js
index bbe5201..38702df 100644
--- a/player/js/utils/expressions/EffectInterface.js
+++ b/player/js/utils/expressions/EffectInterface.js
@@ -46,7 +46,7 @@
}
i += 1;
}
- return effectElements[0]();
+ throw new Error();
};
var _propertyGroup = propertyGroupFactory(groupInterface, propertyGroup);
diff --git a/player/js/utils/expressions/ExpressionPropertyDecorator.js b/player/js/utils/expressions/ExpressionPropertyDecorator.js
index da0bd04..b4fa8d2 100644
--- a/player/js/utils/expressions/ExpressionPropertyDecorator.js
+++ b/player/js/utils/expressions/ExpressionPropertyDecorator.js
@@ -181,7 +181,57 @@
}
function getTransformValueAtTime(time) {
- console.warn('Transform at time not supported');
+ if (!this._transformCachingAtTime) {
+ this._transformCachingAtTime = {
+ v: new Matrix(),
+ };
+ }
+ ////
+ var matrix = this._transformCachingAtTime.v;
+ matrix.cloneFromProps(this.pre.props);
+ if (this.appliedTransformations < 1) {
+ var anchor = this.a.getValueAtTime(time);
+ matrix.translate(-anchor[0], -anchor[1], anchor[2]);
+ }
+ if (this.appliedTransformations < 2) {
+ var scale = this.s.getValueAtTime(time);
+ matrix.scale(scale[0], scale[1], scale[2]);
+ }
+ if (this.sk && this.appliedTransformations < 3) {
+ var skew = this.sk.getValueAtTime(time);
+ var skewAxis = this.sa.getValueAtTime(time);
+ matrix.skewFromAxis(-skew, skewAxis);
+ }
+ if (this.r && this.appliedTransformations < 4) {
+ var rotation = this.r.getValueAtTime(time);
+ matrix.rotate(-rotation);
+ } else if (!this.r && this.appliedTransformations < 4){
+ var rotationZ = this.rz.getValueAtTime(time);
+ var rotationY = this.ry.getValueAtTime(time);
+ var rotationX = this.rx.getValueAtTime(time);
+ var orientation = this.or.getValueAtTime(time);
+ matrix.rotateZ(-rotationZ.v)
+ .rotateY(rotationY.v)
+ .rotateX(rotationX.v)
+ .rotateZ(-orientation[2])
+ .rotateY(orientation[1])
+ .rotateX(orientation[0]);
+ }
+ if (this.data.p && this.data.p.s) {
+ var positionX = this.px.getValueAtTime(time);
+ var positionY = this.py.getValueAtTime(time);
+ if (this.data.p.z) {
+ var positionZ = this.pz.getValueAtTime(time);
+ matrix.translate(positionX, positionY, -positionZ);
+ } else {
+ matrix.translate(positionX, positionY, 0);
+ }
+ } else {
+ var position = this.p.getValueAtTime(time);
+ matrix.translate(position[0], position[1], -position[2]);
+ }
+ return matrix;
+ ////
}
function getTransformStaticValueAtTime(time) {
diff --git a/player/js/utils/expressions/ExpressionValueFactory.js b/player/js/utils/expressions/ExpressionValueFactory.js
index ca70dcf..233503c 100644
--- a/player/js/utils/expressions/ExpressionValueFactory.js
+++ b/player/js/utils/expressions/ExpressionValueFactory.js
@@ -24,6 +24,7 @@
}
var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value);
valueProp.time = property.keyframes[pos-1].t / property.elem.comp.globalData.frameRate;
+ valueProp.value = type === 'unidimensional' ? value[0] : value;
return valueProp;
}
};
diff --git a/player/js/utils/expressions/LayerInterface.js b/player/js/utils/expressions/LayerInterface.js
index 817ea63..2fad619 100644
--- a/player/js/utils/expressions/LayerInterface.js
+++ b/player/js/utils/expressions/LayerInterface.js
@@ -3,14 +3,12 @@
var toWorldMat = new Matrix();
toWorldMat.reset();
var transformMat;
- if(time) {
- //Todo implement value at time on transform properties
- //transformMat = this._elem.finalTransform.mProp.getValueAtTime(time);
- transformMat = this._elem.finalTransform.mProp;
+ if (time !== undefined) {
+ toWorldMat = this._elem.finalTransform.mProp.getValueAtTime(time);
} else {
transformMat = this._elem.finalTransform.mProp;
+ transformMat.applyToMatrix(toWorldMat);
}
- transformMat.applyToMatrix(toWorldMat);
if(this._elem.hierarchy && this._elem.hierarchy.length){
var i, len = this._elem.hierarchy.length;
for(i=0;i<len;i+=1){
@@ -24,15 +22,13 @@
var toWorldMat = new Matrix();
toWorldMat.reset();
var transformMat;
- if(time) {
- //Todo implement value at time on transform properties
- //transformMat = this._elem.finalTransform.mProp.getValueAtTime(time);
- transformMat = this._elem.finalTransform.mProp;
+ if (time !== undefined) {
+ toWorldMat = this._elem.finalTransform.mProp.getValueAtTime(time);
} else {
transformMat = this._elem.finalTransform.mProp;
+ transformMat.applyToMatrix(toWorldMat);
}
- transformMat.applyToMatrix(toWorldMat);
- if(this._elem.hierarchy && this._elem.hierarchy.length){
+ if (this._elem.hierarchy && this._elem.hierarchy.length){
var i, len = this._elem.hierarchy.length;
for(i=0;i<len;i+=1){
this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
@@ -88,6 +84,8 @@
case "effects":
case "Effects":
return _thisLayerFunction.effect;
+ case "ADBE Text Properties":
+ return _thisLayerFunction.textInterface;
}
}
_thisLayerFunction.toWorld = toWorld;
diff --git a/player/js/utils/expressions/TextInterface.js b/player/js/utils/expressions/TextInterface.js
index 924fafe..da72c0f 100644
--- a/player/js/utils/expressions/TextInterface.js
+++ b/player/js/utils/expressions/TextInterface.js
@@ -1,7 +1,11 @@
var TextExpressionInterface = (function(){
return function(elem){
var _prevValue, _sourceText;
- function _thisLayerFunction(){
+ function _thisLayerFunction(name){
+ switch(name){
+ case "ADBE Text Document":
+ return _thisLayerFunction.sourceText;
+ }
}
Object.defineProperty(_thisLayerFunction, "sourceText", {
get: function(){