Skip to content

Create professional demos and 3D mockups in seconds, directly in your browser

feat: enhance loading component styles and update ViewerControls3D options

CristianOlivera1289b452bf5db
diff --git a/app/[locale]/(editor)/editor/loading.tsx b/app/[locale]/(editor)/editor/loading.tsx
index 7382566..946bd9d 100644
--- a/app/[locale]/(editor)/editor/loading.tsx
+++ b/app/[locale]/(editor)/editor/loading.tsx
@@ -10,7 +10,7 @@ export default function Loading() {
<div className="absolute inset-0 flex items-center justify-center pointer-events-none z-0 overflow-hidden select-none">
<div className="absolute size-[1200px] rounded-full bg-radial from-cyan-700/10 via-indigo-700/3 to-transparent blur-[200px] mix-blend-plus-lighter transform-gpu" />
- <div className="absolute size-[800px] rounded-full bg-radial from-cyan-700/10 via-purple-700/4 to-transparent blur-[140px] mix-blend-plus-lighter transform-gpu" />
+ <div className="absolute size-[800px] rounded-full bg-radial from-cyan-800/10 via-purple-800/4 to-transparent blur-[140px] mix-blend-plus-lighter transform-gpu" />
</div>
<div className="relative flex items-center justify-center z-10 scale-95 animate-[pulse_6s_ease-in-out_infinite]">
diff --git a/app/components/ui/editor/IPhone13ProMax3DViewer.tsx b/app/components/ui/editor/IPhone13ProMax3DViewer.tsx
index 873efe1..351299c 100644
--- a/app/components/ui/editor/IPhone13ProMax3DViewer.tsx
+++ b/app/components/ui/editor/IPhone13ProMax3DViewer.tsx
@@ -145,7 +145,11 @@ function ModelScene({
const lastLoadedCropKeyRef = useRef<string | null>(null);
const wallpaperMatRef = useRef<THREE.MeshStandardMaterial | null>(null);
const videoTextureRef = useRef<THREE.VideoTexture | null>(null);
- const { autoRotate, rotationSpeed, glow, environment } = ViewerControls3D();
+ const { autoRotate, rotationSpeed, glow, environment } = ViewerControls3D({
+ defaultEnvironment: "sunset",
+ defaultGlow: 2.0,
+ });
+
const onApiRef = useRef(onApi);
useLayoutEffect(() => { onApiRef.current = onApi; });
@@ -357,7 +361,6 @@ function ModelScene({
}
}, [initialRotationZ]);
- // ContactShadows parameters derived from shadowIntensity
const shadowT = Math.max(0, Math.min(1, shadowIntensity));
const showContactShadow = shadowT > 0.01;
const contactOpacity = shadowT * 0.65;
diff --git a/app/components/ui/editor/Phone3DViewer.tsx b/app/components/ui/editor/Phone3DViewer.tsx
index 72ca8af..8a16f93 100644
--- a/app/components/ui/editor/Phone3DViewer.tsx
+++ b/app/components/ui/editor/Phone3DViewer.tsx
@@ -185,7 +185,6 @@ function ModelScene({
cornerRadius = Math.round(TARGET_W * deviceConfig.cornerRadiusFactor);
}
- // El placeholder no tiene cropArea ni mask — se cubre "cover" a pantalla completa
const cover = createCoverScreenCanvas(img, TARGET_W, TARGET_H, cornerRadius, null);
if (currentMat.map) {
@@ -209,8 +208,6 @@ function ModelScene({
lastLoadedCropKeyRef.current = null;
};
img.onerror = () => {
- // Si el placeholder falla en cargar, al menos deja la pantalla
- // en un gris neutro en vez de quedar sin textura.
const currentMat = screenMatRef.current;
if (!currentMat) return;
if (currentMat.map) {
diff --git a/lib/viewer-controls3d.ts b/lib/viewer-controls3d.ts
index 6fdc2b8..cfd9573 100644
--- a/lib/viewer-controls3d.ts
+++ b/lib/viewer-controls3d.ts
@@ -5,13 +5,14 @@ export type EnvironmentPreset = "sunset" | "dawn" | "night" | "warehouse" | "for
interface ViewerControlsOptions {
defaultEnvironment?: EnvironmentPreset;
+ defaultGlow?: number;
}
-export function ViewerControls3D({ defaultEnvironment = "studio" }: ViewerControlsOptions = {}) {
+export function ViewerControls3D({ defaultEnvironment = "studio", defaultGlow = 1.0 }: ViewerControlsOptions = {}) {
const [controls, set] = useControls("Configuration 3D", () => ({
autoRotate: false,
rotationSpeed: { value: 3.5, min: 0.1, max: 10, step: 0.1 },
- glow: { value: 1.0, min: 0.0, max: 5.0, step: 0.1 },
+ glow: { value: defaultGlow, min: 0.0, max: 5.0, step: 0.1 },
environment: {
options: ['sunset', 'dawn', 'night', 'warehouse', 'forest', 'apartment', 'studio', 'city', 'park', 'lobby'],
value: defaultEnvironment