replace compass sprite
This commit is contained in:
parent
32757dfd9e
commit
00c321562e
2707
compass.svg
Normal file
2707
compass.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 101 KiB |
@ -62,11 +62,9 @@
|
|||||||
FloatLayout:
|
FloatLayout:
|
||||||
canvas:
|
canvas:
|
||||||
Color:
|
Color:
|
||||||
rgb: .08, .08, .08
|
rgb: .9, .9, .9
|
||||||
Rectangle:
|
Rectangle:
|
||||||
size: self.size
|
size: self.size
|
||||||
Image:
|
|
||||||
source: 'rose.png'
|
|
||||||
Image:
|
Image:
|
||||||
source: 'needle.png'
|
source: 'needle.png'
|
||||||
canvas.before:
|
canvas.before:
|
||||||
|
|||||||
8
main.py
8
main.py
@ -79,7 +79,7 @@ class FlockompassApp(App):
|
|||||||
self.fbearing = atan2(sin(lon2 - lon1) * cos(lat2),
|
self.fbearing = atan2(sin(lon2 - lon1) * cos(lat2),
|
||||||
cos(lat1) * sin(lat2)
|
cos(lat1) * sin(lat2)
|
||||||
- sin(lat1) * cos(lat2) * cos(lon2-lon1))
|
- 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
|
self.fbearing = (self.fbearing + 360) % 360
|
||||||
|
|
||||||
def center_map_on_gps(self):
|
def center_map_on_gps(self):
|
||||||
@ -100,7 +100,7 @@ class FlockompassApp(App):
|
|||||||
angle = atan2(y, x)
|
angle = atan2(y, x)
|
||||||
self.last_angle = smoothingFactor * self.last_angle + (1 - smoothingFactor) * angle
|
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
|
# fix animation transition around the unit circle
|
||||||
if (self.needle_angle % 360) - needle_angle > 180:
|
if (self.needle_angle % 360) - needle_angle > 180:
|
||||||
@ -114,13 +114,13 @@ class FlockompassApp(App):
|
|||||||
if self.cs._anim:
|
if self.cs._anim:
|
||||||
self.cs._anim.stop(self)
|
self.cs._anim.stop(self)
|
||||||
self.cs._anim = Animation(needle_angle=needle_angle,
|
self.cs._anim = Animation(needle_angle=needle_angle,
|
||||||
d=0.1,
|
d=0.2,
|
||||||
t='out_quad')
|
t='out_quad')
|
||||||
self.cs._anim.start(self)
|
self.cs._anim.start(self)
|
||||||
|
|
||||||
def compass_enable(self):
|
def compass_enable(self):
|
||||||
self.cs.facade.enable()
|
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):
|
def compass_disable(self):
|
||||||
self.cs.facade.disable()
|
self.cs.facade.disable()
|
||||||
|
|||||||
BIN
needle.png
BIN
needle.png
Binary file not shown.
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 566 KiB |
Loading…
Reference in New Issue
Block a user