2014년 11월 28일 금요일

Speed of the finger on screen


I'd like to do an app which lets the phone vibrating, if you move your finger on the screen. As faster you're moving your finger, the vibrations should be more.
Can someone help me doing this?

--
Try using the Canvas component and use the flung event that will detect how faster your finger is swiped on the screen.

-- 

So, I've done this before I wrote here, but I haven't seen any reaction. Why?
I've pinned a Screenshot...

And I've replaced "close Screen" by "Close Application" and I don't see something...
--
Possibly because you are on Screen1, and you can not ever close screen1, all you can do is close application.

Also, if you want to vibrate, you need to have a Player or Sound component and then tell the app to turn on the vibrate for as many ms as you want.

You might benefit from reading the chapter in the AI2 free online eBook   http://appinventor.mit.edu/explore/ai2/tutorials.html   ... the links are at the bottom of the Web page.  Read it all but especially chapters 18 and 17.   You need to learn to program simple things before you try advanced stuff.

You said you are new.    Have you done the tutorials here MITs tutorials    http://appinventor.mit.edu/explore/ai2/tutorials.html  ?  The tutorials are your friend.  The forum members are willing to help, but you have to help yourself too, so do some reading, do some tutorials and have fun.

When you have tried more blocks return and ask a specific question after you have fixed your blocks.

--
I've written, that I've changed closascreen to closeapplication.

Now my phone does vibrations, if I touch it and move my finger. But it only does once. Can't I let it vibrating all the time, i'm moving my finger....

I'm sorry but I only need this app once. I don't want to do more apps. This app should be finished next week...
And I can't find chapter 18 and 19. But I try to read this, if I have time...


Exactly.  When you call the vibration it vibrates once, for as long as you tell it with code.   To keep it vibrating, you probably have to use a Clock and possibly an If else if    statement logic to keep it going.

Smile.  Your app is starting to do almost what you want.

--
Andreas... since it appears to be homework you're doing, I suggest you start reading pronto!

--
I've read the two chapters and tried to use a Timer. I also read everything what I found about the Clock in the E-Book.

But I don't know how to do...

This step, but only this step would be easier if I could use C#...

I tried a bit but I should move a block what isn't possible... How can I do this? (Screenshot)



--
I do not know either but here is what I would try

I believe the Vibrate (and the timer.false both need to go into the Timer block.   Move it out of Flung.
Also change the   false that is already in the Clock to true.   The other thing you need to do is either 
set Clock.Timer to False in the Screen.Initialize block (or do that from the Designer screen in the Properties by setting it to false there).

Does that help?

--

댓글 없음:

댓글 쓰기