Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Remove wobble animation and adjust timeline UI

Richie McIlroy64df88b88827
diff --git a/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx b/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
index 0d1fcc13f..258103521 100644
--- a/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
+++ b/apps/desktop/src/routes/editor/Timeline/ClipTrack.tsx
@@ -389,9 +389,7 @@ export function ClipTrack(
class={cx(
"border transition-colors duration-200 group hover:border-gray-12",
"bg-gradient-to-r from-[#2675DB] via-[#4FA0FF] to-[#2675DB] shadow-[inset_0_5px_10px_5px_rgba(255,255,255,0.2)]",
- isSelected()
- ? "wobble-wrapper border-gray-12"
- : "border-transparent",
+ isSelected() ? "border-gray-12" : "border-transparent",
)}
innerClass="ring-blue-9"
segment={relativeSegment()}
diff --git a/apps/desktop/src/routes/editor/Timeline/SceneTrack.tsx b/apps/desktop/src/routes/editor/Timeline/SceneTrack.tsx
index 3d785fb14..193ce67b3 100644
--- a/apps/desktop/src/routes/editor/Timeline/SceneTrack.tsx
+++ b/apps/desktop/src/routes/editor/Timeline/SceneTrack.tsx
@@ -357,9 +357,7 @@ export function SceneTrack(props: {
class={cx(
"border transition-colors duration-200 hover:border-gray-12 group",
`bg-gradient-to-r from-[#5C1BC4] via-[#975CFA] to-[#5C1BC4] shadow-[inset_0_8px_12px_3px_rgba(255,255,255,0.2)]`,
- isSelected()
- ? "wobble-wrapper border-gray-12"
- : "border-transparent",
+ isSelected() ? "border-gray-12" : "border-transparent",
)}
innerClass="ring-blue-5"
segment={segment}
diff --git a/apps/desktop/src/routes/editor/Timeline/TrackManager.tsx b/apps/desktop/src/routes/editor/Timeline/TrackManager.tsx
index 7b875de5e..353e071b8 100644
--- a/apps/desktop/src/routes/editor/Timeline/TrackManager.tsx
+++ b/apps/desktop/src/routes/editor/Timeline/TrackManager.tsx
@@ -56,7 +56,7 @@ export function TrackManager(props: {
ref={(el) => {
addButton = el;
}}
- class="flex h-8 w-9 items-center justify-center rounded-lg border border-gray-4/80 bg-gray-2 text-sm font-medium text-gray-12 transition-colors duration-150 hover:bg-gray-3 dark:border-gray-5/60 dark:bg-gray-4/50"
+ class="flex h-8 w-[3.5rem] items-center justify-center rounded-lg border border-gray-4/80 bg-gray-2 text-sm font-medium text-gray-12 transition-colors duration-150 hover:bg-gray-3 dark:border-gray-5/60 dark:bg-gray-4/50"
onClick={handleOpenMenu}
onMouseDown={(e) => e.stopPropagation()}
>
diff --git a/apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx b/apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx
index 1d476bdf8..1e34facc9 100644
--- a/apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx
+++ b/apps/desktop/src/routes/editor/Timeline/ZoomTrack.tsx
@@ -420,9 +420,7 @@ export function ZoomTrack(props: {
class={cx(
"border duration-200 hover:border-gray-12 transition-colors group",
"bg-gradient-to-r from-[#292929] via-[#434343] to-[#292929] shadow-[inset_0_8px_12px_3px_rgba(255,255,255,0.2)]",
- isSelected()
- ? "wobble-wrapper border-gray-12"
- : "border-transparent",
+ isSelected() ? "border-gray-12" : "border-transparent",
)}
innerClass="ring-red-5"
segment={segment}
diff --git a/apps/desktop/src/routes/editor/Timeline/index.tsx b/apps/desktop/src/routes/editor/Timeline/index.tsx
index a0043fd6f..f1cd68c97 100644
--- a/apps/desktop/src/routes/editor/Timeline/index.tsx
+++ b/apps/desktop/src/routes/editor/Timeline/index.tsx
@@ -33,7 +33,7 @@ import { type ZoomSegmentDragState, ZoomTrack } from "./ZoomTrack";
const TIMELINE_PADDING = 16;
const TRACK_GUTTER = 64;
const TIMELINE_HEADER_HEIGHT = 32;
-const TRACK_MANAGER_BUTTON_SIZE = 36;
+const TRACK_MANAGER_BUTTON_SIZE = 56;
const trackIcons: Record<TimelineTrackType, JSX.Element> = {
clip: <IconLucideClapperboard class="size-4" />,
@@ -262,12 +262,17 @@ export function Timeline() {
});
}}
onMouseMove={(e) => {
- const { left } = timelineBounds;
+ const { left, width } = timelineBounds;
if (editorState.playing) return;
- if (left == null) return;
+ if (left == null || !width || width <= 0) return;
+ const offsetX = e.clientX - left;
+ if (offsetX < 0 || offsetX > width) {
+ setEditorState("previewTime", null);
+ return;
+ }
setEditorState(
"previewTime",
- transform().position + secsPerPixel() * (e.clientX - left),
+ transform().position + secsPerPixel() * offsetX,
);
}}
onMouseEnter={() => setEditorState("timeline", "hoveredTrack", null)}
diff --git a/apps/desktop/src/routes/editor/Timeline/styles.css b/apps/desktop/src/routes/editor/Timeline/styles.css
index fcf1312df..12084fda3 100644
--- a/apps/desktop/src/routes/editor/Timeline/styles.css
+++ b/apps/desktop/src/routes/editor/Timeline/styles.css
@@ -1,18 +1,3 @@
-@keyframes wobble {
- 0%,
- 100% {
- transform: translateY(0) translateX(var(--segment-x));
- }
- 50% {
- transform: translateY(-3px) translateX(var(--segment-x));
- }
-}
-
-.wobble-wrapper {
- animation: wobble 1s ease-in-out infinite;
- will-change: transform;
-}
-
.timeline-scissors-cursor {
cursor:
url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg' shape-rendering='geometricPrecision'%3E%3Cg transform='rotate(90 10 10)'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M5 2.5C3.15905 2.5 1.66666 3.99238 1.66666 5.83333C1.66666 7.67428 3.15905 9.16667 5 9.16667C5.85421 9.16667 6.63337 8.84536 7.22322 8.317L9.74771 10L7.22322 11.683C6.63337 11.1546 5.85421 10.8333 5 10.8333C3.15905 10.8333 1.66666 12.3257 1.66666 14.1667C1.66666 16.0076 3.15905 17.5 5 17.5C6.84095 17.5 8.33333 16.0076 8.33333 14.1667C8.33333 13.7822 8.26824 13.4129 8.14846 13.0692L18.6556 6.06446C18.1451 5.29858 17.1103 5.09162 16.3444 5.60221L11.25 8.99846L8.14846 6.93075C8.26824 6.5871 8.33333 6.21782 8.33333 5.83333C8.33333 3.99238 6.84095 2.5 5 2.5ZM3.33333 5.83333C3.33333 4.91286 4.07952 4.16667 5 4.16667C5.92047 4.16667 6.66666 4.91286 6.66666 5.83333C6.66666 6.75381 5.92047 7.5 5 7.5C4.07952 7.5 3.33333 6.75381 3.33333 5.83333ZM3.33333 14.1667C3.33333 13.2462 4.07952 12.5 5 12.5C5.92047 12.5 6.66666 13.2462 6.66666 14.1667C6.66666 15.0871 5.92047 15.8333 5 15.8333C4.07952 15.8333 3.33333 15.0871 3.33333 14.1667Z' fill='%23ffffff' stroke='%23000000' stroke-width='0.6'/%3E%3Cpath d='M16.3444 14.3978L12.0012 11.5023L13.5035 10.5008L18.6556 13.9355C18.1451 14.7014 17.1103 14.9084 16.3444 14.3978Z' fill='%23ffffff' stroke='%23000000' stroke-width='0.6'/%3E%3C/g%3E%3C/svg%3E")