WO2022179054A1 - Method for playing system image - Google Patents

Method for playing system image Download PDF

Info

Publication number
WO2022179054A1
WO2022179054A1 PCT/CN2021/111678 CN2021111678W WO2022179054A1 WO 2022179054 A1 WO2022179054 A1 WO 2022179054A1 CN 2021111678 W CN2021111678 W CN 2021111678W WO 2022179054 A1 WO2022179054 A1 WO 2022179054A1
Authority
WO
WIPO (PCT)
Prior art keywords
animation
information
bone
frame
slot
Prior art date
Application number
PCT/CN2021/111678
Other languages
French (fr)
Chinese (zh)
Inventor
万长征
赵康
陈斌
雷淼森
金玉龙
李宁
Original Assignee
亿咖通(湖北)科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 亿咖通(湖北)科技有限公司 filed Critical 亿咖通(湖北)科技有限公司
Publication of WO2022179054A1 publication Critical patent/WO2022179054A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • G06T13/203D [Three Dimensional] animation
    • G06T13/403D [Three Dimensional] animation of characters, e.g. humans, animals or virtual beings
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/20Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2219/00Indexing scheme for manipulating 3D models or images for computer graphics
    • G06T2219/20Indexing scheme for editing of 3D models
    • G06T2219/2016Rotation, translation, scaling

