Simple timer app inspired by Newton's Cradle. Created in Jetpack Compose for #AndroidDevChallenge.

Related tags

App NewtonsTimer
Overview

Newton's Timer

Workflow result

📜 Description

Simple timer app inspired by Newton's Cradle. Created in Jetpack Compose for #AndroidDevChallenge.

💡 Motivation and Context

The goal was to create something simple yet playful to demonstrate (and evaluate) capabilities of Jetpack Compose.
The result is a (up to) 1 minute timer trying to recreate Newton's Cradle.

Some highlights and links to code:

  • Drawing first ball trajectory and hint animation to setup the timer:
    • Usage of drawArc with dashPathEffect and animated clipPath - code
  • Playful way of setting up timer by dragging first ball. Timer starts as soon as you lift your finger up:
    • Usage of pointerInput and detectDragGestures - code
  • Smooth transitioning between states:
    • Configuration mode and started mode - code
  • Swinging animation is controlling animation from ViewModel and can be paused/resumed:
    • TargetBasedAnimation + update loop in a Coroutine - code
  • Trying to recreate gravitational swing with hit rebound and colliding balls:
    • Custom Easing and many parameters - code
  • Shadows are blurred and scaled down if ball is swinging higher from the ground:
    • Brush.radialGradient and transformations using graphicsLayer - code
  • Playing hit sounds when balls collide, synchronized with animation.
  • Swinging amplitude and hit sound volume decrease with time, reaching 0 at the end of the timer.
  • Timer's display is styled with two font sizes and colors. Also font size adjusts to the available space:
    • Using AnnotatedString.Builder - code
  • Animated change between dark and light mode.
  • Support for both portrait and landscape orientations.

📸 Screenshots

License

Copyright 2020 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
A general purpose kotlin library that use kotlin coroutines, flows and channels to provide timer features with the most easy and efficient way

Timer Timer is a general purpose kotlin library that use kotlin coroutines, flows and channels to provide timer features with the most easy and effici

A minimalist but powerful productivity timer designed to keep you focused and free of distractions.
A minimalist but powerful productivity timer designed to keep you focused and free of distractions.

Goodtime A minimalist but powerful productivity timer designed to keep you focused and free of distractions. Alternate between focused work sessions a

KVMapper: A Key-Value Mapper app for MacOS, created with Kotlin and Compose Desktop
KVMapper: A Key-Value Mapper app for MacOS, created with Kotlin and Compose Desktop

KVMapper is an application to convert key-value pairs from one format to another. About This app was purely written in Kotlin and compiled fo

Movie application created with TMDB API, Architecture Components, Android Jetpack libraries

MovieApp Movie application created with TMDB API, Architecture Components, Android Jetpack libraries Built With 🛠️ • Kotlin - The language used in th

Android-stories: A simple stories library inspired by Instagram and alike
Android-stories: A simple stories library inspired by Instagram and alike

A simple stories library inspired by Instagram and alike. Requirements Min SDK = 22 Installation Add these dependencies to your proje

Implementation of useful hooks inspired by React for Compose
Implementation of useful hooks inspired by React for Compose

useCompose React inspired hooks for Compose Installation Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the

An app created for Code Lousiville in order to learn the in-and-outs of basic Android development

Tea House is an app created for Code Lousiville in order to learn the in-and-outs of basic Android development.

Smart-flight - This app was created to learn and practice Kotlin language
Smart-flight - This app was created to learn and practice Kotlin language

Smart Flight This app was created to learn and practice Kotlin language. Works o

This project is an android app inspired by the tv show
This project is an android app inspired by the tv show "Friends"

F.R.I.E.N.D.S-App If this frame looks familiar then this app is for you! This project is an android app inspired by the tv show "Friends" , built usin

Comments
  • Add screenshot tests with Shot

    Add screenshot tests with Shot

    Great project @MaciejCiemiega 😃 congrats!!

    I've seen your challenge's implementation on Twitter and I've thought it could be great if you could automatically test your animations. I've prepared this branch where Shot is configured and a bunch of seams are added to your code in order to make it a little bit more testable. The result is what you can see in this PR. A lot of tests ensuring your challenge works as expected using pixel-perfect precision 📸 If for some reason after a code modification your app doesn't show the expected UI you'll get a test failure and a nice report like this:

    Screenshot 2021-03-12 at 15 11 47

    The diff column will show you the different pixels between the original screenshot recorded and the new one taken where the bug should be 😃

    I've also configured CI to run these tests whenever a PR is requested or some code is pushed so external contributions are also checked by these tests I wrote.

    P.S: Feel free to close this PR if you don't want to add coverage to the project.

    opened by pedrovgs 1
Owner
Maciej Ciemięga
Maciej Ciemięga
Countdown timer app built in Jetpack Compose

TikTik: A beautiful countdown timer ?? Description TikTik is a beautiful countdown-timer app built in Jetpack Compose, which is submmited to Android D

fundroid 40 Dec 10, 2022
E- commerce app👕 built with Jetpack Compose and Compose Destinations. The design was inspired by Sajjad Mohammadi Nia

E-Commerce Clothing App ?? This a Jetpack Compose app that replicates of an E-commerce app design I was inspired by on Dribble. It's an E-Commerce app

Breens Robert 19 Nov 23, 2022
Build a simple timer application with kotlin

3. Build a simple timer application which provides below features: a. A simple U

Nghe Pham 1 Dec 26, 2021
A simple and easy to use stopwatch and timer library for android

TimeIt Now with Timer support! A simple and easy to use stopwatch and timer library for android Introduction A stopwatch can be a very important widge

Yashovardhan Dhanania 35 Dec 10, 2022
⏲ A highly customizable interval timer app for Android

TimeR Machine A highly customizable interval timer app for Android Structure The app uses the Navigation component. Modules whose names start with app

null 51 Dec 7, 2022
Timer app for android

Android Countdown Timer This is a simple, no-frills but efficient timer app for android created based on my personal need. You can create multiple seq

Kaustav Banerjee 0 Dec 25, 2021
EggTimer: a timer app for cooking eggs

EggTimer EggTimer is a timer app for cooking eggs. You can start and stop the ti

Ernesto 0 Dec 22, 2021
Task Timer - An android app that helps you to keep a track of how much time you spend on each task

Task Timer - An android app that helps you to keep a track of how much time you spend on each task

Hassan Al-Shammari 1 Feb 24, 2022
Pomodroid is a flexible and easy to use Android Pomodoro Technique Timer.

Pomodroid - Android App Pomodroid is a flexible and easy to use Android Pomodoro Technique Timer. Unlike other services, pomodroid is free and open so

Klejvi Kapaj 8 Oct 15, 2022
A material tea-timer for android

What is this This project emerged as a tea-timer is something I nearly use every day and the app I was using so far was not ideal to me. I used the on

ligi 34 Aug 30, 2022