Contact us
tel:15797766463
mail:business@seeshiontech.com
Update time : 2020-08-11 18:03:48
SXEffect can be invided into transition, text animation, filter, video effects, etc., which can determined by the type attributes. Moreover it can be initialized by adding effect to tracks or main track group, created by adding methods on the track and not exist independently.
The effect has different time follow types.
typedef enum : NSUInteger {
SXEffectTimeFollowTypeNone, //Based on in point of track, the start time is relative to in point of track.
SXEffectTimeFollowTypeFollowStart, //Start time of effect can be set at the beginning of track to achieve entrance effect.
SXEffectTimeFollowTypeFollowEnd, //End time of effect can be set at the end of the track to achieve exit effect.
SXEffectTimeFollowTypeFollowWholeProcess //The display time of effect is the whole track duration.
}SXEffectTimeFollowType;
/**
* Set effect time follow type, SXEffectTimeFollowTypeNone by default.
* @warning Effect time follow type may result in changing the start time, end time and whole duration dynamically, even voiding the setting of start time or duration.
* @param type Effect time follow type.
*/
- (void)setEffectFollowType:(SXEffectTimeFollowType)type;
Filter
//example:
SXMediaTrack *track = (SXMediaTrack *)_model.track;
if (!_currentFilter || !model.folderPath) {
//Remove all filters on tracks.
for (SXFilterEffect *filter in [track getFilters]) {
[track removeFilter:filter.getEffectId];
}
_currentFilter = nil;
}
if (_currentFilter) {
//Set the new resource path for filter.
[_currentFilter setResource:model.folderPath];
}else {
//Add a filter to track.
_currentFilter = [track addFilter:model.folderPath];
//Effect time follow type is follow whole process.
[_currentFilter setEffectFollowType:SXEffectTimeFollowTypeFollowWholeProcess];
}
Animation Effect
//example:
SXMediaTrack *track = (SXMediaTrack *)_model.track;
if (!_currentVideoAnimation || !model.folderPath) {
//Remove all animations on the track.
for (SXAnimationEffect *animation in [track getAnimations]) {
[track removeAnimation:animation.getEffectId];
}
_currentVideoAnimation = nil;
}
if (model.folderPath) {
if (_currentVideoAnimation) {
//Set a new resource path for animation.
[_currentVideoAnimation setResource:model.folderPath];
}else {
//Add an animation for track.
_currentVideoAnimation = [track addAnimation:model.folderPath];
//Exit animation.
[_currentVideoAnimation setEffectFollowType:SXEffectTimeFollowTypeFollowStart];
}
//Set animation duration.
_currentVideoAnimation.duration = _sliderView.value;
//Set the animation duration of one cycle.
_currentVideoAnimation.durationOfOneCycle = _sliderView.value;
}
Video Effect
Text Animation Effect
Track Animation
Color Grading Effect
//example:
SXMainTrackGroup *mainTrackGroup = (SXMainTrackGroup *)_editManager.mainGroup;
if (!mainTrackGroup) {
return;
}
if (!_colorAdujst) {
//Add a color adjustment effect.
_colorAdujst = [mainTrackGroup addColorAdjust];
//Effect time follow type none.
[_colorAdujst setEffectFollowType:SXEffectTimeFollowTypeNone];
//Set the start time, end time and the whole duration for color adjustment effect.
_colorAdujst.startTime = _startTime;
_colorAdujst.duration = MIN(_editManager.editDuration - _startTime, 3);
}
//Get the value range of one of multiple parameters.
NSArray *range = [SXColorAdjustEffect getValueRangeForColorSetting:1<<indexPath.item];
float min = [range.firstObject floatValue];
float max = [range.lastObject floatValue];
_startLabel.text = [NSString stringWithFormat:@"%.1f", min];
_endLabel.text = [NSString stringWithFormat:@"%.1f", max];
_sliderView.minimumValue = min;
_sliderView.maximumValue = max;
// Get the current value of one of the parameters.
_sliderView.value = [_colorAdujst getValueForSetting:1<<indexPath.item];