123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- import ExpressionPropertyInterface from './ExpressionValueFactory';
- const TransformExpressionInterface = (function () {
- return function (transform) {
- function _thisFunction(name) {
- switch (name) {
- case 'scale':
- case 'Scale':
- case 'ADBE Scale':
- case 6:
- return _thisFunction.scale;
- case 'rotation':
- case 'Rotation':
- case 'ADBE Rotation':
- case 'ADBE Rotate Z':
- case 10:
- return _thisFunction.rotation;
- case 'ADBE Rotate X':
- return _thisFunction.xRotation;
- case 'ADBE Rotate Y':
- return _thisFunction.yRotation;
- case 'position':
- case 'Position':
- case 'ADBE Position':
- case 2:
- return _thisFunction.position;
- case 'ADBE Position_0':
- return _thisFunction.xPosition;
- case 'ADBE Position_1':
- return _thisFunction.yPosition;
- case 'ADBE Position_2':
- return _thisFunction.zPosition;
- case 'anchorPoint':
- case 'AnchorPoint':
- case 'Anchor Point':
- case 'ADBE AnchorPoint':
- case 1:
- return _thisFunction.anchorPoint;
- case 'opacity':
- case 'Opacity':
- case 11:
- return _thisFunction.opacity;
- default:
- return null;
- }
- }
- Object.defineProperty(_thisFunction, 'rotation', {
- get: ExpressionPropertyInterface(transform.r || transform.rz),
- });
- Object.defineProperty(_thisFunction, 'zRotation', {
- get: ExpressionPropertyInterface(transform.rz || transform.r),
- });
- Object.defineProperty(_thisFunction, 'xRotation', {
- get: ExpressionPropertyInterface(transform.rx),
- });
- Object.defineProperty(_thisFunction, 'yRotation', {
- get: ExpressionPropertyInterface(transform.ry),
- });
- Object.defineProperty(_thisFunction, 'scale', {
- get: ExpressionPropertyInterface(transform.s),
- });
- var _px;
- var _py;
- var _pz;
- var _transformFactory;
- if (transform.p) {
- _transformFactory = ExpressionPropertyInterface(transform.p);
- } else {
- _px = ExpressionPropertyInterface(transform.px);
- _py = ExpressionPropertyInterface(transform.py);
- if (transform.pz) {
- _pz = ExpressionPropertyInterface(transform.pz);
- }
- }
- Object.defineProperty(_thisFunction, 'position', {
- get: function () {
- if (transform.p) {
- return _transformFactory();
- }
- return [
- _px(),
- _py(),
- _pz ? _pz() : 0];
- },
- });
- Object.defineProperty(_thisFunction, 'xPosition', {
- get: ExpressionPropertyInterface(transform.px),
- });
- Object.defineProperty(_thisFunction, 'yPosition', {
- get: ExpressionPropertyInterface(transform.py),
- });
- Object.defineProperty(_thisFunction, 'zPosition', {
- get: ExpressionPropertyInterface(transform.pz),
- });
- Object.defineProperty(_thisFunction, 'anchorPoint', {
- get: ExpressionPropertyInterface(transform.a),
- });
- Object.defineProperty(_thisFunction, 'opacity', {
- get: ExpressionPropertyInterface(transform.o),
- });
- Object.defineProperty(_thisFunction, 'skew', {
- get: ExpressionPropertyInterface(transform.sk),
- });
- Object.defineProperty(_thisFunction, 'skewAxis', {
- get: ExpressionPropertyInterface(transform.sa),
- });
- Object.defineProperty(_thisFunction, 'orientation', {
- get: ExpressionPropertyInterface(transform.or),
- });
- return _thisFunction;
- };
- }());
- export default TransformExpressionInterface;
|