Skip to content

Commit dac3d31

Browse files
authored
Merge pull request #78 from MichaelBell/track-finger
Launcher: Track finger more nicely.
2 parents 5de5acd + 79aeb61 commit dac3d31

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

examples/main.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ def launch(self):
283283
if touch.state and touch_start_time is None:
284284
touch_start_time = time.ticks_ms()
285285
touch_start_x = touch.x
286+
last_touch_x = touch.x
286287
tap = True
287288

288289
elif touch.state:
@@ -301,12 +302,12 @@ def launch(self):
301302

302303
# If a touch is under this minimal distance it counts as a "stop spinning, darn it"
303304
if abs(touch_dist) > 10:
304-
# Apply the touch speed with the direction multiplier from above
305-
move -= math.radians(touch_speed)
306-
if abs(touch_speed) > 0.5:
307-
friction = 0.98 # Normal friction ( the closer this is to 1 the longer it will take to slow down )
308-
else:
309-
friction = 0.8
305+
# Follow finger as it moves
306+
move = -math.radians(last_touch_x - touch.x) * 0.12
307+
last_touch_x = touch.x
308+
309+
# Normal friction after touch ends ( the closer this is to 1 the longer it will take to slow down )
310+
friction = 0.8
310311

311312
else:
312313
# Pick the one you like best

0 commit comments

Comments
 (0)