create Animation in the pool arena

This commit is contained in:
Pierre Tachoire
2026-02-19 10:50:12 +01:00
parent d75f5f9231
commit e15b8145b1

View File

@@ -52,14 +52,19 @@ pub fn init(page: *Page) !*Animation {
const arena = try page.getArena(.{ .debug = "Animation" }); const arena = try page.getArena(.{ .debug = "Animation" });
errdefer page.releaseArena(arena); errdefer page.releaseArena(arena);
const self = try page._factory.create(Animation{ const self = try arena.create(Animation);
self.* = .{
._page = page, ._page = page,
._arena = arena, ._arena = arena,
}); };
return self; return self;
} }
pub fn deinit(self: *Animation, _: bool) void {
self._page.releaseArena(self._arena);
}
pub fn play(self: *Animation, page: *Page) !void { pub fn play(self: *Animation, page: *Page) !void {
if (self._playState == .running) { if (self._playState == .running) {
return; return;
@@ -164,10 +169,6 @@ pub fn getOnFinish(self: *const Animation) ?js.Function.Temp {
return self._onFinish; return self._onFinish;
} }
pub fn deinit(self: *Animation, _: bool) void {
self._page.releaseArena(self._arena);
}
// callback function transitionning from a state to another // callback function transitionning from a state to another
fn update(ctx: *anyopaque) !?u32 { fn update(ctx: *anyopaque) !?u32 {
const self: *Animation = @ptrCast(@alignCast(ctx)); const self: *Animation = @ptrCast(@alignCast(ctx));