After a Group.pop, assignments to the popped object's angle and scale don't have any effect.
This code should draw a big star that should rotate continuously, but instead draws a small static star:
from wasabi2d import Scene, run, animate, clock, Group
scene = Scene()
star = scene.layers[0].add_star(
points=5,
inner_radius=5,
outer_radius=50,
pos=(scene.width / 2, scene.height / 2),
color='green',
)
async def rotate():
while True:
star.angle += 0.1
await clock.coro.next_frame()
clock.coro.run(rotate())
group = Group([star])
# This stops the spinning:
group.pop(0)
# No effect:
star.scale = 4
run()
The group.pop calls Group._factorise, which overrides the star's _Transformable__xfmat, so the star's __build_mat no longer writes to the right matrix.
After a
Group.pop
, assignments to the popped object'sangle
andscale
don't have any effect.This code should draw a big star that should rotate continuously, but instead draws a small static star:
The
group.pop
callsGroup._factorise
, which overrides the star's_Transformable__xfmat
, so the star's__build_mat
no longer writes to the right matrix.