Unity making a timer - android

So im making a android app in Unity an im trying to make a specific timer so the timer starts as soon as you go the the scene and also I want the numbers to scroll down then stop for a second then scroll again it would look something like this
5
6
00:14:57
8
9
and it would scroll down to the next number ten stop then the next number then stop
how to make a timer in unity with this behavior and look ?

There are plenity of ways to make a timer, I'm going to assume that that's not the trouble, what you are asking for is an animation that looks nice and works with the data of your timer.
You can have a FSM in the animator to make an animation between three text components so each second them will scroll up, once the upper text is outside the view, ui mask, you put them at the end and then change his text value to the next second and so on in a loop.
Another way to do this is the same I just wrote but using scripting and coroutines instead of the animator, I prefer this approaching since I have full control of what are appearing to the user and what are occurring behind in the code.

Related

How to add animation or cardview upon opening app

How do I add some simple sliding down animation to card view every time the fragment is opened/accessed? I only get to see animations when interacted but not those automatic animations...
do I only need to like copy paste codes of those scripts that trigger animation when a certain interaction is executed to my fragments?(sorry for the English... this might also be the answer on my question but I still want to listen to those who know how..)

How to implement a snapchat like circular animated countdown timer component in React Native?

I was wondering if anyone knows how to implement a circular countdown timer in React Native shown on the attached image. Would be ideal if it was for both ios and android. Thanks!
I can at least point you in the direction of implementing one yourself.
There does indeed exist a 'react-countdown-timer' component, however it might be worth implementing yourself or altering their code in order to make the timer appear like above. To do so, I would use a combination of timer-mixins in addition to a circular view with text inside. Next, I would keep track of the state of the timer using the timer-mixins in addition to the setState function. For each interval, I would update the time remaining of the timer and then update the button component that you have created to reflect whatever time is left.
As per your requirement I would like to suggest you
Use https://www.npmjs.com/package/react-native-av-countdown-circle this component

Newbie in Android development. Implement several different processes in an activity

I'm begining to learn android development, and I'm trying to make an app just to learn the language and philosophy.
This app, has to show an image in the middle of the screen, a button below, and a chronometer in the right side. When the app starts, the chronometer has to begin a countdown. When the user press the button, a blur effect has to be applied to the image, and the seconds left to finish the countdown increase by 10.
I almost know how to program the blur efect to the image, the button press, and the countdown and increase by 10 whenever the button is pressed. But I'm not sure about putting all together.
As far as I know, it should be done by designing an activity, and putting inside the activity the image, the button, and another image or a set of changing images or text for the countdown clock. But as I advance in my studied, today I have read that in order to manage different actions in an activity it is neccesary to do it by using fragments. And I have found much complex programming fragments than activities.
So the question is: can I make what I'm trying to do by a simple activity and defining classes and methods for the image effect and the countdown clock or have I to make it with fragments?
Thank you very much.
today I have read that in order to manage different actions in an activity it is neccesary to do it by using fragments
To be blunt, either you either misunderstood what you read, or you are reading the wrong material.
can I make what I'm trying to do by a simple activity and defining classes and methods for the image effect and the countdown clock
Yes.
have I to make it with fragments?
No. It is possible that the whole UI might be a fragment, particularly if it might be shown alongside something else in some cases (e.g., a tablet) and not in others (e.g., a phone). And there is nothing stopping you from making that UI using several fragments, though that would be rather unusual.
As others have already conveyed, no need to go with fragments.. Activity wud suffice.. As far as putting it together is considered, I guess you need to learn more about layouts.. Layouts are the files which basically help you put things on UI as you want it to look like.. There are plenty of material available online for understanding layouts.. Happy learning.. :)

Switching back and forth between 2 layouts

I'm trying to make an application thats has blinking effect,
e.g. switching back and forth between 2 layouts, one is red and the other is blue for example.
(any layout has diffrent image in it)
When trying to switch fast between 2 activities or 2 fragments the application is crashing.
How can I programmatically change activity layout in a better way?
My personal reservations against blinking aside, you could change just the background color of your root layout with a timer.
You should just change the background color or the layout that is being displayed by the Activity.
Think about efficiency:
If you change layouts android will have to inflate the XML and its widgets and you will have to get handles to all these by querying and layout (ie findViewById). You can think of the first problem of this as refreshing a web page to change the color of an element instead of just rendering dynamically. You can think of the second part of this as not caching DOM handles and having to requery-ing the DOM every time you want to provide and action in JavaScript. Both are bad practice.
Or, you could just change the background of the current layout every X seconds, minutes or whatever you are trying to do. There are many ways to do this - the AlarmManager, or start a Thread with a timeout - or better yea, start a new Thread that will post a runnable back to the main thread to change the background color - then sleep the auxiliary thread for X seconds and repeat the loop.
The second idea is not only good practice - but you are using the SDK framework correctly.
Good Luck!

Custom Splash Screen - Android

Currently my android application shows a black screen with a loading wheel as it processes the user's request i:e as it gets content from the server. I would like to modify this screen to include an icon (image) that fades in and out continuously instead of the loading wheel. Is there any possible way to do it?
Yes, you'll use an Alpha Animation
See here
and here
and lastly here for a good tutorial on Animations with some nice code.
In order to "chain" your animations so that one starts after the other you'll use an Animation listener and start the other one from the onAnimationEnd method callback. Don't forget to put an if statement in there that checks to see if your stuff is done loading otherwise you'll end up with infinite recursion of your fade in and fade out.

Categories

Resources