blob: d2fee7746be650d9e1b84e5b1f0004884cf11b52 [file] [log] [blame]
function BaseElement(){
}
BaseElement.prototype = {
checkMasks: function(){
if(!this.data.hasMask){
return false;
}
var i = 0, len = this.data.masksProperties.length;
while(i<len) {
if((this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false)) {
return true;
}
i += 1;
}
return false;
},
initExpressions: function(){
this.layerInterface = LayerExpressionInterface(this);
if(this.data.hasMask && this.maskManager) {
this.layerInterface.registerMaskInterface(this.maskManager);
}
var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this,this.layerInterface);
this.layerInterface.registerEffectsInterface(effectsInterface);
if(this.data.ty === 0 || this.data.xt){
this.compInterface = CompExpressionInterface(this);
} else if(this.data.ty === 4){
this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData,this.itemsData,this.layerInterface);
this.layerInterface.content = this.layerInterface.shapeInterface;
} else if(this.data.ty === 5){
this.layerInterface.textInterface = TextExpressionInterface(this);
this.layerInterface.text = this.layerInterface.textInterface;
}
},
blendModeEnums: {
1:'multiply',
2:'screen',
3:'overlay',
4:'darken',
5:'lighten',
6:'color-dodge',
7:'color-burn',
8:'hard-light',
9:'soft-light',
10:'difference',
11:'exclusion',
12:'hue',
13:'saturation',
14:'color',
15:'luminosity'
},
getBlendMode: function(){
return this.blendModeEnums[this.data.bm] || '';
},
setBlendMode: function(){
var blendModeValue = this.getBlendMode();
var elem = this.baseElement || this.layerElement;
elem.style['mix-blend-mode'] = blendModeValue;
},
initBaseData: function(data, globalData, comp){
this.globalData = globalData;
this.comp = comp;
this.data = data;
this.layerId = createElementID();
//Stretch factor for old animations missing this property.
if(!this.data.sr){
this.data.sr = 1;
}
// effects manager
this.effectsManager = new EffectsManager(this.data,this,this.dynamicProperties);
},
getType: function(){
return this.type;
}
}