Share My Creation [B4X] SlapToggle - A "Jelly-Style" Custom View

Animation.gif

I’ve been experimenting with the 12 Principles of Animation to create a toggle that feels more "alive." Unlike standard switches, this one uses a dual-spring physics system to achieve a "slap" effect with Squash and Stretch.

Elastic Physics: The toggle stretches based on its velocity and compresses when it hits the targets.

Anticipation: Features a subtle "kick-back" movement before launching, giving it a sense of weight.

Zero-Clipping: I've implemented a generous internal padding to ensure the ball never gets cut off by the canvas edges during high-speed bounces.

Easy Integration: Simple ValueChanged event to trigger your logic in the Main module.
 

Attachments

  • example.zip
    4.1 KB · Views: 2
Top