Contact us
tel:15797766463
mail:business@seeshiontech.com
Update time : 2020-08-11 17:21:33
SXTrack, divided into Media Track, Sticker Track and Text Track, should be initialized with SXEditManager.
Media Track
//example:
SXMediaTrack *track = (SXMediaTrack *)_model.track;
SXColorAdjustEffect *colorAdujst = [track getColorAdjusts].firstObject;
if (!colorAdujst) {
colorAdujst = [track addColorAdjust];
[colorAdujst setEffectFollowType:SXEffectTimeFollowTypeFollowWholeProcess];
}
Mask can be added to media track.
//example:
SXShape *shape = [[SXShape alloc] init];
[shape circle:CGPointMake(0.0, 0.0) radius:radius];
[shape transform:CGAffineTransformTranslate(CGAffineTransformIdentity, mediaTrack.getTrackSize.width / 2, mediaTrack.getTrackSize.height / 2)];
//Set mask shape.
[mediaTrack setMaskShape:@[shape]];
The size of Media track can be cropped.
//example:
-(void)updateSize:(CGSize)size transfrom:(CGAffineTransform)transform {
if (_currentTrackModel.track) {
SXMediaTrack *mediaTrack = (SXMediaTrack *)_currentTrackModel.track;
//Crop the size of Media track.
[mediaTrack cropMediaWithSize:size transform:transform];
}
}
Text Track
//example:
int error;
//Set text bubbles.
[_textTrack setBubble:bubblePath error:&error];
//example:
if (_model.inTextAnimationEffect) {
//Remove text animation effect.
[_textTrack removeTextAnimation:_model.inTextAnimationEffect.getEffectId];
_model.inTextAnimationEffect = nil;
}
if (_model.outTextAnimationEffect) {
[_textTrack removeTextAnimation:_model.outTextAnimationEffect.getEffectId];
_model.outTextAnimationEffect = nil;
}
if (_model.loopTextAnimationEffect) {
//给文字动画设置新的资源包
[_model.loopTextAnimationEffect setResource:animationPath];
}else {
//添加文字动画
_model.loopTextAnimationEffect = [_textTrack addTextAnimation:animationPath];
}
_model.loopTextAnimationEffect.durationOfOneCycle = _timeSliderView.value;
[_model.loopTextAnimationEffect setEffectFollowType: SXEffectTimeFollowTypeFollowWholeProcess];
Sticker Track
//example:
if (_model.inTrackAnimationEffect) {
//Remove track animation.
[_sitckerTrack removeTrackAnimation:_model.inTrackAnimationEffect.getEffectId];
_model.inTrackAnimationEffect = nil;
}
if (_model.outTrackAnimationEffect) {
[_sitckerTrack removeTrackAnimation:_model.outTrackAnimationEffect.getEffectId];
_model.outTrackAnimationEffect = nil;
}
if (_model.loopTrackAnimationEffect) {
//Set new resource for track animation.
[_model.loopTrackAnimationEffect setResource:animationPath];
}else {
//Add track animation effect.
_model.loopTrackAnimationEffect = [_sitckerTrack addTrackAnimation:animationPath];
}
_model.loopTrackAnimationEffect.durationOfOneCycle = _timeSliderView.value;
[_model.loopTrackAnimationEffect setEffectFollowType: SXEffectTimeFollowTypeFollowWholeProcess];