CN117193910A - Frame animation processing method and device, electronic equipment and storage medium - Google Patents

Frame animation processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117193910A
CN117193910A CN202311104807.5A CN202311104807A CN117193910A CN 117193910 A CN117193910 A CN 117193910A CN 202311104807 A CN202311104807 A CN 202311104807A CN 117193910 A CN117193910 A CN 117193910A
Authority
CN
China
Prior art keywords
frame
view component
dynamic view
frame animation
image
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202311104807.5A
Other languages
Chinese (zh)
Inventor
李静
肖涵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Great Wall Motor Co Ltd
Original Assignee
Great Wall Motor Co Ltd
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 Great Wall Motor Co Ltd filed Critical Great Wall Motor Co Ltd
Priority to CN202311104807.5A priority Critical patent/CN117193910A/en
Publication of CN117193910A publication Critical patent/CN117193910A/en
Pending legal-status Critical Current

Links

Abstract

The application provides a frame animation processing method, a device, an electronic device and a storage medium, wherein the method comprises the following steps: setting the display content of the dynamic view component as a target image; the target image is a first frame image of a static image or a frame animation; the dynamic view component operates in a non-main thread; and when a trigger event of playing the frame animation is received, switching from a static image to the frame animation, and switching the display content of the dynamic view component from the static image to a sequence frame image of the frame animation or from a first frame image of the frame animation to the rest sequence frame images of the frame animation. The method can avoid the problem of blocking or flickering when the static image is switched to the frame animation, and improves the user experience.

Description

