往期知识点整理
介绍
XComponent 提供了应用在 native 侧调用 OpenGLES 图形接口的能力,本文主要介绍如何配合 Vsync 事件,完成自定义动画。在这种实现方式下,自定义动画的绘制不在 UI 主线程中完成,即使主线程卡顿,动画效果也不会受影响。
效果演示
实现思路
- CMakelists 增加 lib 依赖
find_library( # Sets the name of the path variable.
libvsync-lib
# Specifies the name of the NDK library that
# you want CMake to locate.
native_vsync )
- 创建 vsync 实例
#include