Skip to content

Support efficient raf + resizeObserver + fireOnEveryPaint pattern #54

@progers

Description

@progers

To get accurate pixel dimensions, we want to encourage the use of resizeObserver + fireOnEveryPaint, but this only fires when there is a paint invalidation. Some effects, like a webgl ripple effect, need to run every frame, but raf doesn't have the accurate pixel size information. We can solve this by adding an invalidatePaint() function on canvas which causes fireOnEveryPaint to call, and the pattern would be to setup a raf loop that always calls invalidatePaint.

This functionality isn't needed immediately (a workaround is to modify the background color of canvas in the raf loop), but this would be good to add for efficiency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions