@@ -22,14 +22,43 @@ describe("TransitionPresetBuilder", () => {
2222 [ "carouselUpFast" , 0.25 ] ,
2323 [ "fadeSlow" , 2 ] ,
2424 [ "fadeFast" , 0.5 ] ,
25- [ "zoom" , 0.4 ]
25+ [ "zoom" , 0.4 ] ,
26+ [ "shuffleTopRight" , 1 ] ,
27+ [ "shuffleTopRightSlow" , 2 ] ,
28+ [ "shuffleTopRightFast" , 0.5 ]
2629 ] ) ( "runs %s for the render's %s seconds" , ( name , length ) => {
2730 const { in : phase } = build ( { in : name as never } ) ;
28- const [ keyframe ] = [ ...phase . offsetXKeyframes , ...phase . offsetYKeyframes , ...phase . opacityKeyframes ] ;
31+ const [ keyframe ] = [ ...phase . offsetXKeyframes , ...phase . offsetYKeyframes , ...phase . opacityKeyframes , ... phase . rotationKeyframes ] ;
2932
3033 expect ( keyframe . length ) . toBe ( length ) ;
3134 } ) ;
3235
36+ it . each ( [
37+ [ "shuffleBottomLeft" , 17 , { x : - 1.6 , y : 0.5 } ] ,
38+ [ "shuffleBottomRight" , - 17 , { x : 2.6 , y : 0.5 } ] ,
39+ [ "shuffleTopLeft" , - 17 , { x : - 1.6 , y : 0.5 } ] ,
40+ [ "shuffleTopRight" , 17 , { x : 2.6 , y : 0.5 } ] ,
41+ [ "shuffleLeftBottom" , - 25 , { x : 0.5 , y : 3.6 } ] ,
42+ [ "shuffleLeftTop" , 25 , { x : 0.5 , y : - 2.6 } ] ,
43+ [ "shuffleRightBottom" , 25 , { x : 0.5 , y : 3.6 } ] ,
44+ [ "shuffleRightTop" , - 25 , { x : 0.5 , y : - 2.6 } ]
45+ ] ) ( "swings %s by %s degrees about the render's origin" , ( name , angle , origin ) => {
46+ const { in : phaseIn , out : phaseOut } = build ( { in : name as never , out : name as never } ) ;
47+
48+ expect ( phaseIn . rotationKeyframes ) . toEqual ( [ { from : angle , to : 0 , start : 0 , length : 1 , ...SMOOTH } ] ) ;
49+ expect ( phaseOut . rotationKeyframes ) . toEqual ( [ { from : 0 , to : angle , start : 4 , length : 1 , ...SMOOTH } ] ) ;
50+ expect ( phaseIn . origin ) . toEqual ( origin ) ;
51+ expect ( phaseOut . origin ) . toEqual ( origin ) ;
52+ } ) ;
53+
54+ it ( "grows shuffles by half at the clip's edge without fading them" , ( ) => {
55+ const { in : phaseIn , out : phaseOut } = build ( { in : "shuffleLeftTop" , out : "shuffleLeftTop" } ) ;
56+
57+ expect ( phaseIn . scaleKeyframes ) . toEqual ( [ { from : 1.5 , to : 1 , start : 0 , length : 1 , ...SMOOTH } ] ) ;
58+ expect ( phaseOut . scaleKeyframes ) . toEqual ( [ { from : 1 , to : 1.5 , start : 4 , length : 1 , ...SMOOTH } ] ) ;
59+ expect ( [ ...phaseIn . opacityKeyframes , ...phaseOut . opacityKeyframes ] ) . toEqual ( [ ] ) ;
60+ } ) ;
61+
3362 it ( "eases fades with the render's default curve" , ( ) => {
3463 const { in : fadeIn , out : fadeOut } = build ( { in : "fade" , out : "fade" } ) ;
3564
0 commit comments