|
@@ -1333,23 +1333,27 @@ extension PQStuckPointEditerController {
|
|
|
// L/(n+1) L -原视觉素材总时长 n-抛留倍数 lastJumpSpeedSelectIndex 是位置 对应的值要+1
|
|
|
//根据公式计划出的总时长
|
|
|
let jumpTime = Float(selectedTotalDuration) / Float(lastJumpSpeedSelectIndex + 2)
|
|
|
-
|
|
|
- while useAssestDuration < Float(jumpTime) {
|
|
|
- // 回环从头取\
|
|
|
- if i + 1 >= stuckPointsTemp.count {
|
|
|
- i = 0
|
|
|
+ //只有图片素材时会为0
|
|
|
+ if(jumpTime > 0){
|
|
|
+ while useAssestDuration < Float(jumpTime) {
|
|
|
+ // 回环从头取\
|
|
|
+ if i + 1 >= stuckPointsTemp.count {
|
|
|
+ i = 0
|
|
|
+ }
|
|
|
+ // 快速段
|
|
|
+ let LA = (stuckPointsTemp[i + 1] - stuckPointsTemp[i])
|
|
|
+ useAssestDuration = useAssestDuration + Float(LA)
|
|
|
+
|
|
|
+ i = i + 1
|
|
|
+ clipNum = clipNum + 1
|
|
|
}
|
|
|
- // 快速段
|
|
|
- let LA = (stuckPointsTemp[i + 1] - stuckPointsTemp[i])
|
|
|
- useAssestDuration = useAssestDuration + Float(LA)
|
|
|
-
|
|
|
- i = i + 1
|
|
|
- clipNum = clipNum + 1
|
|
|
- }
|
|
|
|
|
|
- // 拼接要使用的卡点信息
|
|
|
- finallyStuckPoints.append(stuckPointsTemp.first ?? 0.0)
|
|
|
- clipPoint(clipCount:clipNum , oldPoints: stuckPointsTemp)
|
|
|
+ // 拼接要使用的卡点信息
|
|
|
+ finallyStuckPoints.append(stuckPointsTemp.first ?? 0.0)
|
|
|
+ clipPoint(clipCount:clipNum , oldPoints: stuckPointsTemp)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
break
|
|
|
case .createStickersModelSpeed, .createStickersModelOnlyMusic: // 快慢速
|
|
@@ -1438,23 +1442,11 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
finallyStuckPoints.append(stuckPointsTemp.first ?? 0.0)
|
|
|
|
|
|
- clipPoint(clipCount: sticker.clipCount , oldPoints: stuckPointsTemp)
|
|
|
-
|
|
|
-// for i in finallyStuckPoints.count...sticker.clipCount {
|
|
|
-//
|
|
|
-// if ((i % (stuckPointsTemp.count - 1)) != 0){
|
|
|
-// finallyStuckPoints.append(finallyStuckPoints[i-1] + stuckPointsTemp[i%(stuckPointsTemp.count - 1)] - stuckPointsTemp[(i-1)%(stuckPointsTemp.count - 1)])
|
|
|
-// }else {
|
|
|
-// finallyStuckPoints.append(finallyStuckPoints[i-1] + stuckPointsTemp[1] - stuckPointsTemp[0])
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
+ //sticker.clipCount + 1 是都先补一位,当不用补时删除最后多的一位
|
|
|
+ clipPoint(clipCount: sticker.clipCount + 1 , oldPoints: stuckPointsTemp)
|
|
|
BFLog(message: "finallyStuckPoints\(finallyStuckPoints)")
|
|
|
-
|
|
|
-
|
|
|
-//
|
|
|
- // 3,多补一个卡点 做 C级 速处理,要根据条件不满足 不用补位
|
|
|
+
|
|
|
+ // 3,多补一个卡点 做 C级 速处理,要根据条件不满足 要删除最后一位,
|
|
|
if useAssestDurationTemp < assetDuration {
|
|
|
|
|
|
//下一个卡的的速度性质快、慢
|
|
@@ -1471,26 +1463,22 @@ extension PQStuckPointEditerController {
|
|
|
var b:Float = 0.0
|
|
|
if((lastPointIndex ?? 0) + 1 < stuckPointsTemp.count){
|
|
|
b = stuckPointsTemp[(lastPointIndex ?? 0) + 1]
|
|
|
-
|
|
|
let pointDuration = b - a
|
|
|
// 要适应到卡点内要使用的C速度
|
|
|
let needSpeed = lastAssetDuration / pointDuration
|
|
|
-
|
|
|
// 当前卡点段为快速
|
|
|
if tempSpeed >= 1 {
|
|
|
- if needSpeed >= 0.4 * tempSpeed {
|
|
|
-// clipPoint(clipCount: 1 , oldPoints: stuckPointsTemp)
|
|
|
-
|
|
|
-
|
|
|
- }else{
|
|
|
- BFLog(message: "条件不满足不用补位")
|
|
|
+ if needSpeed < 0.4 * tempSpeed {
|
|
|
+ BFLog(message: "条件不满足不用补位 删除多加的一位")
|
|
|
+ finallyStuckPoints.removeLast()
|
|
|
}
|
|
|
} else { // 当前卡点段为慢速
|
|
|
if needSpeed >= 0.4 * tempSpeed && needSpeed >= 0.2 {
|
|
|
// 查找使用的最后一个卡点在原数组中的位置
|
|
|
-// clipPoint(clipCount: 1 , oldPoints: stuckPointsTemp)
|
|
|
}else{
|
|
|
- BFLog(message: "条件不满足不用补位")
|
|
|
+
|
|
|
+ BFLog(message: "条件不满足不用补位 删除多加的一位")
|
|
|
+ finallyStuckPoints.removeLast()
|
|
|
}
|
|
|
}
|
|
|
|