File tree 5 files changed +9980
-43
lines changed
5 files changed +9980
-43
lines changed Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ function readFromCharacteristic(byteOffset) {
192
192
193
193
// Checks if a single byte or all received data is to be returned from the function
194
194
if ( byteOffset == 'all' ) {
195
- // Loops through the received DataView and copies to the data array
195
+ // Loops through the received DataView and copies to the data array
196
196
for ( var i = 0 ; i < 20 ; i ++ ) {
197
197
data [ i ] = value . getUint8 ( i ) ;
198
198
}
Original file line number Diff line number Diff line change 1
-
2
- // Funksjon for at joysticken skal gå tilbake til nullpunktet når den slippes
3
- var REVERT_THRESHOLD = 1000 ;
4
- var $ball = $ ( '.ball.moveable' ) ;
5
- var initialOffset = $ball . offset ( ) ;
6
-
7
-
8
- $ ( '.ball' ) . on ( "change mousemove touchmove" , function ( ) {
9
- var offset = $ball . position ( ) ;
10
- var y = initialOffset . top - offset . top ;
11
- var x = - 1 * ( initialOffset . left - offset . left ) ;
12
- var speed = sqrt ( x ^ 2 + y ^ 2 ) ;
13
-
14
- $ ( '#pos-x' ) . html ( 'x: ' + x + 'px' ) ;
15
- $ ( '#pos-y' ) . html ( 'y: ' + y + 'px' ) ;
16
- $ ( '#speed' ) . html ( 'Hastighet: ' + speed ) ;
17
-
18
- } ) ;
19
-
20
- $ball . pep ( {
21
-
22
- useCSSTranslation : false ,
23
- shouldEase : false ,
24
- constrainTo : 'parent' ,
25
- initiate : function ( ) {
26
- this . $el . removeClass ( 'ease' )
27
- } ,
28
- stop : function ( ) {
29
- var offset = this . $el . position ( ) ;
30
- var diffTop = initialOffset . top - offset . top ;
31
- var diffLeft = - 1 * ( initialOffset . left - offset . left ) ;
32
-
33
- if ( diffTop < REVERT_THRESHOLD && diffLeft < REVERT_THRESHOLD ) {
34
- this . $el . css ( initialOffset ) . addClass ( 'ease' ) ;
35
-
36
-
37
-
38
- }
39
- }
40
- } )
You can’t perform that action at this time.
0 commit comments