replace compass sprite

This commit is contained in:
rgarcia-herrera 2020-08-11 13:12:10 -05:00
parent 32757dfd9e
commit 00c321562e
4 changed files with 2712 additions and 7 deletions

2707
compass.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 101 KiB

View File

@ -62,11 +62,9 @@
FloatLayout:
canvas:
Color:
rgb: .08, .08, .08
rgb: .9, .9, .9
Rectangle:
size: self.size
Image:
source: 'rose.png'
Image:
source: 'needle.png'
canvas.before:

View File

@ -79,7 +79,7 @@ class FlockompassApp(App):
self.fbearing = atan2(sin(lon2 - lon1) * cos(lat2),
cos(lat1) * sin(lat2)
- sin(lat1) * cos(lat2) * cos(lon2-lon1))
self.fbearing = self.needle_angle - degrees(self.fbearing)
self.fbearing = self.needle_angle - degrees(self.fbearing) + 90
self.fbearing = (self.fbearing + 360) % 360
def center_map_on_gps(self):
@ -100,7 +100,7 @@ class FlockompassApp(App):
angle = atan2(y, x)
self.last_angle = smoothingFactor * self.last_angle + (1 - smoothingFactor) * angle
needle_angle = degrees(self.last_angle)
needle_angle = degrees(self.last_angle) - 90
# fix animation transition around the unit circle
if (self.needle_angle % 360) - needle_angle > 180:
@ -114,13 +114,13 @@ class FlockompassApp(App):
if self.cs._anim:
self.cs._anim.stop(self)
self.cs._anim = Animation(needle_angle=needle_angle,
d=0.1,
d=0.2,
t='out_quad')
self.cs._anim.start(self)
def compass_enable(self):
self.cs.facade.enable()
Clock.schedule_interval(self.get_field, 1 / 10.0)
Clock.schedule_interval(self.get_field, 1 / 33.3)
def compass_disable(self):
self.cs.facade.disable()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 566 KiB