Jssor 预定义字幕将旧设置转换为新设置,如何?
Jssor predefined caption transitions old setting to new, how to?
我不想使用 Jssor 字幕生成器。相反,我需要一些预定义的字幕过渡配置。
我有一个包含所有可能设置的数组,如下所示:
$sliderAnimationsList:
'Shift LR'=>'{$Duration:1200,x:1,$Easing:{$Left:$Jease$.$EaseInOutQuart,$Opacity:$Jease$.$EaseLinear},$Opacity:2,$Brother:{$Duration:1200,x:-1,$Easing:{$Left:$Jease$.$EaseInOutQuart,$Opacity:$Jease$.$EaseLinear},$Opacity:2}}',
$captionAnimationsList:
'L|IB'=>'{$Duration:1200,x:0.6,$Easing:{$Left:$Jease$.$EaseInOutBack},$Opacity:2}',
我需要将其更改为新设置。
我知道其中一些是这样的:
$Duration:1200 -> d:1200
$Easing:$JssorEasing$.$EaseInCubic -> e:{x:5}
但是还有其他迁移的设置我不知道如何转换。
{$Duration:1000,$Clip:4,$FlyDirection:2,$Easing:$JssorEasing$.$EaseInOutCubic,$ScaleHorizontal:0.8,$ScaleClip:0.8,$During:{$Left:[0.4,0.6],$Clip:[0,0.4]}} -> ?
? -> {b:0,d:500,x:-105},{b:500,d:500,x:230},{b:1000,d:500,y:-120},{b:1500,d:500,x:-70,y:120},{b:2600,d:500,y:-80},{b:3100,d:900,y:160,e:{y:24}}
有人解决过这个问题吗?我想知道解决方案。
简短的回答是,不可能从旧的 -> 新的,或从新的 -> 旧的完全翻译。旧系统有几个功能,如 $Round
和 $Brother
,新系统中根本不存在,而新系统具有多个阶段到使用关键帧的单个过渡,这根本不可能在旧的。这意味着您的最终示例实际上无法翻译,因为它实际上代表了过渡的 6 个阶段:
{b:0,d:500,x:-105}, //stage 1
{b:500,d:500,x:230}, //stage 2
{b:1000,d:500,y:-120}, //stage 3
{b:1500,d:500,x:-70,y:120}, //stage 4
{b:2600,d:500,y:-80}, //stage 5
{b:3100,d:900,y:160,e:{y:24}} //stage 6
但是..我们可以相对轻松地转换一些值。
对于简单的转换,新版本很容易从旧版本计算出来,反之亦然。在新的滑块代码中有一个带有描述性变量名称的值名称列表,附在下面:
$Top: "y",
$Left: "x",
$Bottom: "m",
$Right: "t",
$Rotate: "r",
$RotateX: "rX",
$RotateY: "rY",
$ScaleX: "sX",
$ScaleY: "sY",
$TranslateX: "tX",
$TranslateY: "tY",
$TranslateZ: "tZ",
$SkewX: "kX",
$SkewY: "kY",
$Opacity: "o",
$Easing: "e",
$ZIndex: "i",
$Clip: "c",
vb: "bc",
xd: "re",
wd: "gr",
Bd: "bl"
可以在这里找到:https://github.com/jssor/slider/blob/master/js/jssor.slider.min.js
然后,我们可以应用一些常识,根据旧值计算出新语法适用于更复杂的元素。这需要尝试使用新工具并查看它添加了哪些值,因为有些东西(如缓动)是无意义的整数。 (在这个答案的底部找到缓动列表)。
所以如果我们以你的例子为例:
{
$Duration:1000,
$Clip:4,
$FlyDirection:2,
$Easing:$JssorEasing$.$EaseInOutCubic,
$ScaleHorizontal:0.8,
$ScaleClip:0.8,
$During:{
$Left:[0.4,0.6],
$Clip:[0,0.4]
}
}
这变成:
{
b:0, // starting time in ms
d:1000, // duration in ms
c: { // clip
y: 40.0 // desired top clip amount in percent - would also take the position of $ScaleClip
},
// flyDirection doesn't really exist any more as this is now managed by x and y values
x: 80 // x movement value in pixels
sX: -0.2, // scale horizontal (expressed as the scale percentage (as a float) to be deducted from the scale total)
// for scaleClip, see c: y
e: { // easing - added once per transitioning value
c: {
y: 7 // see values at bottom of answer for easing translations
},
x: 7
}
// during: left and during: clip would now be managed by x / y & clip values
}
如您所见,它很快就会变得复杂得多。我强烈建议使用该工具重新创建这些转换,因为计算某些值可能会非常复杂。
无论如何,我希望这些信息对您有所帮助。
Easing类型列表及其对应的数字代码:
Linear: 0,
Swing: 1,
InQuad: 2,
OutQuad: 3,
InOutQuad: 4,
InCubic: 5,
OutCubic: 6,
InOutCubic: 7,
InQuart: 8,
OutQuart: 9,
InOutQuart: 10,
InQuint: 11,
OutQuint: 12,
InOutQuint: 13,
InSine: 14,
OutSine: 15,
InOutSine: 16,
InExpo: 17,
OutExpo: 18,
InOutExpo: 19,
InCirc: 20,
OutCirc: 21,
InOutCirc: 22,
InElastic: 23,
OutElastic: 24,
InOutElastic: 25,
InBack: 26,
OutBack: 27,
InOutBack: 28,
InBounce: 29,
OutBounce: 30,
InOutBounce: 31,
Early: 32,
Late: 33
我不想使用 Jssor 字幕生成器。相反,我需要一些预定义的字幕过渡配置。 我有一个包含所有可能设置的数组,如下所示:
$sliderAnimationsList:
'Shift LR'=>'{$Duration:1200,x:1,$Easing:{$Left:$Jease$.$EaseInOutQuart,$Opacity:$Jease$.$EaseLinear},$Opacity:2,$Brother:{$Duration:1200,x:-1,$Easing:{$Left:$Jease$.$EaseInOutQuart,$Opacity:$Jease$.$EaseLinear},$Opacity:2}}',
$captionAnimationsList:
'L|IB'=>'{$Duration:1200,x:0.6,$Easing:{$Left:$Jease$.$EaseInOutBack},$Opacity:2}',
我需要将其更改为新设置。 我知道其中一些是这样的:
$Duration:1200 -> d:1200
$Easing:$JssorEasing$.$EaseInCubic -> e:{x:5}
但是还有其他迁移的设置我不知道如何转换。
{$Duration:1000,$Clip:4,$FlyDirection:2,$Easing:$JssorEasing$.$EaseInOutCubic,$ScaleHorizontal:0.8,$ScaleClip:0.8,$During:{$Left:[0.4,0.6],$Clip:[0,0.4]}} -> ?
? -> {b:0,d:500,x:-105},{b:500,d:500,x:230},{b:1000,d:500,y:-120},{b:1500,d:500,x:-70,y:120},{b:2600,d:500,y:-80},{b:3100,d:900,y:160,e:{y:24}}
有人解决过这个问题吗?我想知道解决方案。
简短的回答是,不可能从旧的 -> 新的,或从新的 -> 旧的完全翻译。旧系统有几个功能,如 $Round
和 $Brother
,新系统中根本不存在,而新系统具有多个阶段到使用关键帧的单个过渡,这根本不可能在旧的。这意味着您的最终示例实际上无法翻译,因为它实际上代表了过渡的 6 个阶段:
{b:0,d:500,x:-105}, //stage 1
{b:500,d:500,x:230}, //stage 2
{b:1000,d:500,y:-120}, //stage 3
{b:1500,d:500,x:-70,y:120}, //stage 4
{b:2600,d:500,y:-80}, //stage 5
{b:3100,d:900,y:160,e:{y:24}} //stage 6
但是..我们可以相对轻松地转换一些值。
对于简单的转换,新版本很容易从旧版本计算出来,反之亦然。在新的滑块代码中有一个带有描述性变量名称的值名称列表,附在下面:
$Top: "y",
$Left: "x",
$Bottom: "m",
$Right: "t",
$Rotate: "r",
$RotateX: "rX",
$RotateY: "rY",
$ScaleX: "sX",
$ScaleY: "sY",
$TranslateX: "tX",
$TranslateY: "tY",
$TranslateZ: "tZ",
$SkewX: "kX",
$SkewY: "kY",
$Opacity: "o",
$Easing: "e",
$ZIndex: "i",
$Clip: "c",
vb: "bc",
xd: "re",
wd: "gr",
Bd: "bl"
可以在这里找到:https://github.com/jssor/slider/blob/master/js/jssor.slider.min.js
然后,我们可以应用一些常识,根据旧值计算出新语法适用于更复杂的元素。这需要尝试使用新工具并查看它添加了哪些值,因为有些东西(如缓动)是无意义的整数。 (在这个答案的底部找到缓动列表)。
所以如果我们以你的例子为例:
{
$Duration:1000,
$Clip:4,
$FlyDirection:2,
$Easing:$JssorEasing$.$EaseInOutCubic,
$ScaleHorizontal:0.8,
$ScaleClip:0.8,
$During:{
$Left:[0.4,0.6],
$Clip:[0,0.4]
}
}
这变成:
{
b:0, // starting time in ms
d:1000, // duration in ms
c: { // clip
y: 40.0 // desired top clip amount in percent - would also take the position of $ScaleClip
},
// flyDirection doesn't really exist any more as this is now managed by x and y values
x: 80 // x movement value in pixels
sX: -0.2, // scale horizontal (expressed as the scale percentage (as a float) to be deducted from the scale total)
// for scaleClip, see c: y
e: { // easing - added once per transitioning value
c: {
y: 7 // see values at bottom of answer for easing translations
},
x: 7
}
// during: left and during: clip would now be managed by x / y & clip values
}
如您所见,它很快就会变得复杂得多。我强烈建议使用该工具重新创建这些转换,因为计算某些值可能会非常复杂。
无论如何,我希望这些信息对您有所帮助。
Easing类型列表及其对应的数字代码:
Linear: 0,
Swing: 1,
InQuad: 2,
OutQuad: 3,
InOutQuad: 4,
InCubic: 5,
OutCubic: 6,
InOutCubic: 7,
InQuart: 8,
OutQuart: 9,
InOutQuart: 10,
InQuint: 11,
OutQuint: 12,
InOutQuint: 13,
InSine: 14,
OutSine: 15,
InOutSine: 16,
InExpo: 17,
OutExpo: 18,
InOutExpo: 19,
InCirc: 20,
OutCirc: 21,
InOutCirc: 22,
InElastic: 23,
OutElastic: 24,
InOutElastic: 25,
InBack: 26,
OutBack: 27,
InOutBack: 28,
InBounce: 29,
OutBounce: 30,
InOutBounce: 31,
Early: 32,
Late: 33