mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
create Animation in the pool arena
This commit is contained in:
@@ -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));
|
||||||
|
|||||||
Reference in New Issue
Block a user