python画卡通人物_Pose Animator(姿势动画师):做动作控制生成矢量角色动画

Pose Animator

Pose Animator takes a 2D vector illustration and animates its containing curves in real-time based on the recognition result from PoseNet and FaceMesh. It borrows the idea of skeleton-based animation from computer graphics and applies it to vector characters.

This is running in the browser in realtime using TensorFlow.js. Check out more cool TF.js demos here.

This is not an officially supported Google product.

avatar-new-1.gif?raw=true

avatar-new-full-body.gif?raw=true

In skeletal animation a character is represented in two parts:

a surface used to draw the character, and

a hierarchical set of interconnected bones used to animate the surface.

In Pose Animator, the surface is defined by the 2D vector paths in the input SVG files. For the bone structure, Pose Animator provides a predefined rig (bone hierarchy) representation, designed based on the keypoints from PoseNet and FaceMesh. This bone structure’s initial pose is specified in the input SVG file, along with the character illustration, while the real time bone positions are updated by the recognition result from ML models.

68747470733a2f2f666972656261736573746f726167652e676f6f676c65617069732e636f6d2f76302f622f706f73652d616e696d61746f722d64656d6f2e61707073706f742e636f6d2f6f2f6d6c2d6b6579706f696e74732e706e673f616c743d6d65646961

avatar-new-bezier-1.gif?raw=true

// TODO: Add blog post link. For more details on its technical design please check out this blog post.

The camera demo animates a 2D avatar in real-time from a webcam video stream.

The static image demo shows the avatar positioned from a single image.

Build And Run

Install dependencies and prepare the build directory:

yarn

To watch files for changes, and launch a dev server:

yarn watch

Platform support

Demos are supported on Desktop Chrome and iOS Safari.

It should also run on Chrome on Android and potentially more Android mobile browsers though support has not been tested yet.

Animate your own design

Create a new file in your vector graphics editor of choice. Copy the group named ‘skeleton’ from the above file into your working file. Note:

Do not add, remove or rename the joints (circles) in this group. Pose Animator relies on these named paths to read the skeleton’s initial position. Missing joints will cause errors.

However you can move the joints around to embed them into your illustration. See step 4.

Create a new group and name it ‘illustration’, next to the ‘skeleton’ group. This is the group where you can put all the paths for your illustration.

Flatten all subgroups so that ‘illustration’ only contains path elements.

Composite paths are not supported at the moment.

The working file structure should look like this: [Layer 1]

|---- skeleton

|---- illustration

|---- path 1

|---- path 2

|---- path 3

Embed the sample skeleton in ‘skeleton’ group into your illustration by moving the joints around.

Export the file as an SVG file.

Open Pose Animator camera demo. Once everything loads, drop your SVG file into the browser tab. You should be able to see it come to life :D

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值