Posts

Showing posts with the label timer

Create Stopwatch App in Android using Sketchware

Image
Timer component and number variables can be used to add a Stopwatch to your Android App created in Sketchware. To create a Stopwatch App in Sketchware follow the steps below. 1. Start a new project in Sketchware . Fill app name, package name and app icon. 2. In VIEW area, insert a Textview and a Button  widget. In Textview properties set layout_gravity as center_horizontal, text as 00:00:00.00, and text_size as 40sp. In Button properties set layout_gravity as center_horizontal, text as Start/Stop/Reset and text_size as 20sp. 3. In LOGIC area add a new timer component t . 4. In onCreate event, add five number variables , one each for hour, minutes, seconds, and milliseconds, and an extra variable for managing Button Click. Set all these number variables to 0. 5. Suppose the five number variables are named as h , m , s , ms , and start . 6. Then in Button​ onClick event use if..then..else control as shown in the image below. This will change va...

How to set an object into pendulum motion in Sketchware?

Image
How to create a pendulum in Sketchware? Here is a video of how I created a pendulum in Sketchware: Firstly​, in View field create a pendulum in a linear horizontal block, either using an imageview or textview. It should be such that the pendulum lies horizontally in right half of the linear horizontal block. Next, create a new timer, and a new function. Add a new variable t and set it's​ value to 0 in onCreate event. Also set rotation of textview to 90°. Now define the new function in such a way that the linear horizontal rotates in pendulum motion repeatedly. Use the codes as shown in the image below. And then save and run the project. It will show your image or text in pendulum motion.