Frame animation processing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technology, and more particularly, to a frame animation processing method, apparatus, electronic device, and storage medium in the field of computer technology.
Background
In the application development on the Android platform, there are many scenes in which a static image needs to be displayed at first, and then a frame animation needs to be played at a certain time. Frame animation is a common animation effect, and a series of pictures are displayed frame by frame to simulate the animation effect, however, due to the fact that a great amount of picture resources need to be traversed and analyzed in the playing process of the frame animation, a situation of blocking or flashing occurs when switching from a static picture to the frame animation.
Disclosure of Invention
The application provides a frame animation processing method, a frame animation processing device, electronic equipment and a storage medium. The technical scheme is as follows:
in a first aspect, a frame animation processing method is provided, the method including:
setting the display content of the dynamic view component as a static image; the dynamic view component operates in a non-main thread;
and when a trigger event for playing the frame animation is received, switching the display content of the dynamic view component from the static image to a sequence frame image of the frame animation.
With reference to the first aspect, in some possible implementation manners, when the trigger event of playing the frame animation is received, switching the display content of the dynamic view component from the static image to a sequence frame image of the frame animation includes:
when a trigger event for playing the frame animation is received, traversing and analyzing a sequence frame image of the frame animation through the dynamic view component;
switching the display content of the dynamic view component from the static image to a sequence frame image of the frame animation; and rendering and displaying the sequence frame images of the frame animation on the dynamic view component frame by frame.
In a second aspect, there is provided a frame animation processing method, the method comprising:
setting the display content of the static view component as a static image;
setting the display content of the dynamic view component as a first frame image of a frame animation; the dynamic view component operates in a non-main thread;
when a trigger event of playing frame animation is received, switching the display state of the static view component from a visible state to a hidden state, and switching the display state of the dynamic view component from the hidden state to the visible state;
and switching the display content of the dynamic view component from the first frame image of the frame animation to the rest sequence frame images of the frame animation.
With reference to the second aspect, in some possible implementations, the setting the display content of the dynamic view component to be the first frame image of the frame animation includes:
acquiring a first frame image of the frame animation;
after the initialization of the rendering unit in the dynamic view component is completed, the display content of the dynamic view component is set as a first frame image of the frame animation, and the display state of the dynamic view component is set as a hidden state.
With reference to the second aspect and the foregoing implementation manner, in some possible implementation manners, before setting the display content of the dynamic view component to the first frame image of the frame animation, the method includes:
Creating a dynamic view component;
setting the display state of the dynamic view component to a visible state to create and initialize a rendering unit in the dynamic view component.
With reference to the second aspect and the foregoing implementation manner, in some possible implementation manners, the switching the display content of the dynamic view component from the first frame image of the frame animation to the rest sequence frame images of the frame animation includes:
traversing and analyzing the rest sequence frame images of the frame animation through the dynamic view component;
switching the display content of the dynamic view component from a first frame image of the frame animation to the rest sequence frame images of the frame animation; and rendering and displaying the rest sequence frame images of the frame animation on the dynamic view component frame by frame.
In a third aspect, there is provided a frame animation processing apparatus comprising:
the first preset module is used for setting the display content of the dynamic view component into a static image; the dynamic view component operates in a non-main thread;
and the first switching module is used for switching the display content of the dynamic view component from the static image to the sequence frame image of the frame animation when receiving a trigger event for playing the frame animation.
With reference to the third aspect, in some possible implementations, the first switching module is specifically configured to:
when a trigger event for playing the frame animation is received, traversing and analyzing a sequence frame image of the frame animation through the dynamic view component;
switching the display content of the dynamic view component from the static image to a sequence frame image of the frame animation; and rendering and displaying the sequence frame images of the frame animation on the dynamic view component frame by frame.
In a fourth aspect, there is provided a frame animation processing apparatus comprising:
the second preset module is used for setting the display content of the static view component into a static image;
the third preset module is used for setting the display content of the dynamic view component as a first frame image of the frame animation; the dynamic view component operates in a non-main thread;
the second switching module is used for switching the display state of the static view component from a visible state to a hidden state and switching the display state of the dynamic view component from the hidden state to the visible state when receiving a trigger event for playing the frame animation;
and a third switching module, configured to switch the display content of the dynamic view component from the first frame image of the frame animation to the rest sequence frame images of the frame animation.
With reference to the fourth aspect, in some possible implementations, the third preset module is specifically configured to:
acquiring a first frame image of the frame animation;
after the initialization of the rendering unit in the dynamic view component is completed, the display content of the dynamic view component is set as a first frame image of the frame animation, and the display state of the dynamic view component is set as a hidden state.
With reference to the fourth aspect and the foregoing implementation manner, in some possible implementation manners, the apparatus further includes an initialization module, configured to:
creating a dynamic view component;
setting the display state of the dynamic view component to a visible state to create and initialize a rendering unit in the dynamic view component.
With reference to the fourth aspect and the foregoing implementation manner, in some possible implementation manners, the foregoing third switching module is specifically configured to:
traversing and analyzing the rest sequence frame images of the frame animation through the dynamic view component;
switching the display content of the dynamic view component from a first frame image of the frame animation to the rest sequence frame images of the frame animation; and rendering and displaying the rest sequence frame images of the frame animation on the dynamic view component frame by frame.
In a fifth aspect, an electronic device is provided that includes a memory and a processor. The memory is configured to store executable program code, and the processor is configured to invoke and run the executable program code from the memory such that the electronic device performs the method of the first aspect or any of the possible implementations of the second aspect or the second aspect.
In a sixth aspect, there is provided a computer program product comprising: computer program code which, when run on a computer, causes the computer to perform the method of any one of the possible implementations of the first aspect or the second aspect or any one of the possible implementations of the second aspect.
In a seventh aspect, a computer readable storage medium is provided, the computer readable storage medium storing computer program code which, when run on a computer, causes the computer to perform the method of the first aspect or any one of the possible implementations of the second aspect.
In summary, in the technical scheme of the application, the display content of the dynamic view component is set as a first frame image of a static image or a frame animation; the dynamic view component operates in a non-main thread; when a trigger event of playing the frame animation is received, the display content of the dynamic view component is switched from the static image to the sequence frame image of the frame animation or from the first frame image of the frame animation to the rest sequence frame images of the frame animation. The method can smoothly realize the switching from the static image to the frame animation, avoids the problem of jamming or flickering in the switching process, and the dynamic view component operates in the non-main thread to lighten the burden of the main thread, improve the response speed and the smoothness, avoid the jamming of the frame animation, and improve the user experience.
Drawings
FIG. 1 is a schematic variation diagram of a view component switching from a still image to a frame animation provided by an embodiment of the present application;
FIG. 2 is a schematic flow chart of a frame animation processing method according to an embodiment of the present application;
FIG. 3 is a schematic flow chart of a frame animation processing method according to an embodiment of the present application;
FIG. 4 is a schematic variation diagram of a view component switching from a still image to a frame animation provided by an embodiment of the present application;
FIG. 5 is a schematic flow chart of a frame animation processing method according to an embodiment of the present application;
FIG. 6 is a schematic variation of a view component creation process provided by an embodiment of the present application;
FIG. 7 is a schematic variation diagram of a switching process of a view component provided by an embodiment of the present application;
fig. 8 is a schematic structural diagram of a frame animation processing device according to an embodiment of the present application;
fig. 9 is a schematic diagram of a frame animation processing device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical scheme of the application will be clearly and thoroughly described below with reference to the accompanying drawings. Wherein, in the description of the embodiments of the present application, unless otherwise indicated, "/" means or, for example, a/B may represent a or B: the text "and/or" is merely an association relation describing the associated object, and indicates that three relations may exist, for example, a and/or B may indicate: the three cases where a exists alone, a and B exist together, and B exists alone, and furthermore, in the description of the embodiments of the present application, "plural" means two or more than two.
The terms "first," "second," and the like, are used below for descriptive purposes only and are not to be construed as implying or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature.
The embodiment of the application provides a frame animation processing method. The method may be implemented in dependence on a computer program, and may be run on a frame animation processing device or system based on von neumann systems. The computer program may be integrated in the application or may run as a stand-alone tool class application. The frame animation processing device may be a terminal device including, but not limited to: personal computers, tablet computers, handheld devices, vehicle mounted devices, wearable devices, computing devices, or other processing devices connected to a wireless modem, and the like.
In the process of developing or using an application program by an Android platform, a plurality of scenes initially show a static image, then a section of frame animation needs to be played at a certain time, and as a great deal of picture resources need to be traversed and analyzed in the playing process of the frame animation, if a common View (an entity of a visual UI component in Android) is used for drawing the frame animation in a main thread (a UI thread), the clamping may occur. Therefore, the frame animation can be played by adopting a non-main thread view component, for example, the frame animation is played by using TextureView, which is a special view component in Android and is used for asynchronous rendering surface, the frame animation can be rendered in the non-main thread, the main thread is not occupied, and the clamping is avoided.
As shown in FIG. 1, in some embodiments, the still image 111 may be presented using a common View (i.e., the still View 110 of FIG. 1), the frame animation 121 may be played using a textureView (i.e., the dynamic View 120 of FIG. 1), and upon switching the still image 111 to the frame animation 121, this may be accomplished by hiding the still View 110 and displaying the dynamic View 120. Since a certain time is required for the steps of analyzing the frame animation image by the dynamic view 120 after the dynamic view 120 is displayed, the display content cannot be drawn in time, so that the display content is empty. Thus, immediately after the static view 110 is hidden, the dynamic view 120 is shown without the display, and the first frame image of the frame animation 121, which is then played, causes the user to visually see the flicker.
Therefore, the embodiment of the application provides a frame animation processing method, which can further avoid the problem of blocking or flickering when a static image is switched to a frame animation. Fig. 2 is a schematic flowchart of a frame animation processing method according to an embodiment of the present application, as shown in fig. 2, where the method includes:
s201, setting the display content of the dynamic view component as a target image.
Specifically, the dynamic view component refers to a view component for playing frame animation in this embodiment, which is a view component running on a non-main thread, for example TextureView in Android, and may be used for rendering and displaying complex graphic content, such as displaying images or playing frame animation. Since the dynamic view component operates on the non-main thread (UI thread), playing of the frame animation by using the dynamic view component does not interfere with the operation of the main thread, and is beneficial to improving the smoothness of the application.
The target image may be a still image or a first frame image of a frame animation. When the display content of the dynamic view component is set to be a still image, the still image is displayed by the dynamic view component, that is, the still image and the frame animation are displayed using the same view component. When the display content of the dynamic view component is set as the first frame image of the frame animation, the still image may be displayed by the still view component (other view component), i.e., the still image and the frame animation are displayed using different view components.
It should be noted that, in this embodiment, the display content of the dynamic view component needs to be set before the frame animation is played, so that the dynamic view component loads and displays an image in advance, and a blank image is not displayed when the frame animation needs to be played.
S202, when a trigger event for playing the frame animation is received, the display content of the dynamic view component is switched from a target image to a sequence frame image of the frame animation.
Specifically, when a trigger event for playing a frame animation is received, switching from a still image to a frame animation is started. The triggering event may be some kind of signal or command, such as an interactive operation (e.g. clicking a button) from a user, some logical judgment of the program, a notification of the system, etc. The trigger event is used to inform the system of the opportunity to switch the static view to the frame animation, so that the dynamic view component starts playing the frame animation.
In this embodiment, the system can only receive the trigger event to play the frame animation after the user interface displays the still image. For example, in a vehicle condition monitoring or dashboard application, when the system detects that a portion of the vehicle needs to be inspected or serviced, a static image of the portion is first presented, and after the static image appears, the user can click on the static image (trigger event) to trigger presentation of a more detailed frame animation to explain the problem details.
When the displayed target image of the dynamic view component is a static image, the whole process of switching from the static image to the frame animation is carried out in the same view component (dynamic view component), the switching between two different view components is not needed, the switching transition is very smooth, a user does not feel any incongruity or flickering when observing, and the whole visual experience is enhanced.
When the displayed target image of the dynamic view component is the first frame image of the frame animation, the static image is displayed by the static view component, and when the static image is switched to the frame animation, the static view component needs to be switched between different view components, namely the static view component needs to be hidden and the dynamic view component needs to be displayed. Because the dynamic view component pre-displays the first frame image of the frame animation before the switching process is executed, even if the time for initializing or resolving and rendering the frame animation by the dynamic view component is long, the dynamic view component does not display blank content. Therefore, when the static view component is switched to the dynamic view component, the first frame image of the frame animation can be directly seen, then the sequential frame images of the frame animation are continuously played frame by frame, the user does not feel any inconclusion or flickering when observing, and the whole visual experience is enhanced.
The sequence frame images of the frame animation are a series of frame images (static images) for forming the animation, and the frame images are displayed one by one according to a specific sequence and a specific speed, so that the animation effect is shown.
In the technical scheme of the application, the display content of the dynamic view component is set as a target image; the dynamic view component runs in a non-main thread, and the target image is a static image or a first frame image of a frame animation; when a trigger event of playing the frame animation is received, switching from a static image to the frame animation is carried out, and the display content of the dynamic view component is switched from the target image to a sequence frame image of the frame animation displayed frame by frame. The method can smoothly realize the switching from the static image to the frame animation, avoids the problem of jamming or flickering in the switching process, and the dynamic view component operates in the non-main thread to lighten the burden of the main thread, improve the response speed and the smoothness, avoid the jamming of the frame animation, and improve the user experience.
Fig. 3 is a schematic flowchart of a frame animation processing method according to an embodiment of the present application, as shown in fig. 3, where the method includes:
s301, setting the display content of the dynamic view component as a static image.
Specifically, the dynamic view component refers to a view component for playing frame animation in this embodiment, and is a view component running on a non-main thread, such as TextureView in Android. In this embodiment, when a still image needs to be displayed, the display content of the dynamic view component may be directly set as a still image, and when a frame animation needs to be displayed, the display content is replaced, so that the still image and the frame animation are displayed by using the same view component.
It should be noted that, in this embodiment, the frame animation is played after the still image is displayed, so the still image needs to be set as the display content of the dynamic view component before the frame animation is played, so as to meet the requirement of displaying the still image in the application scene. In particular, a dynamic view component may be created and display content may be set when a user interface, i.e., an interface used to present still images and frame animations, is first presented.
S302, when a trigger event for playing the frame animation is received, the display content of the dynamic view component is switched from a static image to a sequence frame image of the frame animation.
Specifically, when the system receives a trigger event for playing the frame animation, the switching from the still image to the frame animation is started. The dynamic view component traverses and analyzes the sequence frame images of the frame animation, and then switches the display content of the dynamic view component from a static image to the sequence frame images of the frame animation, and the sequence frame images of the frame animation can be rendered and displayed on the dynamic view component frame by frame.
Illustratively, as shown in FIG. 4, the presentation of the still image 411 and the play of the frame animation 412 are presented by a TextureView (i.e., the dynamic view component 410 of FIG. 4). When the still image 411 needs to be displayed, one still image 411 is put into TextureView, and set to display content. When the frame animation 412 needs to be switched, the sequence frame images of the frame animation 412 are traversed and analyzed, the first frame image of the frame animation 412 is rendered and the static image 411 in the TextureView is replaced for display, and then the sequence frame images of the frame animation 412 are sequentially rendered and displayed frame by frame, for example, the second frame image of the frame animation 412 is rendered and the first frame image in the TextureView is replaced for display, and the third frame image of the frame animation 412 is rendered and the second frame image in the TextureView is replaced for display … ….
Note that textview renders and displays content in Android through surface texture, which can be regarded as a sub-component (rendering unit) inside the textview component. Specifically, surface texture is a surface that contains textures that can be used to render images generated by OpenGL ES and other hardware accelerated APIs, while textureView provides a way to display such content in the conventional view hierarchy. Under conventional usage scenarios, content (e.g., video streams or 3D graphics) may be rendered onto surface text, which is then displayed in an application interface through an associated textureView.
In the technical scheme of the application, the display content of the dynamic view component is set as a static image; the dynamic view component operates in a non-main thread; when a trigger event of playing the frame animation is received, switching from the static image to the frame animation is carried out, and the display content of the dynamic view component is switched from the static image to a sequence frame image of the frame animation. According to the method, the static image and the frame animation are displayed by using the same dynamic view component, so that the switching from the static image to the frame animation can be smoothly realized, the problem of blocking or flickering in the switching process is avoided, the dynamic view component operates in a non-main thread, the burden of the main thread can be reduced, the response speed and the smoothness are improved, and the user experience is improved.
Fig. 5 is a schematic flowchart of a frame animation processing method according to an embodiment of the present application, as shown in fig. 5, where the method includes:
s501, the display content of the static view component is set as a static image.
Specifically, the static view component is used for displaying a fixed image content, the display content of the static view component can be set to be a static image to be displayed, and the static view component can use a common view component, such as ImageView.
In this embodiment, the frame animation is played after the still image is displayed, so the still image needs to be set as the display content of the still view component before the frame animation is played, so as to meet the requirement of displaying the still image in the application scene. Specifically, a static view component may be created and display content may be set when a user interface, i.e., an interface used to present static images and frame animations, is first presented.
S502, setting the display content of the dynamic view component as a first frame image of a frame animation.
Specifically, the dynamic view component is used for playing frame animation, can be used for displaying a series of sequential frame images to form an animation effect, and can realize rich visual effects in a frame-by-frame rendering mode. The dynamic view component may use a view component that runs in a non-main thread, such as TextureView.
In this embodiment, the first frame image of the frame animation needs to be set as the display content of the dynamic view component before the dynamic view component plays the frame animation, so that the dynamic view component loads the first frame image of the frame animation in advance, and a blank image is not displayed when the frame animation needs to be played. Specifically, since the system can only receive the trigger event of playing the frame animation after the static image is displayed by the user interface, when the display content of the static view component is set as the static image, the display content of the dynamic view component is set as the first frame image of the frame animation at the same time, so as to avoid the situation that the display content of the dynamic view component is not set when the trigger event of playing the frame animation is received.
For example, after the application is started, entering a user interface, creating a static view component in the user interface, and setting a specified static image as the display content of the static view component; meanwhile, a dynamic view component is created in the user interface, and a first frame image of the frame animation is set as display content of the dynamic view component.
It should be noted that while the above description distinguishes the two view components as "static" and "dynamic", this is custom defined from a functional and usage perspective of the present embodiment. In actual practice, many view components may be provided with the ability to present static and/or dynamic content, and the choice of which component to use may depend on the particular needs. In the embodiment of the present application, the naming of the view components is only convenient for description and distinction, and is not particularly limited.
In some embodiments, the setting the display content of the dynamic view component to be the first frame image of the frame animation includes: acquiring a first frame image of the frame animation; after the initialization of the rendering unit in the dynamic view component is completed, the display content of the dynamic view component is set as a first frame image of the frame animation, and the display state of the dynamic view component is set as a hidden state.
Specifically, after the dynamic view component is created, the display content is blank, and when the dynamic view component does not play the frame animation, an initial display image is set, so that the dynamic view component does not display blank content in the process of switching from the static view component to the dynamic view component for display, and the flicker phenomenon can be avoided. The initial display image is set as the first frame image of the frame animation, whereby the frame animation is replaced from the initial display image to other sequence frame images of the frame animation at the time of playing the frame animation, without giving rise to a sense of incongruity and a sense of jumping.
If the first frame image of the frame animation is preset on the dynamic view component to be displayed, a rendering unit in the dynamic view component needs to be created and initialized, and the image can be rendered only after the initialization of the rendering unit is completed, so that the image is displayed on the dynamic view component.
In some embodiments, before setting the display content of the dynamic view component to the first frame image of the frame animation, the method includes: creating a dynamic view component; setting the display state of the dynamic view component to a visible state to create and initialize a rendering unit in the dynamic view component.
Specifically, after the dynamic view component is created, the rendering units in the dynamic view component are not necessarily created and initialized immediately, and only after the display state of the dynamic view component is set to the visible state, the creation and initialization processes of the rendering units are triggered.
Illustratively, in Android, the visibility attribute of View may be set by the setVisibility (int visibility) method, which may be expressed using one of three constants:
view. VISIBLE: the view is visible.
View. INVISIBLE: the view is not visible (hidden) but still occupies space in the layout.
View. Go: the view is not visible (hidden) and does not occupy space in the layout.
The dynamic view component is exemplified by TextureView, the content of which is rendered onto a surface texture, which is created and initialized only when the TextureView is visible (i.e., the visibility attribute of the view is view. Visible), so that the dynamic view component should be set to a visible state even though the content in the dynamic view component does not need to be displayed.
It should be noted that when both the static view component and the dynamic view component are set to the visible state, since the dynamic view component (e.g., textureView) initial state does not display content (does not render any image onto its SurfaceTexture), it may be completely transparent and thus does not obscure or interfere with the display of the static view component even in the "visible" state. In addition, in some embodiments, the problem that the display contents of the static view component and the dynamic view component interfere with each other can be avoided by controlling the hierarchical structure or transparency attribute of the static view component and the dynamic view component through a hierarchical management or transparency management mode and the like.
Before receiving the trigger event of playing the frame animation, the system needs to display the static image without playing the frame animation, and when the display content of the dynamic view component is set to be the first frame image of the frame animation, the display state of the dynamic view component needs to be set to be a hidden state so as to avoid interference with the display of the static image by the static view component.
Illustratively, as shown in FIG. 6, at the interface presentation, a static view component 610 is created to put a static image 611 and then set to a visible state. The dynamic view component 620 (TextureView) is created at the same time as the static view component 610, but the content of TextureView needs to be rendered onto a surface texture. Whereas initialization of surface texture is a time consuming process, surface texture is created and initialized only when the TextureView is visible. After the surface texture initialization is complete, the Android system will notify the developer that the surface texture is ready through onsurface texture available callback. Thus, although the dynamic view component 620 may not need to be displayed initially, in order to ensure smooth playback of the frame animation, it is still necessary to set TextureView to visible, wait for notification of the system feedback onSurfaceTextureAvailable, then set the first frame image 621 of the frame animation into TextureView, and then hide TextureView after setting the first frame image 621 of the frame animation.
S503, when a trigger event of playing the frame animation is received, the display state of the static view component is switched from the visible state to the hidden state, and the display state of the dynamic view component is switched from the hidden state to the visible state.
Specifically, as shown in fig. 7, when the system receives a trigger event for playing a frame animation, it indicates that the interface needs to switch from displaying the still image 711 to playing the frame animation 721; the display state of the static view component 710 may be switched from the visible state to the hidden state and the display state of the dynamic view component 720 may be switched from the hidden state to the visible state to effect a switch from exposing the static view component 710 to exposing the dynamic view component 720. Since the dynamic view component 720 has preloaded the first frame image of one frame animation 721 after creation, it displays non-blank content, and the user does not observe the flicker phenomenon during the above-described view component switching process.
S504, switching the display content of the dynamic view component from the first frame image of the frame animation to the rest sequence frame images of the frame animation.
Specifically, when a trigger event for playing the frame animation is received, the display state of the dynamic view component is switched from a hidden state to a visible state, and the dynamic view component starts to traverse and analyze the rest sequence frame images of the frame animation; and switching the display content of the dynamic view component from the first frame image of the frame animation to the rest sequence frame images of the frame animation. The remaining sequence of frame images of the frame animation refer to all sequence of frame images except the first frame image of the frame animation, and can be rendered and displayed on the dynamic view component frame by frame.
When the system receives a trigger event for playing the frame animation and the display state of the dynamic view component is switched to a visible state, the system indicates that the frame animation needs to be played now, and the dynamic view component firstly traverses and analyzes the sequence frame images of the frame animation. I.e., each frame of the frame animation is read and parsed as necessary, which may involve format conversion, scaling or other preprocessing steps to ensure that each frame of image is properly displayed.
Since the dynamic view component has set the first frame image of the frame animation as the initial display content, it is possible to parse only the remaining sequence of frame images except for the first frame, then render the remaining sequence of frame images of the frame animation frame by frame, and sequentially display the remaining frames at a specific rate (e.g., 30 frames/second). The rendering process may involve a process step of converting each frame image from its original format to a format that can be displayed directly on the screen, and a frame may be rendered for display, with the display being replaced in turn, until the animation of the frame is complete.
In the technical scheme of the application, the display content of the static view component is set as a static image; setting the display content of the dynamic view component as a first frame image of a frame animation; the dynamic view component operates in a non-main thread; when a trigger event of playing frame animation is received, switching the display state of the static view component from a visible state to a hidden state, and switching the display state of the dynamic view component from the hidden state to the visible state; and switching the display content of the dynamic view component from the first frame image of the frame animation to the rest sequence frame images of the frame animation. According to the method, the first frame image of the frame animation is preloaded before the dynamic view component is switched, blank contents are not generated in the process of switching from the static view to the dynamic view component, the first frame image of the frame animation can be smoothly transited to the display of the rest sequence frame images, the switching is continuous and seamless, the problem of blocking or flickering in the switching process is avoided, the dynamic view component operates in a non-main thread, the burden of the main thread can be reduced, the response speed and the smoothness are improved, and the user experience is improved.
Fig. 8 is a schematic structural diagram of a frame animation processing device according to an embodiment of the present application.
Illustratively, as shown in FIG. 8, the apparatus 800 includes:
a first preset module 810, configured to set the display content of the dynamic view component to be a still image; the dynamic view component operates in a non-main thread;
the first switching module 820 is configured to switch the display content of the dynamic view component from the still image to the sequential frame image of the frame animation when receiving a trigger event for playing the frame animation.
In some embodiments, the first switching module 820 is specifically configured to:
when a trigger event for playing the frame animation is received, traversing and analyzing a sequence frame image of the frame animation through the dynamic view component;
switching the display content of the dynamic view component from the static image to a sequence frame image of the frame animation; and rendering and displaying the sequence frame images of the frame animation on the dynamic view component frame by frame.
In the technical scheme of the application, the display content of the dynamic view component is set as a static image; the dynamic view component operates in a non-main thread; when a trigger event of playing the frame animation is received, switching from the static image to the frame animation is carried out, and the display content of the dynamic view component is switched from the static image to a sequence frame image of the frame animation. According to the method, the static image and the frame animation are displayed by using the same dynamic view component, so that the switching from the static image to the frame animation can be smoothly realized, the problem of blocking or flickering in the switching process is avoided, the dynamic view component operates in a non-main thread, the burden of the main thread can be reduced, the response speed and the smoothness are improved, and the user experience is improved.
Fig. 9 is a schematic structural diagram of a frame animation processing device according to an embodiment of the present application.
Illustratively, as shown in FIG. 9, the apparatus 900 includes:
a second preset module 910, configured to set the display content of the static view component to be a static image;
a third preset module 920, configured to set the display content of the dynamic view component to be a first frame image of a frame animation; the dynamic view component operates in a non-main thread;
the second switching module 930 is configured to switch the display state of the static view component from a visible state to a hidden state and switch the display state of the dynamic view component from the hidden state to the visible state when receiving a trigger event for playing the frame animation;
and a third switching module 940, configured to switch the display content of the dynamic view component from the first frame image of the frame animation to the rest sequence frame images of the frame animation.
In some embodiments, the third preset module 920 is specifically configured to:
acquiring a first frame image of the frame animation;
after the initialization of the rendering unit in the dynamic view component is completed, setting the display content of the dynamic view component as a first frame image of the frame animation;
And setting the display state of the dynamic view component to be a hidden state.
In some embodiments, the apparatus further comprises an initialization module for:
creating a dynamic view component;
setting the display state of the dynamic view component to a visible state to create and initialize a rendering unit in the dynamic view component.
In some embodiments, the third switching module 940 is specifically configured to:
traversing and analyzing the rest sequence frame images of the frame animation through the dynamic view component;
switching the display content of the dynamic view component from a first frame image of the frame animation to the rest sequence frame images of the frame animation; and rendering and displaying the rest sequence frame images of the frame animation on the dynamic view component frame by frame.
In the technical scheme of the application, the display content of the static view component is set as a static image; setting the display content of the dynamic view component as a first frame image of a frame animation; the dynamic view component operates in a non-main thread; when a trigger event of playing frame animation is received, switching the display state of the static view component from a visible state to a hidden state, and switching the display state of the dynamic view component from the hidden state to the visible state; and switching the display content of the dynamic view component from the first frame image of the frame animation to the rest sequence frame images of the frame animation. According to the method, the first frame image of the frame animation is preloaded before the dynamic view component is switched, blank contents are not generated in the process of switching from the static view to the dynamic view component, the first frame image of the frame animation can be smoothly transited to the display of the rest sequence frame images, the switching is continuous and seamless, the problem of blocking or flickering in the switching process is avoided, the dynamic view component operates in a non-main thread, the burden of the main thread can be reduced, the response speed and the smoothness are improved, and the user experience is improved.
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Illustratively, as shown in FIG. 10, the electronic device 1000 includes: a memory 1010 and a processor 1020, wherein the memory 1010 stores executable program code 1011, and the processor 1020 is configured to invoke and execute the executable program code 1011 to perform a frame animation processing method.
In this embodiment, the electronic device may be divided into functional modules according to the above method example, for example, each functional module may be corresponding to one processing module, or two or more functions may be integrated into one processing module, where the integrated modules may be implemented in a hardware form. It should be noted that, in this embodiment, the division of the modules is schematic, only one logic function is divided, and another division manner may be implemented in actual implementation.
In the case of dividing each function module with corresponding each function, the electronic device may include: a preset module, a first switching module, etc. It should be noted that, all relevant contents of each step related to the above method embodiment may be cited to the functional description of the corresponding functional module, which is not described herein.
The electronic device provided in this embodiment is configured to perform the frame animation processing method described above, so that the same effects as those of the implementation method described above can be achieved.
In case an integrated unit is employed, the electronic device may comprise a processing module, a memory module. The processing module can be used for controlling and managing the actions of the electronic equipment. The memory module may be used to support the electronic device in executing associated program code and data, etc.
Wherein the processing module may be a processor or controller that may implement or execute the various exemplary logic blocks, modules and circuits described in connection with the present disclosure. A processor may also be a combination of computing functions, e.g., including one or more microprocessors, digital signal processing (digital signal processing, DSP) and microprocessor combinations, etc., and a memory module may be a memory.
The present embodiment also provides a computer-readable storage medium having stored therein computer program code which, when run on a computer, causes the computer to perform the above-described related method steps to implement a frame animation processing method in the above-described embodiments.
The present embodiment also provides a computer program product which, when run on a computer, causes the computer to perform the above-described related steps to implement a frame animation processing method in the above-described embodiments.
In addition, the electronic device provided by the embodiment of the application can be a chip, a component or a module, and the electronic device can comprise a processor and a memory which are connected; the memory is used for storing instructions, and when the electronic device runs, the processor can call and execute the instructions to enable the chip to execute the frame animation processing method in the embodiment.
The electronic device, the computer readable storage medium, the computer program product or the chip provided in this embodiment are used to execute the corresponding method provided above, so that the beneficial effects thereof can be referred to the beneficial effects in the corresponding method provided above, and will not be described herein.
It will be appreciated by those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative; for example, the division of modules or units is only one logic function division, and other division modes can be adopted in actual implementation; for example, multiple units or components may be combined or may be integrated into another device, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices, or units, which may be in electrical, mechanical, or other forms.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (10)

