@vibecuting/video-project-core 0.1.27 → 0.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/base/BaseRemotionScene.tsx +4 -3
- package/src/core/index.test.ts +40 -0
- package/src/core/scene/2dscene/default-2d-scene-Horizontal.stories.tsx +1 -1
- package/src/core/scene/2dscene/default-2d-scene.stories.tsx +1 -1
- package/src/core/scene/3dscene/default-3d-scene-Horizontal.stories.tsx +1 -1
- package/src/core/scene/3dscene/default-3d-scene.stories.tsx +1 -1
- package/src/core/scene/index.ts +3 -0
- package/src/core/scene/photo/3dvr-photo/default-3dvr-photo-scene-Horizontal.stories.tsx +46 -0
- package/src/core/scene/photo/3dvr-photo/default-3dvr-photo-scene-Horizontal.tsx +20 -0
- package/src/core/scene/photo/3dvr-photo/default-3dvr-photo-scene-Landscape.tsx +20 -0
- package/src/core/scene/photo/3dvr-photo/default-3dvr-photo-scene.stories.tsx +46 -0
- package/src/core/scene/photo/3dvr-photo/default-3dvr-photo-scene.tsx +255 -0
- package/src/core/scene/photo/3dvr-photo/index.ts +3 -0
- package/src/core/scene/photo/default-live-photo-scene-Horizontal.stories.tsx +33 -0
- package/src/core/scene/photo/default-live-photo-scene-Horizontal.tsx +20 -0
- package/src/core/scene/photo/default-live-photo-scene-Landscape.tsx +20 -0
- package/src/core/scene/photo/default-live-photo-scene.stories.tsx +33 -0
- package/src/core/scene/photo/default-live-photo-scene.tsx +432 -0
- package/src/core/scene/photo/default-photo-strip-scene-Horizontal.tsx +20 -0
- package/src/core/scene/photo/default-photo-strip-scene-Landscape.tsx +20 -0
- package/src/core/scene/photo/default-photo-strip-scene.stories.tsx +38 -0
- package/src/core/scene/photo/default-photo-strip-scene.tsx +19 -0
- package/src/core/scene/photo/default-photo-wall-scene-Horizontal.tsx +20 -0
- package/src/core/scene/photo/default-photo-wall-scene-Landscape.tsx +20 -0
- package/src/core/scene/photo/default-photo-wall-scene.stories.tsx +38 -0
- package/src/core/scene/photo/default-photo-wall-scene.tsx +19 -0
- package/src/core/scene/photo/effects-photo/default-effects-photo-scene-Horizontal.stories.tsx +44 -0
- package/src/core/scene/photo/effects-photo/default-effects-photo-scene-Horizontal.tsx +20 -0
- package/src/core/scene/photo/effects-photo/default-effects-photo-scene-Landscape.tsx +20 -0
- package/src/core/scene/photo/effects-photo/default-effects-photo-scene.stories.tsx +44 -0
- package/src/core/scene/photo/effects-photo/default-effects-photo-scene.tsx +352 -0
- package/src/core/scene/photo/effects-photo/index.ts +3 -0
- package/src/core/scene/photo/index.ts +25 -0
- package/src/core/scene/photo/photo-storybook.test.tsx +112 -0
- package/src/core/scene/slide/default-slide-scene-Horizontal.animated.stories.tsx +1 -1
- package/src/core/scene/slide/default-slide-scene-Horizontal.stories.tsx +1 -1
- package/src/core/scene/slide/default-slide-scene.animated.stories.tsx +1 -1
- package/src/core/scene/slide/default-slide-scene.stories.tsx +1 -1
- package/src/core/scene/video/default-video-scene-Horizontal.stories.tsx +26 -0
- package/src/core/scene/video/default-video-scene-Horizontal.tsx +20 -0
- package/src/core/scene/video/default-video-scene-Landscape.tsx +20 -0
- package/src/core/scene/video/default-video-scene.stories.tsx +26 -0
- package/src/core/scene/video/default-video-scene.tsx +283 -0
- package/src/core/scene/video/default-video-split-scene-Horizontal.tsx +20 -0
- package/src/core/scene/video/default-video-split-scene-Landscape.tsx +20 -0
- package/src/core/scene/video/default-video-split-scene.stories.tsx +41 -0
- package/src/core/scene/video/default-video-split-scene.tsx +19 -0
- package/src/core/scene/video/default-video-wall-scene-Horizontal.tsx +20 -0
- package/src/core/scene/video/default-video-wall-scene-Landscape.tsx +20 -0
- package/src/core/scene/video/default-video-wall-scene.stories.tsx +40 -0
- package/src/core/scene/video/default-video-wall-scene.tsx +19 -0
- package/src/core/scene/video/index.ts +9 -0
- package/src/storybook/remotion-preview.tsx +112 -6
|
@@ -61,12 +61,8 @@ type SpringConfig = {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
function clamp01(value: number) {
|
|
64
|
-
if (value < 0)
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
if (value > 1) {
|
|
68
|
-
return 1
|
|
69
|
-
}
|
|
64
|
+
if (value < 0) return 0
|
|
65
|
+
if (value > 1) return 1
|
|
70
66
|
return value
|
|
71
67
|
}
|
|
72
68
|
|
|
@@ -91,6 +87,116 @@ export function spring({
|
|
|
91
87
|
return clamp01(eased + wobble)
|
|
92
88
|
}
|
|
93
89
|
|
|
90
|
+
type Extrapolate = 'clamp' | 'extend' | 'identity'
|
|
91
|
+
|
|
92
|
+
type EasingFunction = (value: number) => number
|
|
93
|
+
|
|
94
|
+
function clamp(value: number, min: number, max: number) {
|
|
95
|
+
if (value < min) return min
|
|
96
|
+
if (value > max) return max
|
|
97
|
+
return value
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function wrapInOut(easing: EasingFunction): EasingFunction {
|
|
101
|
+
return (value) => {
|
|
102
|
+
if (value <= 0.5) {
|
|
103
|
+
return easing(value * 2) / 2
|
|
104
|
+
}
|
|
105
|
+
return 1 - easing((1 - value) * 2) / 2
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function wrapOut(easing: EasingFunction): EasingFunction {
|
|
110
|
+
return (value) => 1 - easing(1 - value)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function wrapIn(easing: EasingFunction): EasingFunction {
|
|
114
|
+
return (value) => easing(value)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export const Easing = {
|
|
118
|
+
linear: (value: number) => value,
|
|
119
|
+
quad: (value: number) => value * value,
|
|
120
|
+
cubic: (value: number) => value * value * value,
|
|
121
|
+
quart: (value: number) => value * value * value * value,
|
|
122
|
+
quint: (value: number) => value * value * value * value * value,
|
|
123
|
+
sin: (value: number) => 1 - Math.cos((value * Math.PI) / 2),
|
|
124
|
+
exp: (value: number) => (value === 0 ? 0 : 2 ** (10 * (value - 1))),
|
|
125
|
+
circle: (value: number) => 1 - Math.sqrt(1 - value * value),
|
|
126
|
+
back: (value: number) => {
|
|
127
|
+
const overshoot = 1.70158
|
|
128
|
+
return value * value * ((overshoot + 1) * value - overshoot)
|
|
129
|
+
},
|
|
130
|
+
in: wrapIn,
|
|
131
|
+
out: wrapOut,
|
|
132
|
+
inOut: wrapInOut,
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function interpolate(
|
|
136
|
+
input: number,
|
|
137
|
+
inputRange: number[],
|
|
138
|
+
outputRange: number[],
|
|
139
|
+
options?: {
|
|
140
|
+
extrapolateLeft?: Extrapolate
|
|
141
|
+
extrapolateRight?: Extrapolate
|
|
142
|
+
easing?: EasingFunction
|
|
143
|
+
},
|
|
144
|
+
) {
|
|
145
|
+
if (inputRange.length !== outputRange.length || inputRange.length < 2) {
|
|
146
|
+
throw new Error('interpolate() expects inputRange and outputRange of the same length >= 2')
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const leftMode = options?.extrapolateLeft ?? 'extend'
|
|
150
|
+
const rightMode = options?.extrapolateRight ?? 'extend'
|
|
151
|
+
const easing = options?.easing
|
|
152
|
+
|
|
153
|
+
const firstInput = inputRange[0]
|
|
154
|
+
const lastInput = inputRange[inputRange.length - 1]
|
|
155
|
+
|
|
156
|
+
if (input < firstInput) {
|
|
157
|
+
if (leftMode === 'identity') return input
|
|
158
|
+
if (leftMode === 'clamp') return outputRange[0]
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (input > lastInput) {
|
|
162
|
+
if (rightMode === 'identity') return input
|
|
163
|
+
if (rightMode === 'clamp') return outputRange[outputRange.length - 1]
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
let segmentIndex = 0
|
|
167
|
+
for (let index = 0; index < inputRange.length - 1; index += 1) {
|
|
168
|
+
if (inputRange[index + 1] >= input) {
|
|
169
|
+
segmentIndex = index
|
|
170
|
+
break
|
|
171
|
+
}
|
|
172
|
+
segmentIndex = inputRange.length - 2
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const inputStart = inputRange[segmentIndex]
|
|
176
|
+
const inputEnd = inputRange[segmentIndex + 1]
|
|
177
|
+
const outputStart = outputRange[segmentIndex]
|
|
178
|
+
const outputEnd = outputRange[segmentIndex + 1]
|
|
179
|
+
const span = inputEnd - inputStart
|
|
180
|
+
const rawProgress = span === 0 ? 0 : (input - inputStart) / span
|
|
181
|
+
const progress = clamp(easing ? easing(clamp(rawProgress, 0, 1)) : rawProgress, 0, 1)
|
|
182
|
+
|
|
183
|
+
return outputStart + (outputEnd - outputStart) * progress
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export function Img({
|
|
187
|
+
src,
|
|
188
|
+
alt,
|
|
189
|
+
style,
|
|
190
|
+
...rest
|
|
191
|
+
}: {
|
|
192
|
+
src: string
|
|
193
|
+
alt?: string
|
|
194
|
+
style?: CSSProperties
|
|
195
|
+
[key: string]: unknown
|
|
196
|
+
}) {
|
|
197
|
+
return <img {...rest} src={src} alt={alt} style={style} />
|
|
198
|
+
}
|
|
199
|
+
|
|
94
200
|
export function AbsoluteFill({
|
|
95
201
|
children,
|
|
96
202
|
style,
|