Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Cursor smoothing (#333)

Brendan Allane32455a36c16
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index edef5bd82..51b842034 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -135,12 +135,10 @@ jobs:
- name: Output .env file
run: cat apps/desktop/.env
- - name: Build macOS apps
+ - name: Build app
working-directory: apps/desktop
run: |
pnpm -w cap-setup
- pnpm tauri build --debug --target ${{ matrix.settings.target }}
+ pnpm tauri build --debug --target ${{ matrix.settings.target }} --nobundle
env:
- # https://github.com/tauri-apps/tauri-action/issues/740
- CI: false
RUST_TARGET_TRIPLE: ${{ matrix.settings.target }}
diff --git a/Cargo.lock b/Cargo.lock
index b0222ca44..bc82dc85b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -220,9 +220,9 @@ dependencies = [
"core-graphics 0.23.2",
"image 0.25.5",
"log",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-app-kit 0.2.2",
+ "objc2-foundation 0.2.2",
"parking_lot",
"windows-sys 0.48.0",
"x11rb",
@@ -726,7 +726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e58aa60e59d8dbfcc36138f5f18be5f24394d33b38b24f7fd0b1caa33095f22f"
dependencies = [
"block-sys",
- "objc2",
+ "objc2 0.5.2",
]
[[package]]
@@ -735,7 +735,16 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
dependencies = [
- "objc2",
+ "objc2 0.5.2",
+]
+
+[[package]]
+name = "block2"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d59b4c170e16f0405a2e95aff44432a0d41aa97675f3d52623effe95792a037"
+dependencies = [
+ "objc2 0.6.0",
]
[[package]]
@@ -941,7 +950,7 @@ dependencies = [
"mp4",
"nix 0.29.0",
"objc",
- "objc2-app-kit",
+ "objc2-app-kit 0.2.2",
"png",
"rand 0.8.5",
"relative-path",
@@ -1060,7 +1069,7 @@ dependencies = [
"num-traits",
"objc",
"objc-foundation",
- "objc2-foundation",
+ "objc2-foundation 0.2.2",
"ringbuf",
"scap",
"screencapturekit",
@@ -1121,7 +1130,6 @@ dependencies = [
"bytemuck",
"cap-flags",
"cap-project",
- "cap-recording",
"cidre",
"ffmpeg-hw-device",
"ffmpeg-next",
@@ -1372,15 +1380,16 @@ checksum = "4bfbf56724aa9eca8afa4fcfadeb479e722935bb2a0900c2d37e0cc477af0688"
[[package]]
name = "clipboard-rs"
-version = "0.2.2"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c525d1554fa31abe88c8aa853d3cf0170320f6553dbc322642d4fe0a5cb2cda1"
+checksum = "afede46921767868c5c7f8f55202bdd8bec0bab6bc9605174200f45924f93c62"
dependencies = [
"clipboard-win",
"image 0.25.5",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
+ "objc2 0.6.0",
+ "objc2-app-kit 0.3.0",
+ "objc2-foundation 0.3.0",
+ "windows 0.59.0",
"x11rb",
]
@@ -3027,8 +3036,8 @@ checksum = "b00d88f1be7bf4cd2e61623ce08e84be2dfa4eab458e5d632d3dab95f16c1f64"
dependencies = [
"crossbeam-channel",
"keyboard-types",
- "objc2",
- "objc2-app-kit",
+ "objc2 0.5.2",
+ "objc2-app-kit 0.2.2",
"once_cell",
"serde",
"thiserror 1.0.63",
@@ -3487,7 +3496,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fb69199826926eb864697bddd27f73d9fddcffc004f5733131e15b465e30642"
dependencies = [
"block2 0.4.0",
- "objc2",
+ "objc2 0.5.2",
]
[[package]]
@@ -4235,9 +4244,9 @@ dependencies = [
"dpi",
"gtk",
"keyboard-types",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-app-kit 0.2.2",
+ "objc2-foundation 0.2.2",
"once_cell",
"png",
"serde",
@@ -4639,6 +4648,15 @@ dependencies = [
"objc2-encode",
]
+[[package]]
+name = "objc2"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3531f65190d9cff863b77a99857e74c314dd16bf56c538c4b57c7cbc3f3a6e59"
+dependencies = [
+ "objc2-encode",
+]
+
[[package]]
name = "objc2-app-kit"
version = "0.2.2"
@@ -4648,11 +4666,30 @@ dependencies = [
"bitflags 2.6.0",
"block2 0.5.1",
"libc",
- "objc2",
- "objc2-core-data",
- "objc2-core-image",
- "objc2-foundation",
- "objc2-quartz-core",
+ "objc2 0.5.2",
+ "objc2-core-data 0.2.2",
+ "objc2-core-image 0.2.2",
+ "objc2-foundation 0.2.2",
+ "objc2-quartz-core 0.2.2",
+]
+
+[[package]]
+name = "objc2-app-kit"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5906f93257178e2f7ae069efb89fbd6ee94f0592740b5f8a1512ca498814d0fb"
+dependencies = [
+ "bitflags 2.6.0",
+ "block2 0.6.0",
+ "libc",
+ "objc2 0.6.0",
+ "objc2-cloud-kit 0.3.0",
+ "objc2-core-data 0.3.0",
+ "objc2-core-foundation",
+ "objc2-core-graphics",
+ "objc2-core-image 0.3.0",
+ "objc2-foundation 0.3.0",
+ "objc2-quartz-core 0.3.0",
]
[[package]]
@@ -4663,9 +4700,20 @@ checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
dependencies = [
"bitflags 2.6.0",
"block2 0.5.1",
- "objc2",
+ "objc2 0.5.2",
"objc2-core-location",
- "objc2-foundation",
+ "objc2-foundation 0.2.2",
+]
+
+[[package]]
+name = "objc2-cloud-kit"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c1948a9be5f469deadbd6bcb86ad7ff9e47b4f632380139722f7d9840c0d42c"
+dependencies = [
+ "bitflags 2.6.0",
+ "objc2 0.6.0",
+ "objc2-foundation 0.3.0",
]
[[package]]
@@ -4675,8 +4723,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889"
dependencies = [
"block2 0.5.1",
- "objc2",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-foundation 0.2.2",
]
[[package]]
@@ -4687,8 +4735,41 @@ checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef"
dependencies = [
"bitflags 2.6.0",
"block2 0.5.1",
- "objc2",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-foundation 0.2.2",
+]
+
+[[package]]
+name = "objc2-core-data"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f860f8e841f6d32f754836f51e6bc7777cd7e7053cf18528233f6811d3eceb4"
+dependencies = [
+ "bitflags 2.6.0",
+ "objc2 0.6.0",
+ "objc2-foundation 0.3.0",
+]
+
+[[package]]
+name = "objc2-core-foundation"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "daeaf60f25471d26948a1c2f840e3f7d86f4109e3af4e8e4b5cd70c39690d925"
+dependencies = [
+ "bitflags 2.6.0",
+ "objc2 0.6.0",
+]
+
+[[package]]
+name = "objc2-core-graphics"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8dca602628b65356b6513290a21a6405b4d4027b8b250f0b98dddbb28b7de02"
+dependencies = [
+ "bitflags 2.6.0",
+ "objc2 0.6.0",
+ "objc2-core-foundation",
+ "objc2-io-surface",
]
[[package]]
@@ -4698,11 +4779,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80"
dependencies = [
"block2 0.5.1",
- "objc2",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-foundation 0.2.2",
"objc2-metal",
]
+[[package]]
+name = "objc2-core-image"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ffa6bea72bf42c78b0b34e89c0bafac877d5f80bf91e159a5d96ea7f693ca56"
+dependencies = [
+ "objc2 0.6.0",
+ "objc2-foundation 0.3.0",
+]
+
[[package]]
name = "objc2-core-location"
version = "0.2.2"
@@ -4710,16 +4801,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781"
dependencies = [
"block2 0.5.1",
- "objc2",
+ "objc2 0.5.2",
"objc2-contacts",
- "objc2-foundation",
+ "objc2-foundation 0.2.2",
]
[[package]]
name = "objc2-encode"
-version = "4.0.3"
+version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7891e71393cd1f227313c9379a26a584ff3d7e6e7159e988851f0934c993f0f8"
+checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
[[package]]
name = "objc2-foundation"
@@ -4731,7 +4822,31 @@ dependencies = [
"block2 0.5.1",
"dispatch",
"libc",
- "objc2",
+ "objc2 0.5.2",
+]
+
+[[package]]
+name = "objc2-foundation"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3a21c6c9014b82c39515db5b396f91645182611c97d24637cf56ac01e5f8d998"
+dependencies = [
+ "bitflags 2.6.0",
+ "block2 0.6.0",
+ "libc",
+ "objc2 0.6.0",
+ "objc2-core-foundation",
+]
+
+[[package]]
+name = "objc2-io-surface"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "161a8b87e32610086e1a7a9e9ec39f84459db7b3a0881c1f16ca5a2605581c19"
+dependencies = [
+ "bitflags 2.6.0",
+ "objc2 0.6.0",
+ "objc2-core-foundation",
]
[[package]]
@@ -4741,9 +4856,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398"
dependencies = [
"block2 0.5.1",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-app-kit 0.2.2",
+ "objc2-foundation 0.2.2",
]
[[package]]
@@ -4754,8 +4869,8 @@ checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"
dependencies = [
"bitflags 2.6.0",
"block2 0.5.1",
- "objc2",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-foundation 0.2.2",
]
[[package]]
@@ -4765,9 +4880,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6788b04a18ea31e3dc3ab256b8546639e5bbae07c1a0dc4ea8615252bc6aee9a"
dependencies = [
"bitflags 2.6.0",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-app-kit 0.2.2",
+ "objc2-foundation 0.2.2",
]
[[package]]
@@ -4778,19 +4893,30 @@ checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a"
dependencies = [
"bitflags 2.6.0",
"block2 0.5.1",
- "objc2",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-foundation 0.2.2",
"objc2-metal",
]
+[[package]]
+name = "objc2-quartz-core"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6fb3794501bb1bee12f08dcad8c61f2a5875791ad1c6f47faa71a0f033f20071"
+dependencies = [
+ "bitflags 2.6.0",
+ "objc2 0.6.0",
+ "objc2-foundation 0.3.0",
+]
+
[[package]]
name = "objc2-symbols"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc"
dependencies = [
- "objc2",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-foundation 0.2.2",
]
[[package]]
@@ -4801,14 +4927,14 @@ checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f"
dependencies = [
"bitflags 2.6.0",
"block2 0.5.1",
- "objc2",
- "objc2-cloud-kit",
- "objc2-core-data",
- "objc2-core-image",
+ "objc2 0.5.2",
+ "objc2-cloud-kit 0.2.2",
+ "objc2-core-data 0.2.2",
+ "objc2-core-image 0.2.2",
"objc2-core-location",
- "objc2-foundation",
+ "objc2-foundation 0.2.2",
"objc2-link-presentation",
- "objc2-quartz-core",
+ "objc2-quartz-core 0.2.2",
"objc2-symbols",
"objc2-uniform-type-identifiers",
"objc2-user-notifications",
@@ -4821,8 +4947,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe"
dependencies = [
"block2 0.5.1",
- "objc2",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-foundation 0.2.2",
]
[[package]]
@@ -4833,9 +4959,9 @@ checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3"
dependencies = [
"bitflags 2.6.0",
"block2 0.5.1",
- "objc2",
+ "objc2 0.5.2",
"objc2-core-location",
- "objc2-foundation",
+ "objc2-foundation 0.2.2",
]
[[package]]
@@ -4846,9 +4972,9 @@ checksum = "68bc69301064cebefc6c4c90ce9cba69225239e4b8ff99d445a2b5563797da65"
dependencies = [
"bitflags 2.6.0",
"block2 0.5.1",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-app-kit 0.2.2",
+ "objc2-foundation 0.2.2",
]
[[package]]
@@ -5031,7 +5157,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35366a452fce3f8947eb2f33226a133aaf0cacedef2af67ade348d58be7f85d0"
dependencies = [
"icrate",
- "objc2-foundation",
+ "objc2-foundation 0.2.2",
"objc2-osa-kit",
"serde",
"serde_json",
@@ -5969,9 +6095,9 @@ dependencies = [
"gtk-sys",
"js-sys",
"log",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-app-kit 0.2.2",
+ "objc2-foundation 0.2.2",
"raw-window-handle",
"wasm-bindgen",
"wasm-bindgen-futures",
@@ -6719,10 +6845,10 @@ dependencies = [
"foreign-types 0.5.0",
"js-sys",
"log",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
- "objc2-quartz-core",
+ "objc2 0.5.2",
+ "objc2-app-kit 0.2.2",
+ "objc2-foundation 0.2.2",
+ "objc2-quartz-core 0.2.2",
"raw-window-handle",
"redox_syscall",
"wasm-bindgen",
@@ -7132,9 +7258,9 @@ dependencies = [
"log",
"mime",
"muda",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-app-kit 0.2.2",
+ "objc2-foundation 0.2.2",
"percent-encoding",
"plist",
"raw-window-handle",
@@ -7574,9 +7700,9 @@ dependencies = [
"http",
"jni",
"log",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-app-kit 0.2.2",
+ "objc2-foundation 0.2.2",
"percent-encoding",
"raw-window-handle",
"softbuffer",
@@ -8113,9 +8239,9 @@ dependencies = [
"dirs 5.0.1",
"libappindicator",
"muda",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-app-kit 0.2.2",
+ "objc2-foundation 0.2.2",
"once_cell",
"png",
"serde",
@@ -8928,6 +9054,16 @@ dependencies = [
"windows-targets 0.52.6",
]
+[[package]]
+name = "windows"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f919aee0a93304be7f62e8e5027811bbba96bcb1de84d6618be56e43f8a32a1"
+dependencies = [
+ "windows-core 0.59.0",
+ "windows-targets 0.53.0",
+]
+
[[package]]
name = "windows-capture"
version = "1.3.6"
@@ -8984,6 +9120,19 @@ dependencies = [
"windows-targets 0.52.6",
]
+[[package]]
+name = "windows-core"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "810ce18ed2112484b0d4e15d022e5f598113e220c53e373fb31e67e21670c1ce"
+dependencies = [
+ "windows-implement 0.59.0",
+ "windows-interface 0.59.0",
+ "windows-result 0.3.0",
+ "windows-strings 0.3.0",
+ "windows-targets 0.53.0",
+]
+
[[package]]
name = "windows-implement"
version = "0.56.0"
@@ -9006,6 +9155,17 @@ dependencies = [
"syn 2.0.90",
]
+[[package]]
+name = "windows-implement"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "83577b051e2f49a058c308f17f273b570a6a758386fc291b5f6a934dd84e48c1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.90",
+]
+
[[package]]
name = "windows-interface"
version = "0.56.0"
@@ -9028,6 +9188,17 @@ dependencies = [
"syn 2.0.90",
]
+[[package]]
+name = "windows-interface"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb26fd936d991781ea39e87c3a27285081e3c0da5ca0fcbc02d368cc6f52ff01"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.90",
+]
+
[[package]]
name = "windows-registry"
version = "0.2.0"
@@ -9068,6 +9239,15 @@ dependencies = [
"windows-targets 0.52.6",
]
+[[package]]
+name = "windows-result"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d08106ce80268c4067c0571ca55a9b4e9516518eaa1a1fe9b37ca403ae1d1a34"
+dependencies = [
+ "windows-targets 0.53.0",
+]
+
[[package]]
name = "windows-strings"
version = "0.1.0"
@@ -9087,6 +9267,15 @@ dependencies = [
"windows-targets 0.52.6",
]
+[[package]]
+name = "windows-strings"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b888f919960b42ea4e11c2f408fadb55f78a9f236d5eef084103c8ce52893491"
+dependencies = [
+ "windows-targets 0.53.0",
+]
+
[[package]]
name = "windows-sys"
version = "0.45.0"
@@ -9162,13 +9351,29 @@ dependencies = [
"windows_aarch64_gnullvm 0.52.6",
"windows_aarch64_msvc 0.52.6",
"windows_i686_gnu 0.52.6",
- "windows_i686_gnullvm",
+ "windows_i686_gnullvm 0.52.6",
"windows_i686_msvc 0.52.6",
"windows_x86_64_gnu 0.52.6",
"windows_x86_64_gnullvm 0.52.6",
"windows_x86_64_msvc 0.52.6",
]
+[[package]]
+name = "windows-targets"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b"
+dependencies = [
+ "windows_aarch64_gnullvm 0.53.0",
+ "windows_aarch64_msvc 0.53.0",
+ "windows_i686_gnu 0.53.0",
+ "windows_i686_gnullvm 0.53.0",
+ "windows_i686_msvc 0.53.0",
+ "windows_x86_64_gnu 0.53.0",
+ "windows_x86_64_gnullvm 0.53.0",
+ "windows_x86_64_msvc 0.53.0",
+]
+
[[package]]
name = "windows-version"
version = "0.1.1"
@@ -9205,6 +9410,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
+
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
@@ -9223,6 +9434,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
+
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
@@ -9241,12 +9458,24 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+[[package]]
+name = "windows_i686_gnu"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
+
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
+
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
@@ -9265,6 +9494,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+[[package]]
+name = "windows_i686_msvc"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
+
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
@@ -9283,6 +9518,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
+
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
@@ -9301,6 +9542,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
+
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"
@@ -9319,6 +9566,12 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.53.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
+
[[package]]
name = "winnow"
version = "0.5.40"
@@ -9377,9 +9630,9 @@ dependencies = [
"kuchikiki",
"libc",
"ndk 0.9.0",
- "objc2",
- "objc2-app-kit",
- "objc2-foundation",
+ "objc2 0.5.2",
+ "objc2-app-kit 0.2.2",
+ "objc2-foundation 0.2.2",
"objc2-ui-kit",
"objc2-web-kit",
"once_cell",
diff --git a/apps/desktop/src/routes/editor/ConfigSidebar.tsx b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
index c2d3d9d98..44f5c5fb5 100644
--- a/apps/desktop/src/routes/editor/ConfigSidebar.tsx
+++ b/apps/desktop/src/routes/editor/ConfigSidebar.tsx
@@ -2,6 +2,7 @@ import {
RadioGroup as KRadioGroup,
RadioGroup,
} from "@kobalte/core/radio-group";
+import { Collapsible as KCollapsible } from "@kobalte/core/collapsible";
import { Tabs as KTabs } from "@kobalte/core/tabs";
import { cx } from "cva";
import {
@@ -351,7 +352,7 @@ export function ConfigSidebar() {
<div class="bg-gray-100 w-full h-full" />
</KTabs.Indicator>
</KTabs.List>
- <div class="p-[0.75rem] overflow-y-auto text-[0.875rem]">
+ <div class="p-[0.75rem] overflow-y-auto text-[0.875rem] h-full">
<KTabs.Content value="background" class="flex flex-col gap-[1.5rem]">
<Field name="Background" icon={<IconCapImage />}>
<KTabs
@@ -1133,6 +1134,62 @@ export function ConfigSidebar() {
step={1}
/>
</Field>
+ <KCollapsible open={!project.cursor.raw}>
+ <Field
+ name="Smooth Movement"
+ icon={<IconHugeiconsEaseCurveControlPoints />}
+ value={
+ <Toggle
+ checked={!project.cursor.raw}
+ onChange={(value) => {
+ setProject("cursor", "raw", !value);
+ }}
+ />
+ }
+ />
+ <KCollapsible.Content class="overflow-hidden border-b border-gray-200 animate-collapsible-up ui-expanded:animate-collapsible-down transition-opacity ui-expanded:opacity-100 opacity-0">
+ {/* if Content has padding or margin the animation doesn't look as good */}
+ <div class="pt-4 pb-6 flex flex-col gap-4">
+ <Field name="Tension">
+ <Slider
+ value={[project.cursor.tension]}
+ onChange={(v) => setProject("cursor", "tension", v[0])}
+ minValue={1}
+ maxValue={500}
+ step={1}
+ />
+ </Field>
+ <Field name="Friction">
+ <Slider
+ value={[project.cursor.friction]}
+ onChange={(v) => setProject("cursor", "friction", v[0])}
+ minValue={0}
+ maxValue={50}
+ step={0.1}
+ />
+ </Field>
+ <Field name="Mass">
+ <Slider
+ value={[project.cursor.mass]}
+ onChange={(v) => setProject("cursor", "mass", v[0])}
+ minValue={0.1}
+ maxValue={10}
+ step={0.01}
+ />
+ </Field>
+ </div>
+ </KCollapsible.Content>
+ </KCollapsible>
+
+ {/* <Field name="Motion Blur">
+ <Slider
+ value={[project.cursor.motionBlur]}
+ onChange={(v) => setProject("cursor", "motionBlur", v[0])}
+ minValue={0}
+ maxValue={1}
+ step={0.001}
+ />
+ </Field> */}
{/* <Field name="Animation Style" icon={<IconLucideRabbit />}>
<RadioGroup
defaultValue="regular"
diff --git a/apps/desktop/src/routes/editor/ui.tsx b/apps/desktop/src/routes/editor/ui.tsx
index 7ee455a15..10abe87a8 100644
--- a/apps/desktop/src/routes/editor/ui.tsx
+++ b/apps/desktop/src/routes/editor/ui.tsx
@@ -17,7 +17,7 @@ import {
import { useEditorContext } from "./context";
export function Field(
- props: ParentProps<{ name: string; icon?: JSX.Element; value?: string }>
+ props: ParentProps<{ name: string; icon?: JSX.Element; value?: JSX.Element }>
) {
return (
<div class="flex flex-col gap-[0.75rem]">
diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.ts
index f22ade140..fe2a1c72d 100644
--- a/apps/desktop/src/utils/tauri.ts
+++ b/apps/desktop/src/utils/tauri.ts
@@ -241,7 +241,7 @@ export type CommercialLicense = { licenseKey: string; expiryDate: number | null;
export type Crop = { position: XY<number>; size: XY<number> }
export type CurrentRecordingChanged = null
export type CursorAnimationStyle = "regular" | "slow" | "fast"
-export type CursorConfiguration = { hideWhenIdle: boolean; size: number; type: CursorType; animationStyle: CursorAnimationStyle }
+export type CursorConfiguration = { hideWhenIdle: boolean; size: number; type: CursorType; animationStyle: CursorAnimationStyle; tension: number; mass: number; friction: number; raw?: boolean; motionBlur?: number }
export type CursorMeta = { imagePath: string; hotspot: XY<number> }
export type CursorType = "pointer" | "circle"
export type Cursors = { [key in string]: string } | { [key in string]: CursorMeta }
@@ -269,7 +269,7 @@ export type Plan = { upgraded: boolean; manual: boolean; last_checked: number }
export type PreCreatedVideo = { id: string; link: string; config: S3UploadMeta }
export type Preset = { name: string; config: ProjectConfiguration }
export type PresetsStore = { presets: Preset[]; default: number | null }
-export type ProjectConfiguration = { aspectRatio: AspectRatio | null; background: BackgroundConfiguration; camera: Camera; audio: AudioConfiguration; cursor: CursorConfiguration; hotkeys: HotkeysConfiguration; timeline?: TimelineConfiguration | null; motionBlur: number | null }
+export type ProjectConfiguration = { aspectRatio: AspectRatio | null; background: BackgroundConfiguration; camera: Camera; audio: AudioConfiguration; cursor: CursorConfiguration; hotkeys: HotkeysConfiguration; timeline?: TimelineConfiguration | null }
export type ProjectRecordings = { segments: SegmentRecordings[] }
export type RecordingInfo = { captureTarget: ScreenCaptureTarget }
export type RecordingMeta = ({ segment: SingleSegment } | { inner: MultipleSegments }) & { pretty_name: string; sharing?: SharingMeta | null }
diff --git a/apps/discord-bot/src/index.ts b/apps/discord-bot/src/index.ts
index f722617bf..71407c45e 100644
--- a/apps/discord-bot/src/index.ts
+++ b/apps/discord-bot/src/index.ts
@@ -142,6 +142,8 @@ app.post(
),
headers: { 'Content-Type': 'application/json' },
});
+
+ return new Response('Successfully sent message', { status: 200 });
}
default: {
return new Response('Invalid type', { status: 400 });
diff --git a/crates/flags/src/lib.rs b/crates/flags/src/lib.rs
index 327873a65..5c4a47833 100644
--- a/crates/flags/src/lib.rs
+++ b/crates/flags/src/lib.rs
@@ -6,6 +6,6 @@ pub struct Flags {
}
pub const FLAGS: Flags = Flags {
- record_mouse_state: false,
+ record_mouse_state: true,
split: false,
};
diff --git a/crates/project/src/configuration.rs b/crates/project/src/configuration.rs
index d5bb2c403..9c710e4c6 100644
--- a/crates/project/src/configuration.rs
+++ b/crates/project/src/configuration.rs
@@ -307,6 +307,13 @@ pub struct CursorConfiguration {
pub size: u32,
r#type: CursorType,
pub animation_style: CursorAnimationStyle,
+ pub tension: f32,
+ pub mass: f32,
+ pub friction: f32,
+ #[serde(default = "CursorConfiguration::default_raw")]
+ pub raw: bool,
+ #[serde(default)]
+ pub motion_blur: f32,
}
impl Default for CursorConfiguration {
@@ -316,9 +323,19 @@ impl Default for CursorConfiguration {
size: 100,
r#type: CursorType::default(),
animation_style: CursorAnimationStyle::Regular,
+ tension: 100.0,
+ mass: 1.0,
+ friction: 20.0,
+ raw: false,
+ motion_blur: 0.5,
}
}
}
+impl CursorConfiguration {
+ fn default_raw() -> bool {
+ true
+ }
+}
#[derive(Type, Serialize, Deserialize, Clone, Debug, Default)]
#[serde(rename_all = "camelCase")]
@@ -408,7 +425,6 @@ pub struct ProjectConfiguration {
pub hotkeys: HotkeysConfiguration,
#[serde(default)]
pub timeline: Option<TimelineConfiguration>,
- pub motion_blur: Option<f32>,
}
impl ProjectConfiguration {
@@ -445,7 +461,6 @@ impl Default for ProjectConfiguration {
cursor: CursorConfiguration::default(),
hotkeys: HotkeysConfiguration::default(),
timeline: None,
- motion_blur: None,
}
}
}
diff --git a/crates/rendering/Cargo.toml b/crates/rendering/Cargo.toml
index f671df0ed..d922d2c4c 100644
--- a/crates/rendering/Cargo.toml
+++ b/crates/rendering/Cargo.toml
@@ -8,7 +8,6 @@ anyhow.workspace = true
bytemuck = { version = "1.7", features = ["derive"] }
cap-flags = { path = "../flags" }
cap-project = { path = "../project" }
-cap-recording = { path = "../recording" }
ffmpeg-hw-device = { path = "../ffmpeg-hw-device" }
tokio.workspace = true
ffmpeg.workspace = true
diff --git a/crates/rendering/src/decoder/avassetreader.rs b/crates/rendering/src/decoder/avassetreader.rs
index f05887736..0f5b1cb5e 100644
--- a/crates/rendering/src/decoder/avassetreader.rs
+++ b/crates/rendering/src/decoder/avassetreader.rs
@@ -245,7 +245,7 @@ impl AVAssetReaderDecoder {
let cache_min = requested_frame.saturating_sub(FRAME_CACHE_SIZE as u32 / 2);
let cache_max = requested_frame + FRAME_CACHE_SIZE as u32 / 2;
- if requested_frame <= 0
+ if requested_frame == 0
|| last_sent_frame
.as_ref()
.map(|last| {
diff --git a/crates/rendering/src/decoder/ffmpeg.rs b/crates/rendering/src/decoder/ffmpeg.rs
index f96886d54..7ad27aab9 100644
--- a/crates/rendering/src/decoder/ffmpeg.rs
+++ b/crates/rendering/src/decoder/ffmpeg.rs
@@ -173,7 +173,7 @@ impl FfmpegDecoder {
let cache_min = requested_frame.saturating_sub(FRAME_CACHE_SIZE as u32 / 2);
let cache_max = requested_frame + FRAME_CACHE_SIZE as u32 / 2;
- if requested_frame <= 0
+ if requested_frame == 0
|| last_sent_frame
.as_ref()
.map(|last| {
diff --git a/crates/rendering/src/layers/cursor.rs b/crates/rendering/src/layers/cursor.rs
index 1fb28e519..fd181591b 100644
--- a/crates/rendering/src/layers/cursor.rs
+++ b/crates/rendering/src/layers/cursor.rs
@@ -6,19 +6,118 @@ use wgpu::{include_wgsl, util::DeviceExt, FilterMode};
use crate::{
frame_pipeline::{FramePipeline, FramePipelineState},
+ spring_mass_damper::SpringMassDamperSimulation,
zoom::InterpolatedZoom,
- Coord, DecodedSegmentFrames, ProjectUniforms, RawDisplayUVSpace, RenderVideoConstants,
- STANDARD_CURSOR_HEIGHT,
+ Coord, DecodedSegmentFrames, ProjectUniforms, RawDisplayUVSpace, STANDARD_CURSOR_HEIGHT,
};
pub struct CursorLayer {
uniform_buffer: wgpu::Buffer,
texture_sampler: wgpu::Sampler,
+ bind_group_layout: wgpu::BindGroupLayout,
+ render_pipeline: wgpu::RenderPipeline,
}
impl CursorLayer {
pub fn new(device: &wgpu::Device) -> Self {
+ let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
+ label: Some("Cursor Pipeline Layout"),
+ entries: &[
+ wgpu::BindGroupLayoutEntry {
+ binding: 0,
+ visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
+ ty: wgpu::BindingType::Buffer {
+ ty: wgpu::BufferBindingType::Uniform,
+ has_dynamic_offset: false,
+ min_binding_size: Some(std::num::NonZeroU64::new(112).unwrap()),
+ },
+ count: None,
+ },
+ wgpu::BindGroupLayoutEntry {
+ binding: 1,
+ visibility: wgpu::ShaderStages::FRAGMENT,
+ ty: wgpu::BindingType::Texture {
+ sample_type: wgpu::TextureSampleType::Float { filterable: true },
+ view_dimension: wgpu::TextureViewDimension::D2,
+ multisampled: false,
+ },
+ count: None,
+ },
+ wgpu::BindGroupLayoutEntry {
+ binding: 2,
+ visibility: wgpu::ShaderStages::FRAGMENT,
+ ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
+ count: None,
+ },
+ ],
+ });
+
+ let shader = device.create_shader_module(include_wgsl!("../shaders/cursor.wgsl"));
+
+ let empty_constants: HashMap<String, f64> = HashMap::new();
+
+ let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
+ label: Some("Cursor Pipeline"),
+ layout: Some(
+ &device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
+ label: Some("Cursor Pipeline Layout"),
+ bind_group_layouts: &[&bind_group_layout],
+ push_constant_ranges: &[],
+ }),
+ ),
+ vertex: wgpu::VertexState {
+ module: &shader,
+ entry_point: "vs_main",
+ buffers: &[],
+ compilation_options: wgpu::PipelineCompilationOptions {
+ constants: &empty_constants,
+ zero_initialize_workgroup_memory: false,
+ vertex_pulling_transform: false,
+ },
+ },
+ fragment: Some(wgpu::FragmentState {
+ module: &shader,
+ entry_point: "fs_main",
+ targets: &[Some(wgpu::ColorTargetState {
+ format: wgpu::TextureFormat::Rgba8UnormSrgb,
+ blend: Some(wgpu::BlendState {
+ color: wgpu::BlendComponent {
+ src_factor: wgpu::BlendFactor::One,
+ dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
+ operation: wgpu::BlendOperation::Add,
+ },
+ alpha: wgpu::BlendComponent {
+ src_factor: wgpu::BlendFactor::One,
+ dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
+ operation: wgpu::BlendOperation::Add,
+ },
+ }),
+ write_mask: wgpu::ColorWrites::ALL,
+ })],
+ compilation_options: wgpu::PipelineCompilationOptions {
+ constants: &empty_constants,
+ zero_initialize_workgroup_memory: false,
+ vertex_pulling_transform: false,
+ },
+ }),
+ primitive: wgpu::PrimitiveState {
+ topology: wgpu::PrimitiveTopology::TriangleStrip,
+ strip_index_format: None,
+ front_face: wgpu::FrontFace::Ccw,
+ cull_mode: None,
+ unclipped_depth: false,
+ polygon_mode: wgpu::PolygonMode::Fill,
+ conservative: false,
+ },
+ depth_stencil: None,
+ multisample: wgpu::MultisampleState::default(),
+ multiview: None,
+ cache: None,
+ });
+
Self {
+ bind_group_layout,
+ render_pipeline,
uniform_buffer: device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("Cursor Uniform Buffer"),
contents: bytemuck::cast_slice(&[CursorUniforms::default()]),
@@ -49,41 +148,25 @@ impl CursorLayer {
} = &pipeline.state;
let segment_time = segment_frames.segment_time;
- let Some(cursor_position) = interpolate_cursor_position(
+ let Some(interpolated_cursor) = interpolate_cursor(
cursor,
segment_time,
- &uniforms.project.cursor.animation_style,
+ uniforms.project.cursor.tension,
+ uniforms.project.cursor.mass,
+ uniforms.project.cursor.friction,
+ uniforms.project.cursor.raw,
) else {
return;
};
- // Calculate previous position for velocity
- // let prev_position = interpolate_cursor_position(
- // cursor,
- // segment_time - 1.0 / 30.0,
- // &uniforms.project.cursor.animation_style,
- // );
-
- // Calculate velocity in screen space
let velocity: [f32; 2] = [0.0, 0.0];
- // if let Some(prev_pos) = prev_position {
- // let curr_frame_pos =
- // cursor_position.to_frame_space(&constants.options, &uniforms.project, resolution_base);
- // let prev_frame_pos =
- // prev_pos.to_frame_space(&constants.options, &uniforms.project, resolution_base);
- // let frame_velocity = curr_frame_pos.coord - prev_frame_pos.coord;
-
- // // Convert to pixels per frame
- // [frame_velocity.x as f32, frame_velocity.y as f32]
- // } else {
- // [0.0, 0.0]
- // };
-
- // Calculate motion blur amount based on velocity magnitude
- let speed = (velocity[0] * velocity[0] + velocity[1] * velocity[1]).sqrt();
- let motion_blur_amount =
- (speed * 0.3).min(1.0) * uniforms.project.motion_blur.unwrap_or(0.8);
+ // let velocity: [f32; 2] = [
+ // interpolated_cursor.velocity.x * 75.0,
+ // interpolated_cursor.velocity.y * 75.0,
+ // ];
+ let speed = (velocity[0] * velocity[0] + velocity[1] * velocity[1]).sqrt();
+ let motion_blur_amount = (speed * 0.3).min(1.0) * 0.0; // uniforms.project.cursor.motion_blur;
let cursor_event = find_cursor_event(&cursor, segment_time);
let last_click_time = cursor
@@ -112,7 +195,8 @@ impl CursorLayer {
STANDARD_CURSOR_HEIGHT * cursor_size_percentage,
];
- let position = cursor_position
+ let position = interpolated_cursor
+ .position
.to_frame_space(&constants.options, &uniforms.project, resolution_base)
.to_zoomed_frame_space(&constants.options, &uniforms.project, resolution_base, zoom);
let relative_position = [position.x as f32, position.y as f32];
@@ -166,7 +250,7 @@ impl CursorLayer {
let cursor_bind_group = constants
.device
.create_bind_group(&wgpu::BindGroupDescriptor {
- layout: &constants.cursor_pipeline.bind_group_layout,
+ layout: &self.bind_group_layout,
entries: &[
wgpu::BindGroupEntry {
binding: 0,
@@ -190,18 +274,13 @@ impl CursorLayer {
pipeline.encoder.do_render_pass(
pipeline.state.get_current_texture_view(),
- &constants.cursor_pipeline.render_pipeline,
+ &self.render_pipeline,
cursor_bind_group,
wgpu::LoadOp::Load,
);
}
}
-pub struct CursorPipeline {
- bind_group_layout: wgpu::BindGroupLayout,
- render_pipeline: wgpu::RenderPipeline,
-}
-
#[repr(C, align(16))]
#[derive(Debug, Clone, Copy, Pod, Zeroable, Default)]
pub struct CursorUniforms {
@@ -237,115 +316,19 @@ pub fn find_cursor_event(cursor: &CursorEvents, time: f32) -> &CursorMoveEvent {
event
}
-impl CursorPipeline {
- pub fn new(device: &wgpu::Device) -> Self {
- let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
- label: Some("Cursor Pipeline Layout"),
- entries: &[
- wgpu::BindGroupLayoutEntry {
- binding: 0,
- visibility: wgpu::ShaderStages::VERTEX_FRAGMENT,
- ty: wgpu::BindingType::Buffer {
- ty: wgpu::BufferBindingType::Uniform,
- has_dynamic_offset: false,
- min_binding_size: Some(std::num::NonZeroU64::new(112).unwrap()),
- },
- count: None,
- },
- wgpu::BindGroupLayoutEntry {
- binding: 1,
- visibility: wgpu::ShaderStages::FRAGMENT,
- ty: wgpu::BindingType::Texture {
- sample_type: wgpu::TextureSampleType::Float { filterable: true },
- view_dimension: wgpu::TextureViewDimension::D2,
- multisampled: false,
- },
- count: None,
- },
- wgpu::BindGroupLayoutEntry {
- binding: 2,
- visibility: wgpu::ShaderStages::FRAGMENT,
- ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
- count: None,
- },
- ],
- });
-
- let shader = device.create_shader_module(include_wgsl!("../shaders/cursor.wgsl"));
-
- let empty_constants: HashMap<String, f64> = HashMap::new();
-
- let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
- label: Some("Cursor Pipeline"),
- layout: Some(
- &device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
- label: Some("Cursor Pipeline Layout"),
- bind_group_layouts: &[&bind_group_layout],
- push_constant_ranges: &[],
- }),
- ),
- vertex: wgpu::VertexState {
- module: &shader,
- entry_point: "vs_main",
- buffers: &[],
- compilation_options: wgpu::PipelineCompilationOptions {
- constants: &empty_constants,
- zero_initialize_workgroup_memory: false,
- vertex_pulling_transform: false,
- },
- },
- fragment: Some(wgpu::FragmentState {
- module: &shader,
- entry_point: "fs_main",
- targets: &[Some(wgpu::ColorTargetState {
- format: wgpu::TextureFormat::Rgba8UnormSrgb,
- blend: Some(wgpu::BlendState {
- color: wgpu::BlendComponent {
- src_factor: wgpu::BlendFactor::One,
- dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
- operation: wgpu::BlendOperation::Add,
- },
- alpha: wgpu::BlendComponent {
- src_factor: wgpu::BlendFactor::One,
- dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
- operation: wgpu::BlendOperation::Add,
- },
- }),
- write_mask: wgpu::ColorWrites::ALL,
- })],
- compilation_options: wgpu::PipelineCompilationOptions {
- constants: &empty_constants,
- zero_initialize_workgroup_memory: false,
- vertex_pulling_transform: false,
- },
- }),
- primitive: wgpu::PrimitiveState {
- topology: wgpu::PrimitiveTopology::TriangleStrip,
- strip_index_format: None,
- front_face: wgpu::FrontFace::Ccw,
- cull_mode: None,
- unclipped_depth: false,
- polygon_mode: wgpu::PolygonMode::Fill,
- conservative: false,
- },
- depth_stencil: None,
- multisample: wgpu::MultisampleState::default(),
- multiview: None,
- cache: None,
- });
-
- Self {
- bind_group_layout,
- render_pipeline,
- }
- }
+struct InterpolatedCursorPosition {
+ position: Coord<RawDisplayUVSpace>,
+ velocity: XY<f32>,
}
-fn interpolate_cursor_position(
+fn interpolate_cursor(
cursor: &CursorEvents,
time_secs: f32,
- animation_style: &CursorAnimationStyle,
-) -> Option<Coord<RawDisplayUVSpace>> {
+ tension: f32,
+ mass: f32,
+ friction: f32,
+ raw: bool,
+) -> Option<InterpolatedCursorPosition> {
let time_ms = (time_secs * 1000.0) as f64;
if cursor.moves.is_empty() {
@@ -355,33 +338,140 @@ fn interpolate_cursor_position(
if cursor.moves[0].process_time_ms > time_ms.into() {
let event = &cursor.moves[0];
- return Some(Coord::new(XY {
- x: event.x,
- y: event.y,
- }));
+ return Some(InterpolatedCursorPosition {
+ position: Coord::new(XY {
+ x: event.x,
+ y: event.y,
+ }),
+ velocity: XY::new(0.0, 0.0),
+ });
}
if let Some(event) = cursor.moves.last() {
if event.process_time_ms < time_ms.into() {
- return Some(Coord::new(XY {
- x: event.x,
- y: event.y,
- }));
+ return Some(InterpolatedCursorPosition {
+ position: Coord::new(XY {
+ x: event.x,
+ y: event.y,
+ }),
+ velocity: XY::new(0.0, 0.0),
+ });
}
}
- let Some(event) = cursor.moves.windows(2).find_map(|chunk| {
- if time_ms >= chunk[0].process_time_ms && time_ms < chunk[1].process_time_ms {
- Some(&chunk[0])
- } else {
- None
- }
- }) else {
+ if raw {
+ let pos = cursor.moves.windows(2).enumerate().find_map(|(i, chunk)| {
+ if time_ms >= chunk[0].process_time_ms && time_ms < chunk[1].process_time_ms {
+ let c = &chunk[0];
+ Some(XY::new(c.x as f32, c.y as f32))
+ } else {
+ None
+ }
+ })?;
+
+ Some(InterpolatedCursorPosition {
+ position: Coord::new(XY {
+ x: pos.x as f64,
+ y: pos.y as f64,
+ }),
+ velocity: XY::new(0.0, 0.0),
+ })
+ } else {
+ let events = get_smoothed_cursor_events(&cursor.moves, tension, mass, friction);
+ interpolate_smoothed_position(&events, time_secs as f64, tension, mass, friction)
+ }
+}
+
+fn interpolate_smoothed_position(
+ smoothed_events: &[SmoothedCursorEvent],
+ query_time: f64,
+ tension: f32,
+ mass: f32,
+ friction: f32,
+) -> Option<InterpolatedCursorPosition> {
+ if smoothed_events.is_empty() {
return None;
+ }
+
+ let mut sim = SpringMassDamperSimulation::new(tension, mass, friction);
+
+ let query_time_ms = (query_time * 1000.0) as f32;
+
+ match smoothed_events
+ .windows(2)
+ .find(|chunk| chunk[0].time <= query_time_ms && query_time_ms < chunk[1].time)
+ {
+ Some(c) => {
+ sim.set_position(c[0].position);
+ sim.set_velocity(c[0].velocity);
+ sim.set_target_position(c[0].target_position);
+ sim.run(query_time_ms - c[0].time);
+ }
+ None => {
+ let e = smoothed_events.last().unwrap();
+ sim.set_position(e.position);
+ sim.set_velocity(e.velocity);
+ sim.set_target_position(e.target_position);
+ sim.run(query_time_ms - e.time);
+ }
};
- Some(Coord::new(XY {
- x: event.x,
- y: event.y,
- }))
+ Some(InterpolatedCursorPosition {
+ position: Coord::new(sim.position.map(|v| v as f64)),
+ velocity: sim.velocity,
+ })
+}
+
+#[derive(Debug)]
+struct SmoothedCursorEvent {
+ time: f32,
+ target_position: XY<f32>,
+ position: XY<f32>,
+ velocity: XY<f32>,
+}
+
+fn get_smoothed_cursor_events(
+ moves: &[CursorMoveEvent],
+ tension: f32,
+ mass: f32,
+ friction: f32,
+) -> Vec<SmoothedCursorEvent> {
+ let mut last_time = 0.0;
+
+ let mut events = vec![];
+
+ let mut sim = SpringMassDamperSimulation::new(tension, mass, friction);
+
+ sim.set_position(XY::new(moves[0].x, moves[0].y).map(|v| v as f32));
+ sim.set_velocity(XY::new(0.0, 0.0));
+
+ if moves[0].process_time_ms > 0.0 {
+ events.push(SmoothedCursorEvent {
+ time: 0.0,
+ target_position: sim.position,
+ position: sim.position,
+ velocity: sim.velocity,
+ })
+ }
+
+ for (i, m) in moves.iter().enumerate() {
+ let target_position = moves
+ .get(i + 1)
+ .map(|e| XY::new(e.x, e.y).map(|v| v as f32))
+ .unwrap_or(sim.target_position);
+ sim.set_target_position(target_position);
+
+ sim.run(m.process_time_ms as f32 - last_time);
+
+ last_time = m.process_time_ms as f32;
+
+ events.push(SmoothedCursorEvent {
+ time: m.process_time_ms as f32,
+ target_position,
+ position: sim.position,
+ velocity: sim.velocity,
+ });
+ }
+
+ events
}
diff --git a/crates/rendering/src/lib.rs b/crates/rendering/src/lib.rs
index 88964a286..4b1d7a56b 100644
--- a/crates/rendering/src/lib.rs
+++ b/crates/rendering/src/lib.rs
@@ -10,8 +10,8 @@ use frame_pipeline::{FramePipeline, FramePipelineEncoder, FramePipelineState};
use futures::future::OptionFuture;
use futures::FutureExt;
use layers::{
- Background, BackgroundBlurPipeline, BackgroundLayer, CameraLayer, CursorLayer, CursorPipeline,
- DisplayLayer, GradientOrColorPipeline, ImageBackgroundPipeline,
+ Background, BackgroundBlurPipeline, BackgroundLayer, CameraLayer, CursorLayer, DisplayLayer,
+ GradientOrColorPipeline, ImageBackgroundPipeline,
};
use specta::Type;
use std::{collections::HashMap, sync::Arc};
@@ -26,6 +26,7 @@ pub mod decoder;
mod frame_pipeline;
mod layers;
mod project_recordings;
+mod spring_mass_damper;
mod zoom;
pub use coord::*;
@@ -275,7 +276,6 @@ pub struct RenderVideoConstants {
pub options: RenderOptions,
composite_video_frame_pipeline: CompositeVideoFramePipeline,
pub cursor_textures: HashMap<String, CursorTexture>,
- cursor_pipeline: CursorPipeline,
gradient_or_color_pipeline: GradientOrColorPipeline,
image_background_pipeline: ImageBackgroundPipeline,
pub background_blur_pipeline: BackgroundBlurPipeline,
@@ -304,7 +304,6 @@ impl RenderVideoConstants {
.await?;
let cursor_textures = Self::load_cursor_textures(&device, &queue, meta);
- let cursor_pipeline = CursorPipeline::new(&device);
let composite_video_frame_pipeline = CompositeVideoFramePipeline::new(&device);
let gradient_or_color_pipeline = GradientOrColorPipeline::new(&device);
@@ -373,7 +372,6 @@ impl RenderVideoConstants {
composite_video_frame_pipeline,
gradient_or_color_pipeline,
cursor_textures,
- cursor_pipeline,
image_background_pipeline,
background_textures,
screen_frame,
diff --git a/crates/rendering/src/shaders/cursor.wgsl b/crates/rendering/src/shaders/cursor.wgsl
index bdc8b6ee1..cd11ae38c 100644
--- a/crates/rendering/src/shaders/cursor.wgsl
+++ b/crates/rendering/src/shaders/cursor.wgsl
@@ -63,7 +63,7 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
@fragment
fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
// Increase samples for higher quality blur
- let num_samples = 16;
+ let num_samples = 20;
var color_sum = vec4<f32>(0.0);
var weight_sum = 0.0;
@@ -72,35 +72,28 @@ fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
let adaptive_blur = uniforms.motion_blur_amount * smoothstep(0.0, 50.0, velocity_mag);
// Calculate blur direction from velocity
- var blur_dir = vec2<f32>(0.0);
- if (velocity_mag > 0.0) {
- blur_dir = uniforms.velocity / velocity_mag;
- }
+ var blur_dir = uniforms.velocity;
// Enhanced blur trail
let max_blur_offset = 3.0 * adaptive_blur;
for (var i = 0; i < num_samples; i++) {
// Non-linear sampling for better blur distribution
- let t = pow(f32(i) / f32(num_samples - 1), 1.5) * 2.0 - 1.0;
-
- // Gaussian-like weight distribution
- let weight = exp(-3.0 * t * t);
+ let t = i / num_samples;
// Calculate sample offset with velocity-based scaling
- let offset = blur_dir * max_blur_offset * t;
+ let offset = blur_dir * max_blur_offset * (f32(i) / f32(num_samples));
let sample_uv = input.uv + offset / uniforms.output_size.xy;
// Sample with bilinear filtering
let sample = textureSample(t_cursor, s_cursor, sample_uv);
// Accumulate weighted sample
- color_sum += sample * weight;
- weight_sum += weight;
+ color_sum += sample;
}
// Normalize the result
- var final_color = color_sum / weight_sum;
+ var final_color = color_sum / f32(num_samples);
// Enhance contrast slightly for fast movements
if (velocity_mag > 30.0) {
@@ -113,5 +106,5 @@ fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
);
}
- return final_color;
+ return final_color * vec4<f32>(1.0, 1.0, 1.0, 1.0 - uniforms.motion_blur_amount * 0.2);
}
diff --git a/crates/rendering/src/spring_mass_damper.rs b/crates/rendering/src/spring_mass_damper.rs
new file mode 100644
index 000000000..cdc53318e
--- /dev/null
+++ b/crates/rendering/src/spring_mass_damper.rs
@@ -0,0 +1,67 @@
+use cap_project::XY;
+
+pub struct SpringMassDamperSimulation {
+ tension: f32,
+ mass: f32,
+ friction: f32,
+ pub position: XY<f32>,
+ pub velocity: XY<f32>,
+ pub target_position: XY<f32>,
+}
+
+const SIMULATION_TICK: f32 = 1000.0 / 60.0;
+
+impl SpringMassDamperSimulation {
+ pub fn new(tension: f32, mass: f32, friction: f32) -> Self {
+ Self {
+ tension,
+ mass,
+ friction,
+ position: XY::new(0.0, 0.0),
+ velocity: XY::new(0.0, 0.0),
+ target_position: XY::new(0.0, 0.0),
+ }
+ }
+
+ pub fn set_position(&mut self, position: XY<f32>) {
+ self.position = position;
+ }
+ pub fn set_velocity(&mut self, velocity: XY<f32>) {
+ self.velocity = velocity;
+ }
+ pub fn set_target_position(&mut self, target_position: XY<f32>) {
+ self.target_position = target_position;
+ }
+
+ pub fn run(&mut self, dt: f32) -> XY<f32> {
+ if dt == 0.0 {
+ return self.position;
+ }
+
+ let mut t = 0.0;
+
+ loop {
+ let d = self.target_position - self.position;
+ let spring_force = d * self.tension;
+
+ let damping_force = self.velocity * -self.friction;
+
+ let total_force = spring_force + damping_force;
+
+ let accel = total_force / self.mass.max(0.001);
+
+ let tick = (SIMULATION_TICK / 1000.0).min(dt - t);
+
+ self.velocity = self.velocity + accel * tick;
+ self.position = self.position + self.velocity * tick;
+
+ if t >= dt {
+ break;
+ }
+
+ t = (t + SIMULATION_TICK).min(dt);
+ }
+
+ self.position
+ }
+}
diff --git a/package.json b/package.json
index b0f02bd6b..84dc9c139 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"dev": "(pnpm run docker:up > /dev/null &) && sleep 5 && trap 'pnpm run docker:stop' EXIT && dotenv -e .env -- turbo run dev --env-mode=loose --ui tui",
"dev:windows": "start /b cmd /c \"pnpm run docker:up > nul\" && timeout /t 5 /nobreak > nul && dotenv -e .env -- turbo run dev --env-mode=loose --ui tui",
"dev:web": "pnpm dev --filter=!@cap/desktop",
- "dev:desktop": "pnpm turbo run dev --filter=@cap/desktop",
+ "dev:desktop": "pnpm run --filter=@cap/desktop dev",
"dev:manual": "pnpm run docker:up && trap 'pnpm run docker:stop' EXIT && dotenv -e .env -- turbo run dev --filter=!@cap/storybook --no-cache --concurrency 1",
"lint": "turbo run lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
diff --git a/packages/ui-solid/src/auto-imports.d.ts b/packages/ui-solid/src/auto-imports.d.ts
index 3344c71a2..a20744954 100644
--- a/packages/ui-solid/src/auto-imports.d.ts
+++ b/packages/ui-solid/src/auto-imports.d.ts
@@ -48,6 +48,7 @@ declare global {
const IconCapTrash: typeof import('~icons/cap/trash.jsx')['default']
const IconCapUndo: typeof import('~icons/cap/undo.jsx')['default']
const IconCapUpload: typeof import('~icons/cap/upload.jsx')['default']
+ const IconHugeiconsEaseCurveControlPoints: typeof import('~icons/hugeicons/ease-curve-control-points.jsx')['default']
const IconLucideBell: typeof import('~icons/lucide/bell.jsx')['default']
const IconLucideCamera: typeof import('~icons/lucide/camera.jsx')['default']
const IconLucideCheck: typeof import('~icons/lucide/check.jsx')['default']
diff --git a/packages/ui-solid/tailwind.config.js b/packages/ui-solid/tailwind.config.js
index 81e4dd8b2..e36e5bbbe 100644
--- a/packages/ui-solid/tailwind.config.js
+++ b/packages/ui-solid/tailwind.config.js
@@ -55,6 +55,20 @@ module.exports = {
boxShadow: {
s: "var(--shadow-s)",
},
+ keyframes: {
+ "collapsible-down": {
+ from: { height: 0 },
+ to: { height: "var(--kb-collapsible-content-height)" },
+ },
+ "collapsible-up": {
+ from: { height: "var(--kb-collapsible-content-height)" },
+ to: { height: 0 },
+ },
+ },
+ animation: {
+ "collapsible-down": "collapsible-down 0.2s ease-out",
+ "collapsible-up": "collapsible-up 0.2s ease-out",
+ },
},
plugins: [
require("tailwindcss-animate"),