1. A frame animation processing method, the method comprising:
Setting the display content of the dynamic view component as a static image; the dynamic view component operates in a non-main thread;
and when a trigger event for playing the frame animation is received, switching the display content of the dynamic view component from the static image to a sequence frame image of the frame animation.
2. The method of claim 1, wherein switching the display content of the dynamic view component from the still image to a sequence of frame images of the frame animation upon receipt of the trigger event to play the frame animation comprises:
when a trigger event for playing the frame animation is received, traversing and analyzing a sequence frame image of the frame animation through the dynamic view component;
switching the display content of the dynamic view component from the static image to a sequence frame image of the frame animation; and rendering and displaying the sequence frame images of the frame animation on the dynamic view component frame by frame.
3. A frame animation processing method, the method comprising:
setting the display content of the static view component as a static image;
setting the display content of the dynamic view component as a first frame image of a frame animation; the dynamic view component operates in a non-main thread;
When a trigger event of playing frame animation is received, switching the display state of the static view component from a visible state to a hidden state, and switching the display state of the dynamic view component from the hidden state to the visible state;
and switching the display content of the dynamic view component from the first frame image of the frame animation to the rest sequence frame images of the frame animation.
4. A method according to claim 3, wherein said setting the display content of the dynamic view component to the first frame image of the frame animation comprises:
acquiring a first frame image of the frame animation;
after the initialization of the rendering unit in the dynamic view component is completed, the display content of the dynamic view component is set to be the first frame image of the frame animation, and the display state of the dynamic view component is set to be a hidden state.
5. The method of claim 4, wherein before setting the display content of the dynamic view component to the first frame image of the frame animation, the method comprises:
creating a dynamic view component;
the display state of the dynamic view component is set to a visible state to create and initialize a rendering unit in the dynamic view component.
6. A method according to claim 3, wherein said switching the display content of the dynamic view component from a first frame image of the frame animation to the remaining sequence of frame images of the frame animation comprises:
traversing and analyzing the rest sequence frame images of the frame animation through the dynamic view component;
switching the display content of the dynamic view component from a first frame image of the frame animation to the rest sequence frame images of the frame animation; the rest sequence frame images of the frame animation are rendered and displayed on the dynamic view component frame by frame.
7. A frame animation processing device, the device comprising:
the first preset module is used for setting the display content of the dynamic view component into a static image; the dynamic view component operates in a non-main thread;
and the first switching module is used for switching the display content of the dynamic view component from the static image to the sequence frame image of the frame animation when receiving a trigger event for playing the frame animation.
8. A frame animation processing device, the device comprising:
the second preset module is used for setting the display content of the static view component into a static image;
The third preset module is used for setting the display content of the dynamic view component as a first frame image of the frame animation; the dynamic view component operates in a non-main thread;
the second switching module is used for switching the display state of the static view component from a visible state to a hidden state and switching the display state of the dynamic view component from the hidden state to the visible state when receiving a trigger event for playing the frame animation;
and the third switching module is used for switching the display content of the dynamic view component from the first frame image of the frame animation to the rest sequence frame images of the frame animation.
9. An electronic device, the electronic device comprising:
a memory for storing executable program code;
a processor for calling and running the executable program code from the memory, causing the electronic device to perform the method of any one of claims 1 to 6.
10. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program which, when executed, implements the method according to any of claims 1 to 6.
CN202311104807.5A 2023-08-30 2023-08-30 Frame animation processing method and device, electronic equipment and storage medium Pending CN117193910A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311104807.5A CN117193910A (en) 2023-08-30 2023-08-30 Frame animation processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311104807.5A CN117193910A (en) 2023-08-30 2023-08-30 Frame animation processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117193910A true CN117193910A (en) 2023-12-08