Definitions

  • the invention relates to the field of in-vehicle entertainment information systems, in particular to a method for playing system images.
  • animation playback includes ordinary frame animation playback, H5 (HyperText Markup Language 5, HyperText Markup Language 5) player playback of skeletal animation and game engine attached playback of skeletal animation.
  • H5 HyperText Markup Language 5, HyperText Markup Language 5
  • Ordinary frame animation actually cuts each frame of each animation.
  • the size of the animation resource is positively related to the total number of frames of the animation and the number of animations. Because playing frame animation is actually playing a large bitmap picture, compared with skeletal animation, frame animation has a problem of large resource consumption, and frame animation CPU consumption is higher. And because the resources of frame animation are all in the resource library, after the application package is packaged, it cannot be updated remotely.
  • the H5 skeletal animation player runs on the car entertainment system of the Android platform and needs to be attached to WebView.
  • WebView is a very important control in the android system to display web pages. Because some in-car entertainment systems do not support WebView very well, such models may not be able to play. And because the WebView needs to be loaded before playing, and then the animation is played, the first loading time is long and the scalability is low.
  • skeletal animation is not its main business, it is just a way for game sprites to play animation.
  • Cocos 2DX game engine as an example, which also contains Layer (layer), Scene (scene) and Director (director). This also causes the game engine not only to take a long time to start, but also to occupy a large amount of CPU and memory.
  • One or more embodiments of the present invention provide a method for playing a system image, including:
  • each frame of the target animation is rendered in sequence, and each frame of the rendered animation is played frame by frame.
  • the system avatar animation resources include texture set pictures, texture set texts, and animation set texts.
  • the step of parsing the system image animation resources produced by skeletal animation to obtain parsing animation data includes:
  • each of the multiple components is clipped from the texture set picture, and the Each of the multiple components cut out together with the name, height and width of the component are stored together as the second part of the parsing animation data;
  • the animation set text is parsed, and initial information of each of the multiple animations and sub-information of each of the multiple animations are obtained from the animation set text as the third part of the parsed animation data.
  • the complete information of each of the plurality of animations includes initial information of the animation, sub-information of the animation, and complete information of each frame of the animation;
  • the step of processing the parsed animation data and generating an animation library containing complete information of each animation in the plurality of animations includes:
  • the initial information of each of the plurality of animations includes animation set information, bone information, slot information and component information;
  • the sub-information of each of the plurality of animations includes the basic information of the animation, the movement track of the bones and the display track of the slot;
  • the step of extracting the initial information of each of the plurality of animations and the sub-information of the animations from the parsed animation data includes:
  • the basic information, the initial information, the motion track of the bone and the display track of the slot are combined into complete information of each single animation.
  • the bone information includes the parent-child relationship of the bones, the initial positions of the bones in each of the plurality of animations, and the scaling size of the bones;
  • the slot information includes the parent-child relationship of the slot, the component list under the slot and the slot display state;
  • the component information includes the position of the component relative to the slot
  • the basic information of each of the plurality of animations includes the total number of frames of the animation
  • the motion track of the bone includes a bone translation track, a bone rotation track including a rotation angle of the bone, and a bone scaling track;
  • the display track of the slot includes a slot display track and a slot gradient track
  • the step of calculating the complete information of each frame of each of the multiple animations according to the initial information of each of the multiple animations and the sub-information of the animations includes:
  • the initial data of the animation is extracted from the bone information, the slot information, the component information and the motion trajectory of the bone of the animation, where the initial data includes the bone
  • Extract the slot gradient track of the animation from the display track of the slot of the animation read the duration, transparency, and change curve in the slot gradient track, and combine the transparency or initial value at the end of the previous frame of the track Transparency, which calculates the transparency of the slot in each frame;
  • calculating the position of the bone in each frame according to the bone translation trajectory and the initial position of the bone in the initial data including:
  • the position of the bone in each frame is calculated according to the relative translation distance of the x and y axes in the bone translation track, the position after the last frame of translation ends, and the duration of the translation. , the initial position of the bone is taken as the position after the translation of the previous frame.
  • calculating the rotation angle of the bone in each frame according to the rotation trajectory of the bone and the rotation angle of the bone in the initial data including:
  • the step of determining the target animation to be played according to the current scene includes:
  • the target animation corresponding to the current scene is determined according to the current scene.
  • the step of determining the target animation corresponding to the current scene according to the current scene includes:
  • the animation corresponding to the current scene is used as the target animation
  • the default animation is used as the target animation.
  • the basic information of each of the plurality of animations includes the total number of frames of the animation and the set number of playbacks
  • each frame of described target animation is rendered successively, and the step of playing each frame after rendering frame by frame includes:
  • One or more embodiments of the present invention use skeletal animation to produce system image animation, and the target animation to be played can be directly obtained from the system image library according to the current scene.
  • the CPU usage rate improves the operating efficiency of the CPU.
  • OpenCV may be used to render each frame of animation of the system image to be played, thereby reducing the startup delay of the playback engine. Since OpenCV can run on major platforms such as Windows, Android, Maemo, FreeBSD, OpenBSD, iOS, Linux, and Mac OS, it can make the playback engine have a wider scope of application.
  • FIG. 1 is a flowchart of a method for playing a system image according to one or more embodiments of the present invention
  • Fig. 2 is a flow chart of generating a system image animation library according to one or more embodiments of the present invention
  • FIG. 3 is a flow chart of switching animations according to one or more embodiments of the present invention.
  • FIG. 4 is a flow diagram of a render target animation in accordance with one or more embodiments of the present invention.
  • FIG. 1 is a flowchart of a method for playing a system avatar according to one or more embodiments of the present invention. Referring to FIG. 1, the method includes at least steps S102 to S106.
  • Step S102 parsing the system image animation resources produced by the skeletal animation to obtain parsing animation data, processing the parsing animation data, and generating an animation library including complete information of each animation in the plurality of animations.
  • Step S104 Determine the target animation to be played according to the current scene, and obtain complete information of the target animation from the animation library.
  • Step S106 based on the complete information of the target animation, sequentially render each frame of the target animation, and play each rendered frame frame by frame.
  • One or more embodiments of the present invention use skeletal animation to produce system image animation, and the target animation to be played can be directly obtained from the system image library according to the current scene.
  • the CPU usage rate improves the operating efficiency of the CPU.
  • the system image animation resources may generally include texture set pictures, texture set texts and animation set texts.
  • the texture set image is a collection of components in all animation frames, which are aggregated and synthesized on a png image.
  • the texture set text is used to describe the position, size and name of the component in the texture set image, which is convenient for clipping the component from the texture set image.
  • the animation set text is a text file used to describe the initial information of each animation and the sub-information of each animation, and the text file may be in json format.
  • the texture set text when parsing a system image animation resource produced by skeletal animation to obtain parsing animation data, the texture set text can be parsed first, and the texture set image can be extracted from the texture set text.
  • the name, position, height and width, as well as the name, height and width of each of the multiple components in the texture set picture, and the relative position of each component in the texture set picture are used as the first part of parsing the animation data. Then, according to the name, height and width of each component in the texture set picture, and the relative position of each component in the texture set picture, each component is cut out from the texture set picture, and each component and the name, height and height of each component are cut out.
  • texture set text and animation set text can be parsed using the Gson library. For example, when using Gson to parse the text of the texture set, it can be obtained that the name of the phone in the texture set picture is Phone, the height and width are 97 ⁇ 91, and the position in the texture set picture is (1, 497). Certainly, other manners may also be used for parsing, which is not specifically limited in this embodiment of the present invention.
  • the complete information of each animation includes initial information of the animation, sub-information of the animation, and complete information of each frame of the animation.
  • the initial information of each animation and the sub-information of each animation can be extracted from the analysis animation data first, according to the initial information of each animation and each animation.
  • the sub-information of the animation calculates the complete information of each frame of each animation.
  • the initial information and sub-information of each animation and the complete information of each frame of the animation are combined together to form the complete information of each animation.
  • the complete information of all animations is combined to form the system image animation library.
  • the initial information of each animation may include animation set information, bone information, slot information and component information.
  • the sub-information of each animation may include the basic information of the animation, the movement track of the bone and the display track of the slot.
  • Animation set information including the name of the animation set, the frame rate of the animation, the size of the canvas, the initial position of the image in the canvas, and the name of the default animation in the animation set.
  • Bone information including bone parent-child relationship (including bone name, parent bone name), the initial position of the bone in each animation, the bone scaling size and the bone offset position.
  • Skeletal information is the soul of skeletal animation, and various actions in the system image animation are transmitted through the actions of bones.
  • the bone moves not only according to itself, but also by the movement of the parent bone. For example, if the parent bone is translated by 30 pixels on the x-axis, the child bone will also be translated by 30 pixels on the x-axis, plus the child's own movement.
  • Slot information including slot parent-child relationship (including slot name, parent slot name), component list under the slot, and slot display status.
  • sockets are attached to bones, but compared to bones, sockets also have a display state. That is to say, by setting the display state of the slot, it is possible to directly control whether the user can see the components on the slot.
  • Component information including the name of the component, the location of the component relative to the slot, the size of the component, and the component scaling. Components are attached to slots. Multiple components can be placed in a slot, but only one component can be displayed in a slot at a time. Based on this, the skinning of the system image animation can be realized by replacing the texture set image.
  • Basic information of each animation including the animation name, the total number of frames of the animation, and the set number of playbacks.
  • the motion track of the bone including the bone translation track, the bone rotation track including the bone rotation angle, and the bone scaling track. Since there is a parent-child relationship between bones, the movement of the parent bone will drive the movement of the child bone. Therefore, the state of the parent bone needs to be taken into account when calculating the position, rotation and scaling of the bone.
  • IK Inverse Kinematics, inverse dynamics constraints in the relationship of the bones, and the motion trajectories of the two bones with IK constraints will also affect each other to achieve bottom-up driving. For example, when doing push-ups, support your body with your hands on the bottom.
  • the IK constraint is the opposite of the IF (Forward Kinematics, forward dynamics) constraint, and the IF constraint is used to achieve top-down driving.
  • the big arm drives the forearm
  • the thigh drives the calf, and so on.
  • the display track of the slot including the slot display track and the slot fader track.
  • the steps of calculating the complete information of each frame of each animation according to the initial information of each animation and the sub-information of each animation include:
  • the first step is to extract the initial data of the animation from the bone information, slot information, component information and motion trajectory of the animation.
  • the initial data includes the initial position of the bone, the scale of the bone, the rotation angle of the bone, and the component under the slot.
  • the list for example, the eye is a slot, the pictures of open, squinted and closed eyes are the components under this slot, and the opening and closing of the eyes can be controlled by controlling the display of the first component in the slot) and the relative slot of the component Location.
  • the total number of frames of the animation is extracted from the basic information of the animation, and a list with the same length as the total number of frames is created to save the complete information of each frame of the animation.
  • the third step is to extract the bone translation track, bone rotation track and bone scaling track of the animation from the motion track of the bone of the animation, according to the bone translation track, bone rotation track and bone scaling track and the initial position of the bone in the initial data, Bone scaling and bone rotation to calculate the position, rotation and actual size of the bone in each frame.
  • the fourth step is to extract the slot display track of the animation from the slot display track of the animation, and calculate whether the slot is displayed in each frame according to the slot display track, the component list under the slot and the slot display state. Components under the slots shown.
  • the display track refers to the number of the component list under the display slot of the slot in a period of time. For example, if the phone slot is hidden from frames 0 to 17, phone 1 is displayed on frames 17 to 35, phone 2 is displayed on frames 35 to 60, and hidden from frames 60 to 76, then the corresponding duration and display values should be are (17, -1), (18, 0), (25, 1), (16, -1). As above, through the duration and the current display value, it can be calculated whether the slot should be displayed and which slot component is displayed in each animation frame.
  • the fifth step is to extract the slot gradient track of the animation from the display track of the slot of the animation, read the duration, transparency, and change curve in the slot gradient track, and combine the transparency or initial value at the end of the previous frame of the track. Transparency, calculates the transparency of the slot in each frame. Specifically, the default initial transparency is 100%, which is opaque.
  • the phone call animation in the system image animation as an example. In the phone call animation, the transparency of the phone slot is 0 at frames 0 to 17, the transparency of frames 17 to 25 changes from 0 to 100, and the transparency of frames 25 to 52 remains at 100.
  • the sixth step is to combine the calculated position, rotation angle and actual size of the bone in each frame, whether the slot is displayed, the components under the displayed slot, and the transparency of the slot into the complete information of each frame of the animation. Saved in the list.
  • the relative translation distance of the x and y axes in the bone translation track, after the last frame of translation is completed can be calculated.
  • position and the duration of the translation to calculate the position of the bone in each frame in the calculation of the first frame, the initial position of the bone is taken as the position after the translation of the previous frame is completed.
  • the rotation angle and rotation angle in the bone rotation trajectory can be calculated according to the angle change curve in the bone rotation trajectory, the rotation angle and the rotation angle after the end of the previous frame of the trajectory.
  • the duration of calculates the rotation angle of the bone in each frame.
  • the initial rotation angle of the bone which is 0 by default, is used as the rotation angle after the end of the trajectory of the previous frame.
  • the bone rotation track also includes the duration, rotation angle and change curve, which can be calculated by the duration, rotation angle, change curve and the state at the end of the last track (the initial rotation angle of the bone is 0).
  • the rotation angle of the bone in each animation frame is relatively complex. In addition to the duration, change curve, and the zoom size of the x and y dimensions, when calculating the size of the bones of each animation frame, it needs to be calculated in the x and y dimensions together, and finally Gets the actual size of the bones in each frame.
  • the step of determining the target animation to be played according to the current scene may include: when the scene changes, judging whether the animation currently being played matches the current scene after the change. If it matches, continue playing the current animation. If it does not match, the target animation to be played corresponding to the current scene is determined according to the current scene. That is to say, the animation switching of the system image is triggered by the scene. For example, when the system is playing music, the system image can monitor the playback status of the music in real time through the OPENAPI interface, and play the music animation.
  • the system image will monitor the callback of information such as people's behavior and expressions from the perception app (the app is used to identify user behavior and face functions) through the OPENAPI interface, and play the corresponding information according to the person's behavior and expression.
  • Animations such as a cough animation when the user smokes.
  • the animation corresponding to the current scene may be searched first according to the preset correspondence between the scene and the animation. Then, it is judged whether there is an animation corresponding to the current scene in the animation library. If it exists, the animation corresponding to the current scene is used as the target animation. If it does not exist, the default animation is used as the target animation.
  • the basic information of each animation may include the total number of frames and the set playing times of each animation.
  • the step of sequentially rendering each frame of animation of the target animation to be played, and playing each frame of the rendered animation frame by frame may include the following steps.
  • Step S31 acquiring complete information of the next frame of the target animation as the current frame data.
  • the complete information of the next frame of the target animation obtained in this step includes the position, rotation angle and zoom size of the bone in the frame, the display state and transparency of the slot in the frame, and the name of the component displayed by the slot. , component size, relative position, etc.
  • Step S32 rendering multiple components in the current frame data.
  • openCV is used to render all the components in the animation frame.
  • openCV is used to render the components on it in turn according to the order of the slots, and the absolute position, size, and angle of the components.
  • the slot here has a layer concept.
  • the eye component layer of the system image is higher than the face of the system image, so when rendering, you need to render the face first and then render the eye component, otherwise the eye component will be blocked by the face. components covered.
  • Step S33 according to the total number of frames of the target animation, determine whether there is a next frame of the target animation, if so, return to step S31, if not, execute step S34.
  • step S34 the cumulative number of playbacks of the target animation is incremented by 1, and the current number of playback frames is reset to 0.
  • step S35 it is determined whether the target animation is finished playing according to the accumulated playing times and the set playing times;
  • the cumulative playing times of the target animation is greater than or equal to the set playing times, it indicates that the target animation has been played, and the playing of the animation is ended. If the cumulative number of playbacks of the target animation is less than the set number of playbacks, the animation will continue to be played from the beginning.
  • OpenCV is used to render each frame of animation of the system image animation to be played, thereby reducing the startup delay of the playback engine. Since OpenCV can run on major platforms such as Windows, Android, Maemo, FreeBSD, OpenBSD, iOS, Linux, and Mac OS, it can make the playback engine have a wider scope of application.
  • the embodiment of the present invention can achieve one or more of the following technical effects:
  • One or more embodiments of the present invention use skeletal animation to create a system image animation, and the target animation to be played can be directly obtained from the system image library according to the current scene.
  • the CPU is significantly reduced.
  • the occupancy rate improves the operating efficiency of the CPU.
  • OpenCV may be used to render each frame of animation of the system image animation to be played, thereby reducing the startup delay of the playback engine. Since OpenCV can run on major platforms such as Windows, Android, Maemo, FreeBSD, OpenBSD, iOS, Linux, and Mac OS, it can make the playback engine have a wider scope of application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Architecture (AREA)
  • Computer Graphics (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Processing Or Creating Images (AREA)

Abstract

A method for playing a system image. The method comprises: parsing a system image animation resource made from a skeleton animation, so as to obtain parsed animation data, processing the parsed animation data, and generating an animation library that includes complete information of each animation from among a plurality of animations (S102); according to the current scenario, determining a target animation to be played, and acquiring complete information of the target animation from the animation library (S104); and sequentially rendering each frame of the target animation on the basis of the complete information of the target animation, and playing, frame by frame, each rendered frame (S106).

Description

一种播放系统形象的方法A method of playing system image 技术领域technical field
本发明涉及车载娱乐信息系统领域,特别是涉及一种播放系统形象的方法。The invention relates to the field of in-vehicle entertainment information systems, in particular to a method for playing system images.
背景技术Background technique
目前,动画播放的几种常见方法有普通帧动画播放、H5(HyperText Markup Language 5,超文本标记语言5)播放器播放骨骼动画和游戏引擎附带播放骨骼动画。At present, several common methods of animation playback include ordinary frame animation playback, H5 (HyperText Markup Language 5, HyperText Markup Language 5) player playback of skeletal animation and game engine attached playback of skeletal animation.
普通帧动画实际是对每一个动画的每一帧进行切图,动画资源的大小和动画的总帧数及动画的个数成正相关。由于播放帧动画实际上是播放一张张大的bitmap图片,相比于骨骼动画,帧动画存在资源占用大的问题,帧动画CPU占用更高。又由于帧动画的资源都是在资源库里,应用程序包打包后,无法再远程更新。Ordinary frame animation actually cuts each frame of each animation. The size of the animation resource is positively related to the total number of frames of the animation and the number of animations. Because playing frame animation is actually playing a large bitmap picture, compared with skeletal animation, frame animation has a problem of large resource consumption, and frame animation CPU consumption is higher. And because the resources of frame animation are all in the resource library, after the application package is packaged, it cannot be updated remotely.
H5骨骼动画播放器运行在安卓平台的车载娱乐系统上,需要附属于WebView,WebView是android系统中一个非常重要的控件,用来展示web页面。由于部分车载娱乐系统并不能很好的支持WebView,可能会导致该类车型无法播放。且因为播放前需要先加载WebView,再播放动画,所以首次加载的时间较长,扩展性低。The H5 skeletal animation player runs on the car entertainment system of the Android platform and needs to be attached to WebView. WebView is a very important control in the android system to display web pages. Because some in-car entertainment systems do not support WebView very well, such models may not be able to play. And because the WebView needs to be loaded before playing, and then the animation is played, the first loading time is long and the scalability is low.
游戏引擎虽然也能播放骨骼动画,但是骨骼动画并不是其主要业务,只是游戏精灵播放动画的一种方式。以Cocos 2DX游戏引擎为例,其里面还包含着Layer(层)、Scene(场景)和Director(导演)。这也导致了游戏引擎不仅启动时间长,而且占用的CPU和内存也较大。Although the game engine can also play skeletal animation, skeletal animation is not its main business, it is just a way for game sprites to play animation. Take the Cocos 2DX game engine as an example, which also contains Layer (layer), Scene (scene) and Director (director). This also causes the game engine not only to take a long time to start, but also to occupy a large amount of CPU and memory.
发明内容SUMMARY OF THE INVENTION
本发明的一个或多个实施例提供了一种播放系统形象的方法,包括:One or more embodiments of the present invention provide a method for playing a system image, including:
解析由骨骼动画制作的系统形象动画资源得到解析动画数据,处理所述解析动画数据并生成包含多个动画中的每一个动画的完整信息的动画库;Analyzing the system image animation resources produced by the skeletal animation to obtain analytic animation data, processing the analytic animation data and generating an animation library containing complete information of each animation in the plurality of animations;
根据当前场景确定即将播放的目标动画,从所述动画库中获取所述目标动画的完整信息;Determine the target animation to be played according to the current scene, and obtain the complete information of the target animation from the animation library;
基于所述目标动画的完整信息,对所述目标动画的每一帧动画依次进行渲染,并逐帧播放渲染后的每一帧动画。Based on the complete information of the target animation, each frame of the target animation is rendered in sequence, and each frame of the rendered animation is played frame by frame.
根据一个或多个实施例,所述系统形象动画资源包括纹理集图片、纹理集文本和动画集文本。According to one or more embodiments, the system avatar animation resources include texture set pictures, texture set texts, and animation set texts.
所述解析由骨骼动画制作的系统形象动画资源得到解析动画数据的步骤包括:The step of parsing the system image animation resources produced by skeletal animation to obtain parsing animation data includes:
解析所述纹理集文本,从所述纹理集文本中提取出所述纹理集图片的名称、位置和高宽以及所述纹理集图片中多个组件中的每一个组件的名称、高宽和各所述多个组件在所述纹理集图片中的相对位置作为所述解析动画数据的第一部分;Parse the texture set text, and extract the name, position, height and width of the texture set picture and the name, height and width of each component in the texture set picture from the texture set text. The relative positions of the multiple components in the texture set picture are used as the first part of the parsed animation data;
根据所述纹理集图片中各所述多个组件的名称、高宽和该组件在所述纹理集图片中的相对位置,从所述纹理集图片中剪裁出各所述多个组件,并将裁剪出的各所述多个组件和该组件的名称、高宽共同保存作为所述解析动画数据的第二部分;According to the name, height and width of each of the multiple components in the texture set picture, and the relative position of the component in the texture set picture, each of the multiple components is clipped from the texture set picture, and the Each of the multiple components cut out together with the name, height and width of the component are stored together as the second part of the parsing animation data;
解析所述动画集文本,从所述动画集文本中获取各所述多个动画的初始信息和各所述多个动画的子信息作为所述解析动画数据的第三部分。The animation set text is parsed, and initial information of each of the multiple animations and sub-information of each of the multiple animations are obtained from the animation set text as the third part of the parsed animation data.
根据一个或多个实施例,各所述多个动画的完整信息包括该动画的初始信息、该动画的子信息和该动画的每一帧的完整信息;According to one or more embodiments, the complete information of each of the plurality of animations includes initial information of the animation, sub-information of the animation, and complete information of each frame of the animation;
所述处理所述解析动画数据并生成包含多个动画中的每一个动画的完整信息的动画库的步骤包括:The step of processing the parsed animation data and generating an animation library containing complete information of each animation in the plurality of animations includes:
从所述解析动画数据中提取各所述多个动画的初始信息和该动画的子信息;Extract initial information of each of the plurality of animations and sub-information of the animation from the parsed animation data;
根据各所述多个动画的初始信息和该动画的子信息计算出各所述多个动画的每一帧的完整信息;Calculate the complete information of each frame of each of the plurality of animations according to the initial information of each of the plurality of animations and the sub-information of the animation;
分别将各所述多个动画的初始信息、子信息和该动画的每一帧的完整信息组合在一起形成各所述多个动画的完整信息,将所述多个动画的完整信息组合到一起形成所述动画库。Respectively combining the initial information, sub-information and complete information of each frame of each of the multiple animations to form complete information of each of the multiple animations, and combining the complete information of the multiple animations together The animation library is formed.
根据一个或多个实施例,各所述多个动画的初始信息包括动画集信息、骨骼信息、插槽信息和组件信息;According to one or more embodiments, the initial information of each of the plurality of animations includes animation set information, bone information, slot information and component information;
各所述多个动画的子信息包括该动画的基本信息、骨骼的运动轨迹和插槽的显示轨迹;The sub-information of each of the plurality of animations includes the basic information of the animation, the movement track of the bones and the display track of the slot;
所述从所述解析动画数据中提取各所述多个动画的初始信息和该动画的子信息的步骤包括:The step of extracting the initial information of each of the plurality of animations and the sub-information of the animations from the parsed animation data includes:
从所述解析动画数据中提取出所述动画集信息、所述骨骼信息、所述插槽信息和所述组件信息作为各单个动画的初始信息;Extracting the animation set information, the skeleton information, the slot information and the component information from the parsed animation data as the initial information of each single animation;
从所述解析动画数据中提取出各所述多个动画的所述基本信息、所述骨骼的运动轨迹和所述插槽的显示轨迹;Extracting the basic information of each of the plurality of animations, the movement track of the bones and the display track of the slot from the analysis animation data;
将各单个动画的所述基本信息、所述初始信息、所述骨骼的运动轨迹和所述插槽的显示轨迹组合成各单个动画的完整信息。The basic information, the initial information, the motion track of the bone and the display track of the slot are combined into complete information of each single animation.
根据一个或多个实施例,所述骨骼信息包括骨骼父子关系、各所述多个动画中骨骼的初始位置和骨骼缩放大小;According to one or more embodiments, the bone information includes the parent-child relationship of the bones, the initial positions of the bones in each of the plurality of animations, and the scaling size of the bones;
所述插槽信息包括插槽父子关系、插槽下组件列表和插槽显示状态;The slot information includes the parent-child relationship of the slot, the component list under the slot and the slot display state;
所述组件信息包括组件相对于插槽的位置;The component information includes the position of the component relative to the slot;
各所述多个动画的基本信息包括该动画的总帧数;The basic information of each of the plurality of animations includes the total number of frames of the animation;
所述骨骼的运动轨迹包括骨骼平移轨迹、包括骨骼的旋转角度在内的骨骼旋转轨迹和骨骼缩放轨迹;The motion track of the bone includes a bone translation track, a bone rotation track including a rotation angle of the bone, and a bone scaling track;
所述插槽的显示轨迹包括插槽显示轨迹和插槽渐变轨迹;The display track of the slot includes a slot display track and a slot gradient track;
所述根据各所述多个动画的初始信息和该动画的子信息计算出各所述多动画的每一帧的完整信息的步骤包括:The step of calculating the complete information of each frame of each of the multiple animations according to the initial information of each of the multiple animations and the sub-information of the animations includes:
对于各所述多个动画,从该动画的所述骨骼信息、所述插槽信息、所述组件信息以及所述骨骼的运动轨迹中提取该动画的初始数据,所述初始数据包括所述骨骼的初始位置、所述骨骼缩放大小、所述骨骼的旋转角度、所述插槽下组件列表和所述组件相对于插槽的位置;For each of the plurality of animations, the initial data of the animation is extracted from the bone information, the slot information, the component information and the motion trajectory of the bone of the animation, where the initial data includes the bone The initial position of the skeleton, the scaling size of the skeleton, the rotation angle of the skeleton, the list of components under the slot, and the position of the component relative to the slot;
从该动画的基本信息中提取该动画的所述总帧数,创建与所述总帧数长度相同的列表以用于保存该动画的每一帧的完整信息;Extract the total number of frames of the animation from the basic information of the animation, and create a list with the same length as the total number of frames for saving the complete information of each frame of the animation;
从该动画的所述骨骼的运动轨迹中提取该动画的所述骨骼平移轨迹、所述骨骼旋转轨迹和所述骨骼缩放轨迹,根据所述骨骼平移轨迹、所述骨骼旋转轨迹和所述骨骼缩放轨迹以及所述初始数据中所述骨骼的初始位置、所述骨骼缩放大小和所述骨骼的旋转角度,计算出每一帧中骨骼的位置、旋转角度和实际大小;Extract the bone translation track, the bone rotation track, and the bone scaling track of the animation from the motion track of the bone of the animation, and scale according to the bone translation track, the bone rotation track, and the bone scaling track and the initial position of the bone in the initial data, the scaling size of the bone and the rotation angle of the bone, calculate the position, rotation angle and actual size of the bone in each frame;
从该动画的插槽的显示轨迹中提取该动画的插槽显示轨迹,根据所述插槽显示轨迹、所述插槽下组件列表和所述插槽显示状态计算出每一帧中所述插槽是否显示以及显示的插槽下的组件;Extract the slot display track of the animation from the slot display track of the animation, and calculate the slot display track in each frame according to the slot display track, the component list under the slot and the slot display state. Whether the slot is displayed and the components under the displayed slot;
从该动画的所述插槽的显示轨迹中提取该动画的插槽渐变轨迹,读取所述插槽渐变轨迹中的持续时间、透明度、变化曲线,结合上一帧轨迹结束时的透 明度或初始透明度,计算出每一帧中所述插槽的透明度;Extract the slot gradient track of the animation from the display track of the slot of the animation, read the duration, transparency, and change curve in the slot gradient track, and combine the transparency or initial value at the end of the previous frame of the track Transparency, which calculates the transparency of the slot in each frame;
将计算得到的每一帧中所述骨骼的位置、旋转角度和实际大小、所述插槽是否显示以及显示的插槽下的组件、所述插槽的透明度组合为该动画的每一帧的完整信息保存在所述列表中。The calculated position, rotation angle and actual size of the bone in each frame, whether the slot is displayed, the components under the displayed slot, and the transparency of the slot are combined into the value of each frame of the animation. Complete information is kept in said list.
根据一个或多个实施例,根据所述骨骼平移轨迹和所述初始数据中所述骨骼的初始位置计算出每一帧中骨骼的位置,包括:According to one or more embodiments, calculating the position of the bone in each frame according to the bone translation trajectory and the initial position of the bone in the initial data, including:
根据所述骨骼平移轨迹中x、y轴的相对平移距离、上一帧平移结束后的位置和平移的持续时间,计算出每一帧中所述骨骼的位置,其中,在进行第一帧计算时,以所述骨骼的初始位置作为上一帧平移结束后的位置。The position of the bone in each frame is calculated according to the relative translation distance of the x and y axes in the bone translation track, the position after the last frame of translation ends, and the duration of the translation. , the initial position of the bone is taken as the position after the translation of the previous frame.
根据一个或多个实施例,根据所述骨骼旋转轨迹和所述初始数据中所述骨骼的旋转角度计算出每一帧中骨骼的旋转角度,包括:According to one or more embodiments, calculating the rotation angle of the bone in each frame according to the rotation trajectory of the bone and the rotation angle of the bone in the initial data, including:
根据所述骨骼旋转轨迹中角度变化曲线、上一帧轨迹结束后的旋转角度和旋转的持续时间,计算出每一帧中骨骼的旋转角度,其中,在进行第一帧计算时,以默认为0的骨骼初始旋转角度作为上一帧轨迹结束后的旋转角度。Calculate the rotation angle of the bone in each frame according to the angle change curve in the bone rotation track, the rotation angle after the end of the previous frame of the track, and the duration of the rotation, wherein, when the first frame is calculated, the default is The initial rotation angle of the bone of 0 is used as the rotation angle after the end of the previous frame of the track.
根据一个或多个实施例,所述根据当前场景确定即将播放的目标动画的步骤,包括:According to one or more embodiments, the step of determining the target animation to be played according to the current scene includes:
当场景发生变化时,判断当前播放的动画是否与变化后的当前场景匹配;When the scene changes, determine whether the currently playing animation matches the current scene after the change;
若判断当前播放的动画与变化后的当前场景匹配,则继续播放所述当前播放的动画;If it is judged that the currently played animation matches the changed current scene, then continue to play the currently played animation;
若判断当前播放的动画与变化后的当前场景不匹配,则根据所述当前场景确定与所述当前场景对应的所述目标动画。If it is determined that the currently played animation does not match the changed current scene, the target animation corresponding to the current scene is determined according to the current scene.
根据一个或多个实施例,所述根据所述当前场景确定与所述当前场景对应的所述目标动画的步骤包括:According to one or more embodiments, the step of determining the target animation corresponding to the current scene according to the current scene includes:
根据预设的场景与动画的对应关系查找出与所述当前场景对应的动画;Find out the animation corresponding to the current scene according to the preset correspondence between the scene and the animation;
判断所述动画库中是否存在所述与所述当前场景对应的动画;Judging whether the animation corresponding to the current scene exists in the animation library;
若判断所述动画库中存在所述与所述当前场景对应的动画,则以所述与所述当前场景对应的动画作为所述目标动画;If it is judged that the animation corresponding to the current scene exists in the animation library, the animation corresponding to the current scene is used as the target animation;
若判断所述动画库中不存在所述与所述当前场景对应的动画,则以默认动画作为所述目标动画。If it is determined that the animation corresponding to the current scene does not exist in the animation library, the default animation is used as the target animation.
根据一个或多个实施例,各所述多个动画的基本信息包括该动画的总帧数和设定播放次数;According to one or more embodiments, the basic information of each of the plurality of animations includes the total number of frames of the animation and the set number of playbacks;
所述对所述目标动画的每一帧依次进行渲染,并逐帧播放渲染后的每一帧 的步骤包括:Described that each frame of described target animation is rendered successively, and the step of playing each frame after rendering frame by frame includes:
获取所述目标动画的下一帧的完整信息作为当前帧数据;Obtain the complete information of the next frame of the target animation as the current frame data;
渲染所述当前帧数据中所述多个组件;rendering the multiple components in the current frame data;
根据所述目标动画的总帧数判断所述目标动画是否存在下一帧;若判断所述目标动画存在下一帧,返回至所述获取所述目标动画的下一帧的完整信息作为当前帧数据的步骤,若判断所述目标动画不存在下一帧,所述目标动画的累计播放次数加1,且将当前播放帧数重置为0;Determine whether the target animation has the next frame according to the total number of frames of the target animation; if it is determined that the target animation has the next frame, return to the acquisition of the complete information of the next frame of the target animation as the current frame In the step of data, if it is judged that the target animation does not have the next frame, the cumulative playback times of the target animation is increased by 1, and the current playback frame number is reset to 0;
根据所述累计播放次数和所述设定播放次数判断所述目标动画是否播放完毕,若判断所述目标动画播放完毕,则结束播放,若判断所述目标动画未播放完毕,返回至所述获取所述目标动画的下一帧的完整信息作为当前帧数据的步骤。Determine whether the target animation has finished playing according to the cumulative playing times and the set playing times, if it is judged that the target animation has finished playing, end the playing, and if it is judged that the target animation has not finished playing, return to the acquisition The step of taking the complete information of the next frame of the target animation as the data of the current frame.
本发明的一个或多个实施例通过骨骼动画制作系统形象动画,根据当前场景可以从系统形象库中直接获取即将播放的目标动画,相比于普通帧动画的播放方式而言,显著地降低了CPU占用率,提高了CPU的运行效率。One or more embodiments of the present invention use skeletal animation to produce system image animation, and the target animation to be played can be directly obtained from the system image library according to the current scene. The CPU usage rate improves the operating efficiency of the CPU.
根据一个或多个实施例,可以采用OpenCV对即将播放的系统形象动画的各帧动画进行渲染,从而降低播放引擎的启动延时。由于OpenCV可以在Windows、Android、Maemo、FreeBSD、OpenBSD、iOS、Linux和Mac OS等各大平台上运行,因此,可以使播放引擎具有更广的适用范围。According to one or more embodiments, OpenCV may be used to render each frame of animation of the system image to be played, thereby reducing the startup delay of the playback engine. Since OpenCV can run on major platforms such as Windows, Android, Maemo, FreeBSD, OpenBSD, iOS, Linux, and Mac OS, it can make the playback engine have a wider scope of application.
根据下文结合附图对本发明具体实施例的详细描述,本领域技术人员将会更加明了本发明实施例的上述以及其他优点和特征。The above and other advantages and features of the embodiments of the present invention will be more apparent to those skilled in the art from the following detailed description of the specific embodiments of the present invention in conjunction with the accompanying drawings.
附图说明Description of drawings
通过阅读下文对具体实施例的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出部分实施例,而并不应被认为是对本发明的限制。而且在所有附图中,用相同的参考符号表示相同的部件。Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of specific embodiments. The drawings are only used to illustrate some of the embodiments and should not be considered to limit the present invention. Also, the same components are denoted by the same reference symbols throughout the drawings.
图1是根据本发明一个或多个实施例的播放系统形象的方法的流程图;1 is a flowchart of a method for playing a system image according to one or more embodiments of the present invention;
图2是根据本发明一个或多个实施例的生成系统形象动画库的流程图;Fig. 2 is a flow chart of generating a system image animation library according to one or more embodiments of the present invention;
图3是根据本发明一个或多个实施例的切换动画的流程图;3 is a flow chart of switching animations according to one or more embodiments of the present invention;
图4是根据本发明一个或多个实施例的渲染目标动画的流程图。4 is a flow diagram of a render target animation in accordance with one or more embodiments of the present invention.
具体实施方式Detailed ways
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了 本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be more thoroughly understood, and will fully convey the scope of the present disclosure to those skilled in the art.
图1是根据本发明一个或多个实施例的播放系统形象的方法流程图。参见图1,该方法至少包括步骤S102至步骤S106。FIG. 1 is a flowchart of a method for playing a system avatar according to one or more embodiments of the present invention. Referring to FIG. 1, the method includes at least steps S102 to S106.
步骤S102,解析由骨骼动画制作的系统形象动画资源得到解析动画数据,处理解析动画数据并生成包含多个动画中的每一个动画的完整信息的动画库。Step S102, parsing the system image animation resources produced by the skeletal animation to obtain parsing animation data, processing the parsing animation data, and generating an animation library including complete information of each animation in the plurality of animations.
步骤S104,根据当前场景确定即将播放的目标动画,从动画库中获取目标动画的完整信息。Step S104: Determine the target animation to be played according to the current scene, and obtain complete information of the target animation from the animation library.
步骤S106,基于所述目标动画的完整信息,对目标动画的每一帧依次进行渲染,并逐帧播放渲染后的每一帧。Step S106, based on the complete information of the target animation, sequentially render each frame of the target animation, and play each rendered frame frame by frame.
本发明的一个或多个实施例通过骨骼动画制作系统形象动画,根据当前场景可以从系统形象库中直接获取即将播放的目标动画,相比于普通帧动画的播放方式而言,显著地降低了CPU占用率,提高了CPU的运行效率。One or more embodiments of the present invention use skeletal animation to produce system image animation, and the target animation to be played can be directly obtained from the system image library according to the current scene. The CPU usage rate improves the operating efficiency of the CPU.
上文步骤S102中,系统形象动画资源一般性地可包括纹理集图片、纹理集文本和动画集文本。其中,纹理集图片是所有动画帧中的组件的合集,汇总合成在一张png图片上。纹理集文本用于描述组件在纹理集图片中的位置、大小和名称等信息,便于将组件从纹理集图片中裁剪出来。动画集文本是用于描述各动画的初始信息和各动画的子信息的文本文件,该文本文件可以为json格式。In the above step S102, the system image animation resources may generally include texture set pictures, texture set texts and animation set texts. Among them, the texture set image is a collection of components in all animation frames, which are aggregated and synthesized on a png image. The texture set text is used to describe the position, size and name of the component in the texture set image, which is convenient for clipping the component from the texture set image. The animation set text is a text file used to describe the initial information of each animation and the sub-information of each animation, and the text file may be in json format.
参照图2,在本发明一个或多个实施例中,在解析由骨骼动画制作的系统形象动画资源得到解析动画数据时,可以先解析纹理集文本,从纹理集文本中提取出纹理集图片的名称、位置和高宽以及纹理集图片中多个组件中的每一个组件的名称、高宽和各组件在纹理集图片中的相对位置作为解析动画数据的第一部分。然后,根据纹理集图片中各组件的名称、高宽和各组件在纹理集图片中的相对位置,从纹理集图片中剪裁出各组件,并将裁剪出的各组件和各组件的名称、高宽共同保存作为解析动画数据的第二部分。最后,解析动画集文本,从动画集文本中获取动各动画的初始信息和各动画的子信息作为解析动画数据的第三部分。需要说明的是,解析动画集文本与解析纹理集文本互不影响,两者可以同时进行,以提高解析效率。Referring to FIG. 2, in one or more embodiments of the present invention, when parsing a system image animation resource produced by skeletal animation to obtain parsing animation data, the texture set text can be parsed first, and the texture set image can be extracted from the texture set text. The name, position, height and width, as well as the name, height and width of each of the multiple components in the texture set picture, and the relative position of each component in the texture set picture are used as the first part of parsing the animation data. Then, according to the name, height and width of each component in the texture set picture, and the relative position of each component in the texture set picture, each component is cut out from the texture set picture, and each component and the name, height and height of each component are cut out. Wide co-save as the second part of parsing the animation data. Finally, the animation set text is parsed, and the initial information of each animation and the sub-information of each animation are obtained from the animation set text as the third part of parsing animation data. It should be noted that parsing the animation set text and parsing the texture set text do not affect each other, and the two can be performed simultaneously to improve parsing efficiency.
根据一个实施例,可以使用Gson库对纹理集文本和动画集文本进行解析。例如,在采用Gson解析纹理集文本时,可以得到纹理集图片中电话的名称为 Phone,高宽为97×91,在纹理集图片中的位置为(1,497)。当然,也可以采用其他方式进行解析,本发明实施例对此不作具体限制。According to one embodiment, texture set text and animation set text can be parsed using the Gson library. For example, when using Gson to parse the text of the texture set, it can be obtained that the name of the phone in the texture set picture is Phone, the height and width are 97×91, and the position in the texture set picture is (1, 497). Certainly, other manners may also be used for parsing, which is not specifically limited in this embodiment of the present invention.
各动画的完整信息包括该动画的初始信息、该动画的子信息和该动画的每一帧的完整信息。上文步骤S102中,在处理解析动画数据并生成包含系统形象动画的动画库时,可以先从解析动画数据中提取各动画的初始信息和各动画的子信息,根据各动画的初始信息和各动画的子信息计算出各动画的每一帧的完整信息。然后,分别将各动画的初始信息、子信息和该动画的每一帧的完整信息组合在一起形成各动画的完整信息。最后,将所有动画的完整信息组合到一起形成系统形象动画库。The complete information of each animation includes initial information of the animation, sub-information of the animation, and complete information of each frame of the animation. In the above step S102, when processing the analysis animation data and generating the animation library including the system image animation, the initial information of each animation and the sub-information of each animation can be extracted from the analysis animation data first, according to the initial information of each animation and each animation. The sub-information of the animation calculates the complete information of each frame of each animation. Then, the initial information and sub-information of each animation and the complete information of each frame of the animation are combined together to form the complete information of each animation. Finally, the complete information of all animations is combined to form the system image animation library.
在本发明一实施例中,各动画的初始信息可包括动画集信息、骨骼信息、插槽信息和组件信息。各动画的子信息可包括该动画的基本信息、骨骼的运动轨迹和插槽的显示轨迹。在从解析动画数据中提取各动画的初始信息和各动画的子信息时,可以先从解析动画数据中提取出动画集信息、骨骼信息、插槽信息和组件信息。然后,从解析动画数据中提取出各动画的基本信息、骨骼的运动轨迹和插槽的显示轨迹。In an embodiment of the present invention, the initial information of each animation may include animation set information, bone information, slot information and component information. The sub-information of each animation may include the basic information of the animation, the movement track of the bone and the display track of the slot. When extracting the initial information of each animation and the sub-information of each animation from the analysis animation data, the animation set information, bone information, slot information and component information can be extracted from the analysis animation data first. Then, the basic information of each animation, the movement track of the bones and the display track of the slot are extracted from the analysis animation data.
为了更加清楚的说明如何根据各动画的初始信息和各动画的子信息计算出各动画的每一帧的完整信息,下面首先对解析动画集文本时涉及到的相关名称及其具体内容进行介绍。In order to explain more clearly how to calculate the complete information of each frame of each animation according to the initial information of each animation and the sub-information of each animation, the following first introduces the relevant names and specific contents involved in parsing the animation set text.
动画集信息,包括动画集名称、动画的帧率、画布的大小、形象在画布中的初始位置和动画集中的默认动画名称。Animation set information, including the name of the animation set, the frame rate of the animation, the size of the canvas, the initial position of the image in the canvas, and the name of the default animation in the animation set.
骨骼信息,包括骨骼父子关系(包括骨骼名称、父骨骼名称)、各动画中骨骼的初始位置、骨骼缩放大小和骨骼偏移位置。骨骼信息是骨骼动画的灵魂,系统形象动画中的各种动作均是通过骨骼的动作传导的。在实际的动画中,骨骼除了根据自己移动,还会受到父骨骼的移动而移动。例如,父骨骼在x轴上平移30像素,相对地,子骨骼也会在跟着在x轴上平移30像素,并加上子骨骼自己的移动。Bone information, including bone parent-child relationship (including bone name, parent bone name), the initial position of the bone in each animation, the bone scaling size and the bone offset position. Skeletal information is the soul of skeletal animation, and various actions in the system image animation are transmitted through the actions of bones. In the actual animation, the bone moves not only according to itself, but also by the movement of the parent bone. For example, if the parent bone is translated by 30 pixels on the x-axis, the child bone will also be translated by 30 pixels on the x-axis, plus the child's own movement.
插槽信息,包括插槽父子关系(包括插槽名称、父插槽名称)、插槽下组件列表和插槽显示状态。实际上,插槽是依附于骨骼的,但是相比于骨骼,插槽还具有是否显示状态。也就是说,通过设置插槽的显示状态,可以直接控制用户是否能看到该插槽上的组件。Slot information, including slot parent-child relationship (including slot name, parent slot name), component list under the slot, and slot display status. In fact, sockets are attached to bones, but compared to bones, sockets also have a display state. That is to say, by setting the display state of the slot, it is possible to directly control whether the user can see the components on the slot.
组件信息,包括组件的名称、组件相对于插槽的位置、组件的大小和组件缩放大小。组件是依附于插槽的,一个插槽可以放置多个组件,但一个插槽同 一时间只能显示一个组件。基于此,系统形象动画的换肤可以通过替换纹理集图片来实现。Component information, including the name of the component, the location of the component relative to the slot, the size of the component, and the component scaling. Components are attached to slots. Multiple components can be placed in a slot, but only one component can be displayed in a slot at a time. Based on this, the skinning of the system image animation can be realized by replacing the texture set image.
各动画的基本信息,包括该动画名称、该动画的总帧数以及设定播放次数。Basic information of each animation, including the animation name, the total number of frames of the animation, and the set number of playbacks.
骨骼的运动轨迹,包括骨骼平移轨迹、包括骨骼的旋转角度在内的骨骼旋转轨迹和骨骼缩放轨迹。由于,骨骼存在父子关系,父骨骼的移动会带动子骨骼移动。因此,在计算骨骼的位置、旋转角度和缩放大小时,需要同时考虑父骨骼的状态。另外,骨骼的关系中还有IK(Inverse Kinematics,反向动力学)约束,添加IK约束的两个骨骼的运动轨迹也会相互影响,用来实现由下而上的驱动。例如,做俯卧撑时,手撑住底面,支起身体。可以理解,IK约束与IF(Forward Kinematics,正向动力学)约束相反,IF约束则是用来实现由上而下的驱动。例如,大臂带动小臂、大腿带动小腿等。The motion track of the bone, including the bone translation track, the bone rotation track including the bone rotation angle, and the bone scaling track. Since there is a parent-child relationship between bones, the movement of the parent bone will drive the movement of the child bone. Therefore, the state of the parent bone needs to be taken into account when calculating the position, rotation and scaling of the bone. In addition, there are IK (Inverse Kinematics, inverse dynamics) constraints in the relationship of the bones, and the motion trajectories of the two bones with IK constraints will also affect each other to achieve bottom-up driving. For example, when doing push-ups, support your body with your hands on the bottom. It can be understood that the IK constraint is the opposite of the IF (Forward Kinematics, forward dynamics) constraint, and the IF constraint is used to achieve top-down driving. For example, the big arm drives the forearm, the thigh drives the calf, and so on.
插槽的显示轨迹,包括插槽显示轨迹和插槽渐变轨迹。The display track of the slot, including the slot display track and the slot fader track.
事实上,在从解析动画数据中提取各动画的初始信息和各动画的子信息时,可以得到各动画中每一帧的部分信息。例如,动画music中的手臂骨骼,动画中只会记录其在一个完成的动作里面的起始位置、平移大小、旋转角度和持续时间,这些数据在从解析动画数据中提取各动画的初始信息和各动画的子信息时可以直接得到。但每一帧中各个骨骼在什么位置、需要旋转多少角度、插槽是否显示、插槽的透明度是多少和插槽上显示哪个组件,还需要综合动画的初始位置、运动轨迹、骨骼父子关系和骨骼的IK约束来一起计算。In fact, when the initial information of each animation and the sub-information of each animation are extracted from the analysis animation data, partial information of each frame of each animation can be obtained. For example, for the arm bones in animation music, only the starting position, translation size, rotation angle and duration of a completed action are recorded in the animation. These data are extracted from the analysis animation data. The initial information and The sub-information of each animation can be obtained directly. But where is the position of each bone in each frame, what angle needs to be rotated, whether the slot is displayed, what is the transparency of the slot, and which component is displayed on the slot, it is also necessary to integrate the initial position of the animation, motion trajectory, bone parent-child relationship and The IK constraints of the bones are calculated together.
具体地,对于各动画而言,根据各动画的初始信息和各动画的子信息计算出各动画的每一帧的完整信息的步骤包括:Specifically, for each animation, the steps of calculating the complete information of each frame of each animation according to the initial information of each animation and the sub-information of each animation include:
第一步,从该动画的骨骼信息、插槽信息、组件信息以及骨骼的运动轨迹中提取该动画的初始数据,初始数据包括骨骼的初始位置、骨骼缩放大小、骨骼旋转角度、插槽下组件列表(例如,眼睛是一个插槽,睁眼、眯眼和闭眼的图片是这个插槽下的组件,通过控制插槽显示第几个组件来控制眼睛的睁闭)和组件相对插槽的位置。The first step is to extract the initial data of the animation from the bone information, slot information, component information and motion trajectory of the animation. The initial data includes the initial position of the bone, the scale of the bone, the rotation angle of the bone, and the component under the slot. The list (for example, the eye is a slot, the pictures of open, squinted and closed eyes are the components under this slot, and the opening and closing of the eyes can be controlled by controlling the display of the first component in the slot) and the relative slot of the component Location.
第二步,从该动画的基本信息中提取该动画的总帧数,创建与总帧数长度相同的列表以用于保存该动画的每一帧的完整信息。In the second step, the total number of frames of the animation is extracted from the basic information of the animation, and a list with the same length as the total number of frames is created to save the complete information of each frame of the animation.
第三步,从该动画的骨骼的运动轨迹中提取该动画的骨骼平移轨迹、骨骼旋转轨迹和骨骼缩放轨迹,根据骨骼平移轨迹、骨骼旋转轨迹和骨骼缩放轨迹以及初始数据中骨骼的初始位置、骨骼缩放大小和骨骼旋转角度,计算出每一帧中骨骼的位置、旋转角度和实际大小。The third step is to extract the bone translation track, bone rotation track and bone scaling track of the animation from the motion track of the bone of the animation, according to the bone translation track, bone rotation track and bone scaling track and the initial position of the bone in the initial data, Bone scaling and bone rotation to calculate the position, rotation and actual size of the bone in each frame.
第四步,从该动画的插槽的显示轨迹中提取该动画的插槽显示轨迹,根据插槽显示轨迹、插槽下组件列表和插槽显示状态计算出每一帧中插槽是否显示以及显示的插槽下的组件。需要说明的是,显示轨迹是指插槽在一个时间段里面该显示插槽下的组件列表中的第几个。例如,电话插槽在0到17帧是隐藏的,17到35帧显示的电话1,35到60帧显示的是电话2,60到76帧又隐藏,那么其对应的持续时间和显示值应该是(17,-1),(18,0),(25,1),(16,-1)。如上,通过持续时间、当前显示值就能计算出每一动画帧中该插槽是否该显示以及显示的哪一插槽组件。The fourth step is to extract the slot display track of the animation from the slot display track of the animation, and calculate whether the slot is displayed in each frame according to the slot display track, the component list under the slot and the slot display state. Components under the slots shown. It should be noted that the display track refers to the number of the component list under the display slot of the slot in a period of time. For example, if the phone slot is hidden from frames 0 to 17, phone 1 is displayed on frames 17 to 35, phone 2 is displayed on frames 35 to 60, and hidden from frames 60 to 76, then the corresponding duration and display values should be are (17, -1), (18, 0), (25, 1), (16, -1). As above, through the duration and the current display value, it can be calculated whether the slot should be displayed and which slot component is displayed in each animation frame.
第五步,从该动画的插槽的显示轨迹中提取该动画的插槽渐变轨迹,读取插槽渐变轨迹中的持续时间、透明度、变化曲线,结合上一帧轨迹结束时的透明度或初始透明度,计算出每一帧中插槽的透明度。具体地,默认初始透明度是100%,也就是不透明。以系统形象动画里面的打电话动画为例,在打电话动画中,电话插槽在0到17帧透明度是0,17到25帧透明度从0变到100,25到52帧透明度保持为100,52到60帧透明度从100变到0,60到76帧保持透明度为0,那么其对应的持续时间和透明度应该是(17,[0]),(8,[0,100]),(27,[100]),(8,[100,0]),(16,[0])。The fifth step is to extract the slot gradient track of the animation from the display track of the slot of the animation, read the duration, transparency, and change curve in the slot gradient track, and combine the transparency or initial value at the end of the previous frame of the track. Transparency, calculates the transparency of the slot in each frame. Specifically, the default initial transparency is 100%, which is opaque. Take the phone call animation in the system image animation as an example. In the phone call animation, the transparency of the phone slot is 0 at frames 0 to 17, the transparency of frames 17 to 25 changes from 0 to 100, and the transparency of frames 25 to 52 remains at 100. From 52 to 60 frames, the transparency changes from 100 to 0, and from 60 to 76 frames keep the transparency at 0, then its corresponding duration and transparency should be (17, [0]), (8, [0, 100]), (27 , [100]), (8, [100, 0]), (16, [0]).
第六步,将计算得到的每一帧中骨骼的位置、旋转角度和实际大小、插槽是否显示以及显示的插槽下的组件、插槽的透明度组合为该动画的每一帧的完整信息保存在列表中。The sixth step is to combine the calculated position, rotation angle and actual size of the bone in each frame, whether the slot is displayed, the components under the displayed slot, and the transparency of the slot into the complete information of each frame of the animation. Saved in the list.
根据一个实施例,在根据骨骼平移轨迹和初始数据中骨骼的初始位置计算出每一帧中骨骼的位置时,可以根据骨骼平移轨迹中x、y轴的相对平移距离、上一帧平移结束后的位置和平移的持续时间,计算出每一帧中骨骼的位置。其中,在进行第一帧计算时,以骨骼的初始位置作为上一帧平移结束后的位置。According to one embodiment, when the position of the bone in each frame is calculated according to the bone translation track and the initial position of the bone in the initial data, the relative translation distance of the x and y axes in the bone translation track, after the last frame of translation is completed, can be calculated. position and the duration of the translation to calculate the position of the bone in each frame. Among them, in the calculation of the first frame, the initial position of the bone is taken as the position after the translation of the previous frame is completed.
根据一个实施例,在根据骨骼旋转轨迹和初始数据中骨骼旋转角度计算出每一帧中骨骼的旋转角度时,可以根据骨骼旋转轨迹中角度变化曲线、上一帧轨迹结束后的旋转角度和旋转的持续时间,计算出每一帧中骨骼的旋转角度。其中,在进行第一帧计算时,以默认为0的骨骼初始旋转角度作为上一帧轨迹结束后的旋转角度。According to an embodiment, when calculating the rotation angle of the bone in each frame according to the bone rotation trajectory and the bone rotation angle in the initial data, the rotation angle and rotation angle in the bone rotation trajectory can be calculated according to the angle change curve in the bone rotation trajectory, the rotation angle and the rotation angle after the end of the previous frame of the trajectory. The duration of , calculates the rotation angle of the bone in each frame. Among them, in the calculation of the first frame, the initial rotation angle of the bone, which is 0 by default, is used as the rotation angle after the end of the trajectory of the previous frame.
值得注意的是,无论是骨骼平移轨迹、骨骼旋转轨迹还是骨骼缩放轨迹,都不仅仅支持线性变化,都可以自定义曲线。例如,骨骼平移轨迹使用的是抛物线y=x 2,从第1帧(1,5)移动到第5帧(31,5),那么它在各帧的位置变化应该是(1,5)、(2,5)、(6,5)、(15,5)、(31,5),而不是 (1,5)、(8.5,5)、(16,5)、(23.5,5)、(31,5)。同样地,骨骼旋转轨迹中也包含了持续时间、旋转角度和变化曲线,通过持续时间、旋转角度、变化曲线以及上一次轨迹结束时的状态(骨骼的初始旋转角度均为0),即可计算出每一动画帧中骨骼的旋转角度。缩放轨迹则相对较为复杂,除了包含持续时间、变化曲线,还有x和y两个维度的缩放大小,在计算每一动画帧骨骼的大小时,需要分x和y两个维度一起计算,最后得出每一帧中骨骼的实际大小。 It is worth noting that whether it is a bone translation track, a bone rotation track or a bone scaling track, not only linear changes are supported, but curves can be customized. For example, the bone translation trajectory uses the parabola y=x 2 , and moves from the first frame (1, 5) to the fifth frame (31, 5), then its position change in each frame should be (1, 5), (2,5), (6,5), (15,5), (31,5) instead of (1,5), (8.5,5), (16,5), (23.5,5), (31, 5). Similarly, the bone rotation track also includes the duration, rotation angle and change curve, which can be calculated by the duration, rotation angle, change curve and the state at the end of the last track (the initial rotation angle of the bone is 0). The rotation angle of the bone in each animation frame. The zoom track is relatively complex. In addition to the duration, change curve, and the zoom size of the x and y dimensions, when calculating the size of the bones of each animation frame, it needs to be calculated in the x and y dimensions together, and finally Gets the actual size of the bones in each frame.
上文步骤S104中,根据当前场景确定即将播放的目标动画的步骤可以包括:当场景发生变化时,判断当前播放的动画是否与变化后的当前场景匹配。若匹配,则继续播放当前的动画。若不匹配,则根据当前场景确定与当前场景对应的即将播放的目标动画。也就是说,系统形象的动画切换由场景触发,如系统在播放音乐时,系统形象能通过OPENAPI接口实时监听音乐的播放状态,播放音乐动画。如果车上有人抽烟时,系统形象通过OPENAPI接口从感知app(该app用于识别用户行为和人脸等功能)中监听人的行为、表情等信息的回调,根据人的行为、表情播放相应的动画,例如用户抽烟时播放咳嗽动画。In the above step S104, the step of determining the target animation to be played according to the current scene may include: when the scene changes, judging whether the animation currently being played matches the current scene after the change. If it matches, continue playing the current animation. If it does not match, the target animation to be played corresponding to the current scene is determined according to the current scene. That is to say, the animation switching of the system image is triggered by the scene. For example, when the system is playing music, the system image can monitor the playback status of the music in real time through the OPENAPI interface, and play the music animation. If someone smokes in the car, the system image will monitor the callback of information such as people's behavior and expressions from the perception app (the app is used to identify user behavior and face functions) through the OPENAPI interface, and play the corresponding information according to the person's behavior and expression. Animations, such as a cough animation when the user smokes.
参照图3,根据一个或多个实施例,在根据当前场景确定与当前场景对应的即将播放的目标动画时,可以先根据预设的场景与动画的对应关系查找与当前场景对应的动画。然后,判断动画库中是否存在与当前场景对应的动画。若存在,则以与当前场景对应的动画作为目标动画。若不存在,则以默认动画作为目标动画。3 , according to one or more embodiments, when a target animation to be played corresponding to the current scene is determined according to the current scene, the animation corresponding to the current scene may be searched first according to the preset correspondence between the scene and the animation. Then, it is judged whether there is an animation corresponding to the current scene in the animation library. If it exists, the animation corresponding to the current scene is used as the target animation. If it does not exist, the default animation is used as the target animation.
参照图4,根据一个或多个实施例,各动画的基本信息可包括各动画的总帧数和设定播放次数。对即将播放的目标动画的各帧动画依次进行渲染,并逐帧播放渲染后的各帧动画的步骤可以包括以下步骤。Referring to FIG. 4 , according to one or more embodiments, the basic information of each animation may include the total number of frames and the set playing times of each animation. The step of sequentially rendering each frame of animation of the target animation to be played, and playing each frame of the rendered animation frame by frame may include the following steps.
步骤S31,获取目标动画的下一帧的完整信息作为当前帧数据。Step S31, acquiring complete information of the next frame of the target animation as the current frame data.
具体地,本步骤中获取的目标动画的下一帧的完整信息包括骨骼在该帧中的位置、旋转角度和缩放大小,插槽在该帧中的显示状态、透明度和插槽显示的组件名称,组件的大小、相对位置等。Specifically, the complete information of the next frame of the target animation obtained in this step includes the position, rotation angle and zoom size of the bone in the frame, the display state and transparency of the slot in the frame, and the name of the component displayed by the slot. , component size, relative position, etc.
步骤S32,渲染当前帧数据中多个组件。Step S32, rendering multiple components in the current frame data.
本步骤中,使用openCV渲染动画帧中所有组件。具体地,使用openCV按照插槽的顺序,和组件的绝对位置、大小、角度,依次渲染其上的组件。这里插槽是有图层概念的,比如系统形象的眼睛组件图层高于系统形象的脸部,所以在渲染的时候,需要先渲染脸部再渲染眼睛组件,否则会导致眼睛组件被 脸部组件盖住的情况。In this step, use openCV to render all the components in the animation frame. Specifically, openCV is used to render the components on it in turn according to the order of the slots, and the absolute position, size, and angle of the components. The slot here has a layer concept. For example, the eye component layer of the system image is higher than the face of the system image, so when rendering, you need to render the face first and then render the eye component, otherwise the eye component will be blocked by the face. components covered.
步骤S33,根据目标动画的总帧数判断目标动画是否存在下一帧,若存在,返回至步骤S31,若不存在,则执行步骤S34。Step S33, according to the total number of frames of the target animation, determine whether there is a next frame of the target animation, if so, return to step S31, if not, execute step S34.
步骤S34,目标动画的累计播放次数加1,且将当前播放帧数重置为0。In step S34, the cumulative number of playbacks of the target animation is incremented by 1, and the current number of playback frames is reset to 0.
步骤S35,根据累计播放次数和设定播放次数判断目标动画是否播放完毕,若是,则结束播放,否则,返回至步骤S31。In step S35 , it is determined whether the target animation is finished playing according to the accumulated playing times and the set playing times;
具体地,如果目标动画的累积播放次数大于或等于设定播放次数,则表明目标动画已播放完毕,结束该动画的播放。如果目标动画的累积播放次数小于设定播放次数,则继续从头开始播放该动画。Specifically, if the cumulative playing times of the target animation is greater than or equal to the set playing times, it indicates that the target animation has been played, and the playing of the animation is ended. If the cumulative number of playbacks of the target animation is less than the set number of playbacks, the animation will continue to be played from the beginning.
本实施例中采用OpenCV对即将播放的系统形象动画的各帧动画进行渲染,从而降低播放引擎的启动延时。由于OpenCV可以在Windows、Android、Maemo、FreeBSD、OpenBSD、iOS、Linux和Mac OS等各大平台上运行,因此,可以使播放引擎具有更广的适用范围。In this embodiment, OpenCV is used to render each frame of animation of the system image animation to be played, thereby reducing the startup delay of the playback engine. Since OpenCV can run on major platforms such as Windows, Android, Maemo, FreeBSD, OpenBSD, iOS, Linux, and Mac OS, it can make the playback engine have a wider scope of application.
根据本发明任意一个可选实施例或多个可选实施例的组合,本发明实施例能够达到如下一个或多个技术效果:According to any optional embodiment of the present invention or a combination of multiple optional embodiments, the embodiment of the present invention can achieve one or more of the following technical effects:
本发明一个或多个实施例通过骨骼动画制作系统形象动画,根据当前场景可以从系统形象库中直接获取即将播放的目标动画,相比于普通帧动画的播放方式而言,显著地降低了CPU占用率,提高了CPU的运行效率。并且,在一个或多个实施例中,可以采用OpenCV对即将播放的系统形象动画的各帧动画进行渲染,从而降低播放引擎的启动延时。由于OpenCV可以在Windows、Android、Maemo、FreeBSD、OpenBSD、iOS、Linux和Mac OS等各大平台上运行,因此,可以使播放引擎具有更广的适用范围。One or more embodiments of the present invention use skeletal animation to create a system image animation, and the target animation to be played can be directly obtained from the system image library according to the current scene. Compared with the playback mode of ordinary frame animation, the CPU is significantly reduced. The occupancy rate improves the operating efficiency of the CPU. Furthermore, in one or more embodiments, OpenCV may be used to render each frame of animation of the system image animation to be played, thereby reducing the startup delay of the playback engine. Since OpenCV can run on major platforms such as Windows, Android, Maemo, FreeBSD, OpenBSD, iOS, Linux, and Mac OS, it can make the playback engine have a wider scope of application.
尽管已经针对有限数量的实施例描述了本发明,但是受益于本公开的本领域普通技术人员将理解,可以设计其他实施例而不脱离本文所公开的本发明的范围。因此,本发明的范围应仅由所附权利要求书限制。While the present invention has been described with respect to a limited number of embodiments, those of ordinary skill in the art having the benefit of this disclosure will appreciate that other embodiments can be devised without departing from the scope of the invention disclosed herein. Accordingly, the scope of the present invention should be limited only by the appended claims.

Claims (13)

  1. 一种播放系统形象的方法,包括:A method of playing a system image, comprising:
    解析由骨骼动画制作的系统形象动画资源得到解析动画数据,处理所述解析动画数据并生成包含多个动画中的每一个动画的完整信息的动画库;Analyzing the system image animation resources produced by the skeletal animation to obtain analytic animation data, processing the analytic animation data and generating an animation library containing complete information of each animation in the plurality of animations;
    根据当前场景确定即将播放的目标动画,从所述动画库中获取所述目标动画的完整信息;Determine the target animation to be played according to the current scene, and obtain the complete information of the target animation from the animation library;
    基于所述目标动画的完整信息,对所述目标动画的每一帧依次进行渲染,并逐帧播放渲染后的每一帧。Based on the complete information of the target animation, each frame of the target animation is sequentially rendered, and each rendered frame is played frame by frame.
  2. 根据权利要求1所述的方法,其中,所述系统形象动画资源包括纹理集图片、纹理集文本和动画集文本,The method according to claim 1, wherein the system image animation resources comprise texture set pictures, texture set texts and animation set texts,
    其中,所述解析由骨骼动画制作的系统形象动画资源得到解析动画数据的步骤包括:Wherein, the step of parsing the system image animation resources produced by skeletal animation to obtain parsing animation data includes:
    解析所述纹理集文本,从所述纹理集文本中提取出所述纹理集图片的名称、位置和高宽以及所述纹理集图片中多个组件中的每一个组件的名称、高宽和各所述多个组件在所述纹理集图片中的相对位置作为所述解析动画数据的第一部分;Parse the texture set text, and extract the name, position, height and width of the texture set picture and the name, height and width of each component in the texture set picture from the texture set text. The relative positions of the multiple components in the texture set picture are used as the first part of the parsed animation data;
    根据所述纹理集图片中各所述多个组件的名称、高宽和该组件在所述纹理集图片中的相对位置,从所述纹理集图片中剪裁出各所述多个组件,并将裁剪出的各所述多个组件和该组件的名称、高宽共同保存作为所述解析动画数据的第二部分;According to the name, height and width of each of the multiple components in the texture set picture, and the relative position of the component in the texture set picture, each of the multiple components is clipped from the texture set picture, and the Each of the multiple components cut out together with the name, height and width of the component are stored together as the second part of the parsing animation data;
    解析所述动画集文本,从所述动画集文本中获取各所述多个动画的初始信息和各所述多个动画的子信息作为所述解析动画数据的第三部分。The animation set text is parsed, and initial information of each of the multiple animations and sub-information of each of the multiple animations are obtained from the animation set text as the third part of the parsed animation data.
  3. 根据权利要求2所述的方法,其中,各所述多个动画的完整信息包括该动画的初始信息、该动画的子信息和该动画的每一帧的完整信息,The method according to claim 2, wherein the complete information of each of the plurality of animations includes initial information of the animation, sub-information of the animation and complete information of each frame of the animation,
    其中,所述处理所述解析动画数据并生成包含多个动画中的每一个动画的完整信息的动画库的步骤包括:Wherein, the step of processing the parsed animation data and generating an animation library containing complete information of each animation in the plurality of animations includes:
    从所述解析动画数据中提取各所述多个动画的初始信息和该动画的子信息;Extract initial information of each of the plurality of animations and sub-information of the animation from the parsed animation data;
    根据各所述多个动画的初始信息和该动画的子信息计算出各所述多个动画的每一帧的完整信息;Calculate the complete information of each frame of each of the plurality of animations according to the initial information of each of the plurality of animations and the sub-information of the animation;
    分别将各所述多个动画的初始信息、子信息和该动画的每一帧的完整信息组合在一起形成各所述多个动画的完整信息,将所述多个动画的完整信息组合 到一起形成所述动画库。Respectively combining the initial information, sub-information and complete information of each frame of each of the multiple animations to form complete information of each of the multiple animations, and combining the complete information of the multiple animations together The animation library is formed.
  4. 根据权利要求3所述的方法,其中,各所述多个动画的初始信息包括动画集信息、骨骼信息、插槽信息和组件信息,The method according to claim 3, wherein the initial information of each of the plurality of animations includes animation set information, bone information, slot information and component information,
    其中,各所述多个动画的子信息包括该动画的基本信息、骨骼的运动轨迹和插槽的显示轨迹,Wherein, the sub-information of each of the multiple animations includes the basic information of the animation, the movement track of the bones and the display track of the slot,
    其中,所述从所述解析动画数据中提取各所述多个动画的初始信息和该动画的子信息的步骤包括:Wherein, the step of extracting the initial information of each of the multiple animations and the sub-information of the animations from the analysis animation data includes:
    从所述解析动画数据中提取出所述动画集信息、所述骨骼信息、所述插槽信息和所述组件信息;Extracting the animation set information, the bone information, the slot information and the component information from the parsed animation data;
    从所述解析动画数据中提取出各所述多个动画的所述基本信息、所述骨骼的运动轨迹和所述插槽的显示轨迹。The basic information of each of the plurality of animations, the movement track of the bones and the display track of the slot are extracted from the analysis animation data.
  5. 根据权利要求4所述的方法,其中,The method of claim 4, wherein,
    所述骨骼信息包括骨骼父子关系、各所述多个动画中骨骼的初始位置和骨骼缩放大小,The bone information includes the parent-child relationship of the bones, the initial positions of the bones in each of the multiple animations, and the scaling size of the bones,
    所述插槽信息包括插槽父子关系、插槽下组件列表和插槽显示状态,The slot information includes the parent-child relationship of the slot, the component list under the slot and the slot display state,
    所述组件信息包括组件相对于插槽的位置,The component information includes the location of the component relative to the slot,
    各所述多个动画的基本信息包括该动画的总帧数,The basic information of each of the plurality of animations includes the total number of frames of the animation,
    所述骨骼的运动轨迹包括骨骼平移轨迹、包括骨骼的旋转角度在内的骨骼旋转轨迹和骨骼缩放轨迹,The motion track of the bone includes a bone translation track, a bone rotation track including a rotation angle of the bone, and a bone scaling track,
    所述插槽的显示轨迹包括插槽显示轨迹和插槽渐变轨迹,The display track of the slot includes a slot display track and a slot gradient track,
    所述根据各所述多个动画的初始信息和该动画的子信息计算出各所述多个动画的每一帧的完整信息的步骤包括:The step of calculating the complete information of each frame of each of the plurality of animations according to the initial information of each of the plurality of animations and the sub-information of the animations includes:
    对于各所述多个动画,从该动画的所述骨骼信息、所述插槽信息、所述组件信息以及所述骨骼的运动轨迹中提取该动画的初始数据,所述初始数据包括所述骨骼的初始位置、所述骨骼缩放大小、所述骨骼的旋转角度、所述插槽下组件列表和所述组件相对于插槽的位置;For each of the plurality of animations, the initial data of the animation is extracted from the bone information, the slot information, the component information and the motion trajectory of the bone of the animation, where the initial data includes the bone The initial position of the skeleton, the scaling size of the skeleton, the rotation angle of the skeleton, the list of components under the slot, and the position of the component relative to the slot;
    从该动画的基本信息中提取该动画的所述总帧数,创建与所述总帧数长度相同的列表以用于保存该动画的每一帧的完整信息;Extract the total number of frames of the animation from the basic information of the animation, and create a list with the same length as the total number of frames for saving the complete information of each frame of the animation;
    从该动画的所述骨骼的运动轨迹中提取该动画的所述骨骼平移轨迹、所述骨骼旋转轨迹和所述骨骼缩放轨迹,根据所述骨骼平移轨迹、所述骨骼旋转轨迹和所述骨骼缩放轨迹以及所述初始数据中所述骨骼的初始位置、所述骨骼缩放大小和所述骨骼的旋转角度,计算出每一帧中骨骼的位置、旋转角度和实际 大小;Extract the bone translation track, the bone rotation track, and the bone scaling track of the animation from the motion track of the bone of the animation, and scale according to the bone translation track, the bone rotation track, and the bone scaling track and the initial position of the bone in the initial data, the scaling size of the bone and the rotation angle of the bone, calculate the position, rotation angle and actual size of the bone in each frame;
    从该动画的插槽的显示轨迹中提取该动画的插槽显示轨迹,根据所述插槽显示轨迹、所述插槽下组件列表和所述插槽显示状态计算出每一帧中所述插槽是否显示以及显示的插槽下的组件;Extract the slot display track of the animation from the slot display track of the animation, and calculate the slot display track in each frame according to the slot display track, the component list under the slot and the slot display state. Whether the slot is displayed and the components under the displayed slot;
    从该动画的所述插槽的显示轨迹中提取该动画的插槽渐变轨迹,读取所述插槽渐变轨迹中的持续时间、透明度、变化曲线,结合上一帧轨迹结束时的透明度或初始透明度,计算出每一帧中所述插槽的透明度;Extract the slot gradient track of the animation from the display track of the slot of the animation, read the duration, transparency, and change curve in the slot gradient track, and combine the transparency or initial value at the end of the previous frame of the track Transparency, which calculates the transparency of the slot in each frame;
    将计算得到的每一帧中所述骨骼的位置、旋转角度和实际大小、所述插槽是否显示以及显示的插槽下的组件、所述插槽的透明度组合为该动画的每一帧的完整信息保存在所述列表中。The calculated position, rotation angle and actual size of the bone in each frame, whether the slot is displayed, the components under the displayed slot, and the transparency of the slot are combined into the value of each frame of the animation. Complete information is kept in said list.
  6. 根据权利要求5所述的方法,其中,The method of claim 5, wherein,
    根据所述骨骼平移轨迹和所述初始数据中所述骨骼的初始位置计算出每一帧中骨骼的位置,包括:The position of the bone in each frame is calculated according to the bone translation trajectory and the initial position of the bone in the initial data, including:
    根据所述骨骼平移轨迹中x、y轴的相对平移距离、上一帧平移结束后的位置和平移的持续时间,计算出每一帧中所述骨骼的位置,其中,在进行第一帧计算时,以所述骨骼的初始位置作为上一帧平移结束后的位置。The position of the bone in each frame is calculated according to the relative translation distance of the x and y axes in the bone translation track, the position after the last frame of translation ends, and the duration of the translation. , the initial position of the bone is taken as the position after the translation of the previous frame.
  7. 根据权利要求5所述的方法,其中,The method of claim 5, wherein,
    根据所述骨骼旋转轨迹和所述初始数据中所述骨骼的旋转角度计算出每一帧中骨骼的旋转角度,包括:Calculate the rotation angle of the bone in each frame according to the rotation trajectory of the bone and the rotation angle of the bone in the initial data, including:
    根据所述骨骼旋转轨迹中角度变化曲线、上一帧轨迹结束后的旋转角度和旋转的持续时间,计算出每一帧中骨骼的旋转角度,其中,在进行第一帧计算时,以默认为0的骨骼初始旋转角度作为上一帧轨迹结束后的旋转角度。Calculate the rotation angle of the bone in each frame according to the angle change curve in the bone rotation track, the rotation angle after the end of the previous frame of the track, and the duration of the rotation, wherein, when the first frame is calculated, the default is The initial rotation angle of the bone of 0 is used as the rotation angle after the end of the previous frame of the track.
  8. 根据权利要求1所述的方法,其中,所述根据当前场景确定即将播放的目标动画的步骤,包括:The method according to claim 1, wherein the step of determining the target animation to be played according to the current scene comprises:
    当场景发生变化时,判断当前播放的动画是否与变化后的当前场景匹配;When the scene changes, determine whether the currently playing animation matches the current scene after the change;
    若判断当前播放的动画与变化后的当前场景匹配,则继续播放所述当前播放的动画;If it is judged that the currently played animation matches the changed current scene, then continue to play the currently played animation;
    若判断当前播放的动画与变化后的当前场景不匹配,则根据所述当前场景确定与所述当前场景对应的所述目标动画。If it is determined that the currently played animation does not match the changed current scene, the target animation corresponding to the current scene is determined according to the current scene.
  9. 根据权利要求8所述的方法,其中,所述根据所述当前场景确定与所述当前场景对应的所述目标动画的步骤包括:The method according to claim 8, wherein the step of determining the target animation corresponding to the current scene according to the current scene comprises:
    根据预设的场景与动画的对应关系查找出与所述当前场景对应的动画;Find out the animation corresponding to the current scene according to the preset correspondence between the scene and the animation;
    判断所述动画库中是否存在所述与所述当前场景对应的动画;Judging whether the animation corresponding to the current scene exists in the animation library;
    若判断所述动画库中存在所述与所述当前场景对应的动画,则以所述与所述当前场景对应的动画作为所述目标动画;If it is judged that the animation corresponding to the current scene exists in the animation library, the animation corresponding to the current scene is used as the target animation;
    若判断所述动画库中不存在所述与所述当前场景对应的动画,则以默认动画作为所述目标动画。If it is determined that the animation corresponding to the current scene does not exist in the animation library, the default animation is used as the target animation.
  10. 根据权利要求4所述的方法,其中,The method of claim 4, wherein,
    各所述多个动画的基本信息包括该动画的总帧数和设定播放次数,The basic information of each of the plurality of animations includes the total number of frames of the animation and the set playing times,
    所述对所述目标动画的每一帧依次进行渲染,并逐帧播放渲染后的每一帧的步骤包括:The step of rendering each frame of the target animation in turn, and playing each frame after rendering frame by frame includes:
    获取所述目标动画的下一帧的完整信息作为当前帧数据;Obtain the complete information of the next frame of the target animation as the current frame data;
    渲染所述当前帧数据中所述多个组件;rendering the multiple components in the current frame data;
    根据所述目标动画的总帧数判断所述目标动画是否存在下一帧;According to the total number of frames of the target animation, determine whether there is a next frame in the target animation;
    若判断所述目标动画存在下一帧,返回至所述获取所述目标动画的下一帧的完整信息作为当前帧数据的步骤,若判断所述目标动画不存在下一帧,所述目标动画的累计播放次数加1,且将当前播放帧数重置为0;If it is determined that the next frame of the target animation exists, return to the step of obtaining the complete information of the next frame of the target animation as the current frame data; if it is determined that there is no next frame of the target animation, the target animation Add 1 to the cumulative number of playbacks, and reset the current number of playback frames to 0;
    根据所述累计播放次数和所述设定播放次数判断所述目标动画是否播放完毕,若判断所述目标动画播放完毕,则结束播放,若判断所述目标动画未播放完毕,返回至所述获取所述目标动画的下一帧的完整信息作为当前帧数据的步骤。Determine whether the target animation has finished playing according to the cumulative playing times and the set playing times, if it is judged that the target animation has finished playing, end the playing, and if it is judged that the target animation has not finished playing, return to the acquisition The step of taking the complete information of the next frame of the target animation as the data of the current frame.
  11. 根据权利要求2所述的方法,其中,解析所述纹理集文本和解析所述动画集文本并行执行。3. The method of claim 2, wherein parsing the texture set text and parsing the animation set text are performed in parallel.
  12. 根据权利要求4所述的方法,其中,所述动画集信息包括动画集名称、动画的帧率、画布的大小、形象在画布中的初始位置和动画集中的默认动画名称。The method according to claim 4, wherein the animation set information includes the animation set name, the frame rate of the animation, the size of the canvas, the initial position of the avatar in the canvas and the default animation name in the animation set.
  13. 根据权利要求5所述的方法,其中,所述组件信息还包括组件的名称、组件的大小和组件缩放大小。The method of claim 5, wherein the component information further includes a name of the component, a size of the component, and a scaling size of the component.
PCT/CN2021/111678 2021-02-26 2021-08-10 Method for playing system image WO2022179054A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110214929.4A CN112562049B (en) 2021-02-26 2021-02-26 Method for playing system image
CN202110214929.4 2021-02-26

Publications (1)

Publication Number Publication Date
WO2022179054A1 true WO2022179054A1 (en) 2022-09-01

Family

ID=75034800

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/111678 WO2022179054A1 (en) 2021-02-26 2021-08-10 Method for playing system image

Country Status (2)

Country Link
CN (1) CN112562049B (en)
WO (1) WO2022179054A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112562049B (en) * 2021-02-26 2021-05-18 湖北亿咖通科技有限公司 Method for playing system image

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109658484A (en) * 2018-12-21 2019-04-19 上海哔哩哔哩科技有限公司 A kind of Automatic Generation of Computer Animation method and Automatic Generation of Computer Animation system
US20190197754A1 (en) * 2017-12-25 2019-06-27 Alibaba Group Holding Limited Method and Apparatus for Implementing Animation in Client Application and Animation Script Framework
CN111242688A (en) * 2020-01-13 2020-06-05 Oppo广东移动通信有限公司 Animation resource manufacturing method and device, mobile terminal and storage medium
CN111316203A (en) * 2018-07-10 2020-06-19 微软技术许可有限责任公司 Actions for automatically generating a character
CN112235635A (en) * 2019-07-15 2021-01-15 腾讯科技(北京)有限公司 Animation display method, animation display device, electronic equipment and storage medium
CN112562049A (en) * 2021-02-26 2021-03-26 湖北亿咖通科技有限公司 Method for playing system image

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8547396B2 (en) * 2007-02-13 2013-10-01 Jaewoo Jung Systems and methods for generating personalized computer animation using game play data
CN108010112B (en) * 2017-11-28 2023-08-22 腾讯数码(天津)有限公司 Animation processing method, device and storage medium
CN109636884A (en) * 2018-10-25 2019-04-16 阿里巴巴集团控股有限公司 Animation processing method, device and equipment
CN111462287A (en) * 2020-03-31 2020-07-28 网易(杭州)网络有限公司 Data processing method and device for skeleton animation in game and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190197754A1 (en) * 2017-12-25 2019-06-27 Alibaba Group Holding Limited Method and Apparatus for Implementing Animation in Client Application and Animation Script Framework
CN111316203A (en) * 2018-07-10 2020-06-19 微软技术许可有限责任公司 Actions for automatically generating a character
CN109658484A (en) * 2018-12-21 2019-04-19 上海哔哩哔哩科技有限公司 A kind of Automatic Generation of Computer Animation method and Automatic Generation of Computer Animation system
CN112235635A (en) * 2019-07-15 2021-01-15 腾讯科技(北京)有限公司 Animation display method, animation display device, electronic equipment and storage medium
CN111242688A (en) * 2020-01-13 2020-06-05 Oppo广东移动通信有限公司 Animation resource manufacturing method and device, mobile terminal and storage medium
CN112562049A (en) * 2021-02-26 2021-03-26 湖北亿咖通科技有限公司 Method for playing system image

Also Published As

Publication number Publication date
CN112562049B (en) 2021-05-18
CN112562049A (en) 2021-03-26

Similar Documents

Publication Publication Date Title
CN108010112B (en) Animation processing method, device and storage medium
JP7096902B2 (en) Image processing methods, equipment, computer programs and computer devices
US8581911B2 (en) Training system and methods for dynamically injecting expression information into an animated facial mesh
US9665972B2 (en) System for compositing educational video with interactive, dynamically rendered visual aids
KR101101090B1 (en) Creation of game-based scenes
CN107333164B (en) Image data processing method and device
JP5960356B2 (en) Animation reproduction method, apparatus, device, program, and recording medium
US20090262139A1 (en) Video image display device and video image display method
CN109788212A (en) A kind of processing method of segmenting video, device, terminal and storage medium
CN110019866B (en) Dynamic picture playing method, device and storage medium
CN113660528B (en) Video synthesis method and device, electronic equipment and storage medium
US20210166461A1 (en) Avatar animation
CN109325145A (en) Acquisition methods, terminal and the computer readable storage medium of video thumbnails
US20230394735A1 (en) Enhanced animation generation based on video with local phase
WO2022179054A1 (en) Method for playing system image
CN117178557A (en) Method and apparatus for timing and event triggered updating in a scene
CN113411664A (en) Video processing method and device based on sub-application and computer equipment
US10418065B1 (en) Intellimark customizations for media content streaming and sharing
US20130187927A1 (en) Method and System for Automated Production of Audiovisual Animations
US20050021552A1 (en) Video playback image processing
CN114331808A (en) Action posture storage method, device, medium and electronic equipment
Elliott et al. A framework for non-manual gestures in a synthetic signing system
US9396573B2 (en) Image generating device, image generating method, and information storage medium
US8773441B2 (en) System and method for conforming an animated camera to an editorial cut
CN112752146A (en) Video quality evaluation method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21927483

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21927483

Country of ref document: EP

Kind code of ref document: A1