Skip to content

Commit

Permalink
Make scroll physics core objects
Browse files Browse the repository at this point in the history
Set up scroll physics as core objects with 2 options (Clamped and Elastic - open to better names). In addition, we expose 3 knobs for the Elastic physics:
1. Friction - the strength of the deceleration of the scroll after release
2. Speed multiplier - determines the initial speed at release
3. Elastic factor - determines the strength of the rubber banding

Maybe we want to normalize them to values between 0-100 or 0-1?

<img width="247" alt="Screenshot 2024-12-03 at 3 06 37 AM" src="https://github.com/user-attachments/assets/ce5a4bac-f714-4482-841f-1f78b8422d7a">
<img width="243" alt="Screenshot 2024-12-03 at 10 12 01 AM" src="https://github.com/user-attachments/assets/1dd71c52-86a0-48b2-aa2c-a37cac55b314">

Diffs=
0ff13be381 Make scroll physics core objects (#8672)
  • Loading branch information
philter committed Dec 4, 2024
1 parent 26d5c48 commit 2c1d8a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9dfd01fb3a8853f666ffc0c02ed6869668a35432
0ff13be38182a9b2c8d908135bc679fbf8c08b07
2 changes: 1 addition & 1 deletion submodules/rive-runtime
Submodule rive-runtime updated 36 files
+1 −1 .rive_head
+0 −19 dev/defs/constraints/scroll_constraint.json
+8 −0 dev/defs/constraints/scrolling/clamped_scroll_physics.json
+40 −0 dev/defs/constraints/scrolling/elastic_scroll_physics.json
+0 −0 dev/defs/constraints/scrolling/scroll_bar_constraint.json
+39 −0 dev/defs/constraints/scrolling/scroll_constraint.json
+22 −0 dev/defs/constraints/scrolling/scroll_physics.json
+0 −91 include/rive/constraints/scroll_physics.hpp
+21 −0 include/rive/constraints/scrolling/clamped_scroll_physics.hpp
+65 −0 include/rive/constraints/scrolling/elastic_scroll_physics.hpp
+2 −2 include/rive/constraints/scrolling/scroll_bar_constraint.hpp
+0 −0 include/rive/constraints/scrolling/scroll_bar_constraint_proxy.hpp
+29 −27 include/rive/constraints/scrolling/scroll_constraint.hpp
+0 −0 include/rive/constraints/scrolling/scroll_constraint_proxy.hpp
+61 −0 include/rive/constraints/scrolling/scroll_physics.hpp
+37 −0 include/rive/generated/constraints/scrolling/clamped_scroll_physics_base.hpp
+108 −0 include/rive/generated/constraints/scrolling/elastic_scroll_physics_base.hpp
+0 −0 include/rive/generated/constraints/scrolling/scroll_bar_constraint_base.hpp
+37 −0 include/rive/generated/constraints/scrolling/scroll_constraint_base.hpp
+70 −0 include/rive/generated/constraints/scrolling/scroll_physics_base.hpp
+62 −6 include/rive/generated/core_registry.hpp
+4 −0 include/rive/importers/backboard_importer.hpp
+1 −1 src/advancing_component.cpp
+0 −112 src/constraints/scroll_physics.cpp
+24 −0 src/constraints/scrolling/clamped_scroll_physics.cpp
+184 −0 src/constraints/scrolling/elastic_scroll_physics.cpp
+3 −4 src/constraints/scrolling/scroll_bar_constraint.cpp
+2 −2 src/constraints/scrolling/scroll_bar_constraint_proxy.cpp
+55 −47 src/constraints/scrolling/scroll_constraint.cpp
+3 −3 src/constraints/scrolling/scroll_constraint_proxy.cpp
+35 −0 src/constraints/scrolling/scroll_physics.cpp
+11 −0 src/generated/constraints/scrolling/clamped_scroll_physics_base.cpp
+11 −0 src/generated/constraints/scrolling/elastic_scroll_physics_base.cpp
+2 −2 src/generated/constraints/scrolling/scroll_bar_constraint_base.cpp
+2 −2 src/generated/constraints/scrolling/scroll_constraint_base.cpp
+6 −0 src/importers/backboard_importer.cpp

0 comments on commit 2c1d8a1

Please sign in to comment.