A production-grade coin toss application featuring sensor-fusion parallax, procedural graphics, and a hidden algorithmic engine.
FairFlip is a study in deceptive UI design. On the surface, it is a polished, beautiful coin toss application compliant with Material 3 standards. Under the hood, it utilizes the device's accelerometer and haptic engine to allow the owner to rig the outcome of the flip without touching the screen.
Built entirely in Jetpack Compose with a Clean MVVM Architecture, it demonstrates how raw sensor data can be transformed into fluid, interactive animations.
- Hyper-Reactive Parallax: The coin and the background star field move independently based on device tilt.
- Procedural Star Field: A custom Canvas component generates 120 unique stars with randomized alpha and scale, optimized to render without recomposition overhead.
- Edge-to-Edge Design: Fully immersive UI that draws behind system bars with a custom radial gradient spotlight.
- True 3D Rotation: No image swapping—the coin is a 3D object that physically rotates 180° to reveal the result.
- Magician Mode: A hidden long-press gesture on the app title toggles "Stealth Mode."
- Gyroscopic Rigging:
- Tilt Left (>5°): Result forced to Heads.
- Tilt Right (<-5°): Result forced to Tails.
- Hold Flat: Result uses
Random.nextBoolean()(True Fair Mode).
- Tactile Confirmation:
- Heads: Single sharp tick (100ms @ Max Amplitude).
- Tails: Heavy double rumble (Waveform pattern).
- Note: The user feels the result before the coin flips, allowing for a convincing performance.
FairFlip uses a custom low-pass filter to manage sensor noise, ensuring animations are responsive but smooth.
-
Raw sensor data is noisy. We apply a weighted smoothing function to create a snappy, responsive feel (
0.4falpha):// CoinViewModel.kt // Alpha 0.4f provides high responsiveness while filtering micro-tremors smoothedX += (targetX - smoothedX) * 0.4f
- To create a "Deep Space" illusion, the foreground and background layers move in opposition:
Layer Multiplier Direction Effect Foreground (Coin) 2.0fWith Gravity Slides physically towards the tilt. Background (Stars) 2.0fAgainst Gravity Moves equally fast in reverse, simulating extreme depth.
-
Language: Kotlin
-
UI Toolkit: Jetpack Compose (Material 3)
-
Architecture: MVVM (Model-View-ViewModel)
-
Asynchronous: Kotlin Coroutines & StateFlow
-
Sensors: SensorManager (Accelerometer)
-
Haptics: VibratorManager with fallback support for older SDKs.
The app follows a strict Clean Architecture approach to separate the physics engine from the rendering layer.
graph TD
A[SensorManager] -->|Raw Accelerometer Data| B(CoinViewModel)
B -->|Low-Pass Smoothing Algorithm| C{StateFlow}
C -->|Parallax Coordinates| D[UI Layer]
D -->|Offset X/Y| E[GameCoin Component]
D -->|Inverse Offset| F[StarField Background]
Download the App:
- Click below to download the latest stable version (v1.0.0) for your Android device:
- 👉 Download FairFlip-v1.0.0.apk
OR
-
Clone the repository:
git clone https://github.com/SilentFURY-x/FairFlip-Cheating-Coin-Toss-App.git
-
Open in Android Studio:
- Ensure you are using the latest version (Ladybug or newer).
-
Permissions:
- The app requires android.permission.VIBRATE (automatically handled in Manifest).
-
Build & Run:
- Run on a physical device (Emulators do not support accelerometer tilting correctly).
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
-
Fork the Project
-
Create your Feature Branch:
git checkout -b feature/AmazingFeature
-
Commit your Changes:
git commit -m 'Add some AmazingFeature' -
Push to the Branch:
git push origin feature/AmazingFeature
-
Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Built with ❤️, Logic, and Deception by Arjun Tyagi


