Small improvements
This commit is contained in:
parent
1e3af85c40
commit
1c35f8d92c
@ -15,7 +15,7 @@ def __drawing_area_expose_cb(widget, event, stage):
|
||||
stage.render(widget.window)
|
||||
|
||||
def __next_frame_cb(timeline, frame_num, group):
|
||||
angle = math.pi * 2 / timeline.get_n_frames() * frame_num
|
||||
angle = math.pi * 2 * frame_num / timeline.get_n_frames()
|
||||
group.get_layout().set_angle(angle)
|
||||
group.do_layout()
|
||||
|
||||
@ -55,7 +55,7 @@ drawing_area.show()
|
||||
|
||||
window.show()
|
||||
|
||||
timeline = Timeline(stage, 100)
|
||||
timeline = Timeline(stage, 300)
|
||||
timeline.connect('next-frame', __next_frame_cb, icons_group)
|
||||
timeline.connect('completed', __completed_cb, icons_group)
|
||||
timeline.start()
|
||||
|
@ -3,10 +3,10 @@ import math
|
||||
from sugar.scene.LayoutManager import LayoutManager
|
||||
|
||||
class CircleLayout(LayoutManager):
|
||||
def __init__(self, radium):
|
||||
def __init__(self, radius):
|
||||
LayoutManager.__init__(self)
|
||||
|
||||
self._radium = radium
|
||||
self._radius = radius
|
||||
self._angle = 0
|
||||
|
||||
def set_angle(self, angle):
|
||||
@ -20,6 +20,6 @@ class CircleLayout(LayoutManager):
|
||||
angle += step
|
||||
|
||||
def _update_position(self, actor, angle):
|
||||
x = math.cos(angle) * self._radium + self._radium
|
||||
y = math.sin(angle) * self._radium + self._radium
|
||||
actor.set_position(int(x), int(y))
|
||||
x = math.cos(angle) * self._radius + self._radius
|
||||
y = math.sin(angle) * self._radius + self._radius
|
||||
actor.set_position(int(x + 0.5), int(y + 0.5))
|
||||
|
Loading…
Reference in New Issue
Block a user