Family

ID=88984278

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311104807.5A Pending CN117193910A (en) 2023-08-30 2023-08-30 Frame animation processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117193910A (en)

Similar Documents

Publication Publication Date Title
CN110908625B (en) Multi-screen display method, device, equipment, system, cabin and storage medium
JP5893046B2 (en) Customizing the immersive environment
KR101279680B1 (en) Motion desktop
KR102307163B1 (en) Cross-platform rendering engine
CN110377263B (en) Image synthesis method, image synthesis device, electronic equipment and storage medium
EP2245598B1 (en) Multi-buffer support for off-screen surfaces in a graphics processing system
JP6392881B2 (en) Low latency visual response to input by pre-generation of alternative graphic representations of application elements and input processing of graphic processing units
CN112035046B (en) Method and device for displaying list information, electronic equipment and storage medium
WO2018120992A1 (en) Window rendering method and terminal
CN113082696A (en) Display control method and device and electronic equipment
CN116821040B (en) Display acceleration method, device and medium based on GPU direct memory access
CN112596843A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
KR101154996B1 (en) Mobile terminal and Method for making of Menu Screen in thereof
CN111760272A (en) Game information display method and device, computer storage medium and electronic equipment
CN110471700B (en) Graphic processing method, apparatus, storage medium and electronic device
CN117193910A (en) Frame animation processing method and device, electronic equipment and storage medium
WO2005002198A2 (en) Video playback image processing
CN115460448A (en) Media resource editing method and device, electronic equipment and storage medium
CN114416005A (en) Interface display method and device and computer readable storage medium
CN111243069A (en) Scene switching method and system of Unity3D engine
US11962743B2 (en) 3D display system and 3D display method
CN116095250B (en) Method and device for video cropping
CN114003156A (en) Display method, display device, storage medium and electronic equipment
CN117608715A (en) Application sharing method, device, equipment and storage medium
CN116320576A (en) View object processing method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination