Last week I got a strange question about how to make vibrating icons. So this post is to show you how to make icons vibrate so that you can point them in the right direction.
Icons have X and Y locations to make my icon vibrate. In this post I will adjust the X only but of course if you wanted to vibrate your icons by adjusting the Y then that would be fairly similar.
I’m creating an app that has the following controls added to a screen.
Button1 – This control will start my phone ringing when it has been pressed.
So the general idea of this example app is that when i press the ring button the phone icon will start vibrating for a specified amount of time.
In my App Onstart I’m using the following code to set a variable. This makes sure that my phone doesn’t immediately start rining when I run my app.
Set(varRinging, false)
Then the Autostart property of my timer is set to varRinging. This means that my timer will start running when the button is pressed. Potentially you could do this by getting the user to press the timer button directly, but personally I like to separate my timer code from my button code.
The ring button, now just needs to lines of code.
Set(varRinging,!varRinging);
Set(varTimesToRing,0);
The first line will enable the timer and therefor the phone ringing. The second line controls how long my phone rings for.
The X property of my icon is set to a variable XIcon
Now the final part of the vibrating icon code sits within the timer.
If( XIcon = 202, Set(XIcon,200), Set(XIcon,202));
Set(varTimesToRing, varTimesToRing+1)
The first part of the code will switch the value of the icon location between 200 and 202. This will give the vibrating effect for the icon. The second line counts the vibrations so that the phone stops ringing after a while.
Then one final step is to set the duration of the timer to 100. If you want the icon to vibrate faster/slower or longer/shorter just adjust the numbers used in this post.
Continue Reading Pieter Veenstra’s Article on their blog
Create vibrating icons in Power Apps
Last week I got a strange question about how to make vibrating icons. So this post is to show you how to make icons vibrate so that you can point them in the
Blog Syndicated with Pieter Veenstra’s Permission