Dynamic effect generation method, electronic equipment and readable storage medium

By generating image frames with different transparency and gradually changing background colors, the problem of lack of layering and gradient in the terminal device's animation effect is solved, and a more natural and realistic animation effect is achieved, improving the user experience.

CN119313794APending Publication Date: 2025-01-14HONOR DEVICE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310859301.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-12
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

When generating dynamic effects, existing terminal devices lack a sense of layering and gradient, resulting in poor vividness and authenticity of the dynamic effects and poor user experience.

Method used

By responding to the information obtained by the application, generate image frames with different transparency, gradually change the background color, achieve gradient animation effects of brightness, and mix them to generate more natural and realistic animation effects.

Benefits of technology

It improves the display effect of animation, enhances the immersive experience of users, saves resource space, and presents a more vivid and realistic scene performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119313794A_ABST
    Figure CN119313794A_ABST
Patent Text Reader

Abstract

The invention provides a dynamic effect generation method, electronic equipment and a readable storage medium, which are applied to the technical field of terminals, and the method comprises the following steps: in response to information acquired from an application program, generating a first number of image frames, the first number of image frames comprising at least one first image frame and at least one second image frame, and at least one third image frame, the first image frame being generated based on the first transparency parameter and the background color, the second image frame being generated based on the second transparency parameter and the background color, the third image frame being generated based on the third transparency parameter and the background color, the background color means that the background color gradually changes from a first position in the open graphics library view to a second position in the open graphics library view; based on the first number of image frames, a first animation effect is generated and displayed, and the first animation effect is a gradient animation. Therefore, the dynamic effect display effect presented to the user is better, and the immersion experience of the user in the corresponding scene is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular, to a method for generating motion effects, an electronic device, and a readable storage medium. Background Art

[0002] With the continuous development of terminal devices, the applications in terminal devices are becoming more and more diverse. When a user uses an application, the terminal device can display one or more animation effects (referred to as animation effects) to the user through the relevant interface in the application, so that the user can feel the realistic real scene. For example, when the user opens the weather application, if the current weather type is thunderstorm, the terminal device can display the animation effects of lightning and rain to the user in the thunderstorm interface.

[0003] At present, when generating motion effects, terminal devices can adjust the color of the motion effects to make the color of the motion effects change from light to dark or from dark to light. However, the above solution will result in the display effect of the motion effects lacking a sense of hierarchy and gradient, the transition process of the motion effects is abrupt, and the vividness and authenticity of the motion effects are poor, thus resulting in a poor user experience. Summary of the invention

[0004] The present application provides a method for generating motion effects, an electronic device, and a readable storage medium, which can make the display effect of the motion effects have a sense of layering and gradient, and the gradient is more natural and realistic, thereby improving the user experience.

[0005] In a first aspect, the present application provides a method for generating a motion effect, comprising:

[0006] In response to information obtained from the application, a first number of image frames are generated, the first number of image frames including at least one first image frame, at least one second image frame, and at least one third image frame, the first image frame is generated based on a first transparency parameter and a background color, the second image frame is generated based on a second transparency parameter and a background color, and the third image frame is generated based on a third transparency parameter and a background color, the background color refers to: the background color gradually changes from a first position in the Open Graphics Library view to a second position in the Open Graphics Library view;

[0007] Based on the first number of image frames, generating a first animation effect, the first animation effect comprising an animation effect of gradual brightness change;

[0008] Display the first animation effect.

[0009] The present application can generate a first number of image frames in response to information obtained from an application, thereby obtaining a first image frame, a second image frame, and a third image frame with the same background color and different transparency, and the image frames are generated in real time, which can reduce the resource space occupied by storing image frames. Furthermore, based on the first image frame, the second image frame, and the third image frame with the same background color and different transparency, a first animation effect can be generated, and an animation effect with gradual brightness change can be obtained. On the basis of obtaining the first animation effect, the first animation effect can be displayed, and a gradual display effect with gradually changing brightness can be shown to the user. The dynamic display effect presented to the user is more vivid and lifelike, allowing the user to immerse in the real scene in the experience, thereby improving the user experience.

[0010] In some possible implementations, the first animation effect includes an animation effect in which the brightness gradually becomes brighter and then gradually becomes darker, or the first animation effect includes an animation effect in which the brightness gradually becomes darker and then gradually becomes brighter.

[0011] In some possible implementations, the method further includes:

[0012] acquiring a second number of image frames;

[0013] Mixing the second number of image frames with the first number of image frames to obtain a mixed second number of image frames;

[0014] generating a second animation effect based on the mixed second number of image frames, where the second animation effect is an animation effect superimposed with the first animation effect;

[0015] Display the second animation effect.

[0016] In the above implementation, by mixing the first number of image frames with the second number of image frames, the first animation effect and other animation effects corresponding to the second number of image frames can be superimposed and coexist, so that the mixed second number of image frames can generate a second animation effect, and the generated second animation effect can also achieve a display effect with gradual brightness changes, which is more applicable to scenes.

[0017] In some possible implementations, the information obtained from the application includes weather type information. When the weather type information is thunderstorm, the second animation effect includes a lightning animation effect with gradually changing brightness.

[0018] In the above implementation, the lightning animation effect superimposed with the first animation effect can achieve a display effect in which the brightness gradually brightens and then gradually dims, or a display effect in which the brightness gradually darkens and then gradually brightens, thereby allowing the user to immersively experience the real lightning conditions during thunderstorm weather.

[0019] In some possible implementations, based on a semi-transparent blending layer mode, the second number of image frames are blended with the first number of image frames to obtain a blended second number of image frames.

[0020] In the above implementation, the display effect of the second number of mixed image frames can be made more natural and realistic through the semi-transparent mixed layer mode.

[0021] In some possible implementations, generating a first number of image frames includes:

[0022] When i is less than the first number, determining whether i is less than or equal to a second number, where the second number is the number of at least one first image frame, i represents the number of image frames currently generated, and i is an integer greater than or equal to 0;

[0023] When i is less than or equal to the second number, determining a first transparency parameter according to i and the second number;

[0024] A first image frame is generated according to the first transparency parameter and the background color.

[0025] In some possible implementations, generating a first image frame according to a first transparency parameter and a background color includes:

[0026] In the open graphics library view, setting a first color value at a first position and a second color value at a second position;

[0027] Performing linear interpolation processing on the first color value and the second color value to obtain a background color;

[0028] The first transparency parameter and the background color are merged to obtain a first image frame.

[0029] In the above implementation, by performing linear interpolation processing on the set first color value and the second color value, the first color value can automatically transition to the second color value, thereby obtaining a background color that gradually changes from the first position to the second position, and the process of obtaining the background color is simpler.

[0030] In some possible implementations, the first transparency parameter is a ratio of i to the second number.

[0031] In some possible implementations, generating a first number of image frames further includes:

[0032] When i is greater than the second number, determining whether i is less than a third number, the third number being a difference between the first number and a fourth number, the fourth number being the number of at least one third image frame;

[0033] When i is less than a third number, determining the second transparency parameter to be a maximum transparency value or a minimum transparency value in the transparency range;

[0034] generating a second image frame according to the second transparency parameter and the background color;

[0035] When i is greater than or equal to the third number, determining a third transparency parameter according to the first number, i and the fourth number;

[0036] A third image frame is generated according to the third transparency parameter and the background color.

[0037] In some possible implementations, generating the second image frame according to the second transparency parameter and the background color includes:

[0038] In the open graphics library view, setting a first color value at a first position and a second color value at a second position;

[0039] Performing linear interpolation processing on the first color value and the second color value to obtain a background color;

[0040] The second transparency parameter and the background color are merged to obtain a second image frame.

[0041] In some possible implementations, generating a third image frame according to a third transparency parameter and a background color includes:

[0042] In the open graphics library view, setting a first color value at a first position and a second color value at a second position;

[0043] Performing linear interpolation processing on the first color value and the second color value to obtain a background color;

[0044] The third transparency parameter and the background color are merged to obtain a third image frame.

[0045] In some possible implementations, the third transparency parameter is a ratio of the fifth number to the fourth number, and the fifth number is a difference between the first number and i.

[0046] In the above implementation, the transparency of each image frame is determined by different calculation methods, so that when image frames with different transparencies are displayed in sequence, an animation effect of gradual brightness change can be achieved, and the gradual change process is more natural.

[0047] In a second aspect, the present application provides an electronic device, comprising a processor; when the processor executes computer code or instructions in a memory, the electronic device executes the method for generating motion effects in the first aspect and any possible design of the first aspect.

[0048] In the third aspect, the present application provides a chip system, which is applied to an electronic device including a memory, a display screen and a sensor; the chip system includes: one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected through lines; the interface circuit is used to receive signals from the memory and send signals to the processor, and the signals include computer code or instructions stored in the memory; the processor calls the computer code or instructions so that the electronic device executes the method for generating motion effects in the first aspect and any possible design of the first aspect.

[0049] Among them, the chip system may include one chip or multiple chips; when the chip system includes multiple chips, this application does not limit parameters such as the type and quantity of the chips.

[0050] In a fourth aspect, the present application provides a readable storage medium, in which codes or instructions are stored. A processor calls the codes or instructions to enable an electronic device to execute the method for generating motion effects in the first aspect and any possible design of the first aspect.

[0051] In a fifth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the method for generating motion effects in the first aspect and any possible design of the first aspect.

[0052] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0054] Figure 1A-Figure 1C A schematic diagram of an application scenario of a method for generating motion effects provided in one embodiment of the present application;

[0055] Figure 2 A schematic diagram of a hardware system of an electronic device provided in one embodiment of the present application;

[0056] Figure 3 A schematic diagram of a software system of an electronic device provided in one embodiment of the present application;

[0057] Figure 4 A signaling interaction diagram for creating an animation effect for an application provided in an embodiment of the present application;

[0058] Figure 5 A flowchart of a method for generating motion effects provided in one embodiment of the present application;

[0059] Figure 6 A schematic diagram of a background color provided in an embodiment of the present application;

[0060] Figure 7A-7C A schematic diagram of brightness changes of a first number of image frames provided in an embodiment of the present application;

[0061] Figure 8 A flowchart of a method for generating motion effects provided in one embodiment of the present application;

[0062] Figure 9A-9C A schematic diagram of a lightning animation effect provided by an embodiment of the present application;

[0063] Figure 10A-10C A schematic diagram of a rain animation effect provided by an embodiment of the present application;

[0064] Fig.11 A flowchart of a method for generating motion effects provided in one embodiment of the present application. DETAILED DESCRIPTION

[0065] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0066] In the following, the terms "first", "second", and "third" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first", "second", and "third" may explicitly or implicitly include one or more of the features.

[0067] See also Figure 1A-Figure 1C , Figure 1A-Figure 1C A schematic diagram of an application scenario of a method for generating motion effects provided in an embodiment of the present application is shown.

[0068] The method for generating motion effects provided in the embodiment of the present application can be applied to the electronic device 100. The electronic device 100 can be an electronic device 100 with display hardware and corresponding software support. For example, the electronic device 100 can be a mobile phone, a folding screen, a smart screen, a tablet computer, a wearable electronic device, an in-vehicle electronic device, an augmented reality (AR) device, a virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a home appliance, a projector, etc. The embodiment of the present application does not impose any restrictions on the specific type of the electronic device 100.

[0069] The electronic device 100 may display Figure 1A The interface 11 shown in FIG. 11 may include icons of multiple applications. For example, the icons of multiple applications may be icons 101 of a weather application, icons of a settings application, icons of a calendar application, and icons of a camera application. It should be understood that Figure 1A The application programs shown in the figure are only exemplary descriptions, and the electronic device 100 may include more other applications. Other applications may be third-party applications installed by the user, or system applications, which are not limited in the embodiments of the present application.

[0070] Upon receiving the user's Figure 1A After the icon 101 of the weather application shown in FIG. 1 is triggered (such as clicking, double-clicking, inputting or long pressing operations, etc.), the electronic device 100 can display the weather application icon 101 as shown in FIG. Figure 1A The interface 11 shown jumps to display as follows Figure 1B The interface 12 shown is used to display the weather information of the current city.

[0071] The interface 12 may include: a control 1021, a control 1031, a control 1041, and a control 1051. In the interface 12, the control 1021 is used to display the current city or region of real-time positioning. Figure 1B As shown in FIG. 103 , the current region is Yanta District. Control 1031 is used to display the current temperature of the current city or region. For example, Figure 1B As shown in FIG. 1 , the current temperature is 30° C. Control 1041 is used to display the highest and lowest temperatures of the current city or region. Figure 1B As shown, the maximum temperature is 35° C. and the minimum temperature is 19° C. The maximum temperature may be greater than or equal to the current temperature, and the minimum temperature may be less than or equal to the current temperature, which is not specifically limited in the present application.

[0072] Control 1051 is used to display the current weather type and air quality of the current city or region. For example, the current weather type can be sunny, rainy, or snowy. Sunny days can be clear or cloudy. Rainy days can be light rain, moderate rain, or thunderstorms. Snowy days can be light snow or heavy snow. The air quality can be good, better, average, or poor. For example, Figure 1B As shown, the current weather type is thunderstorm and the air quality is good.

[0073] Optionally, when the user needs to view weather information of other cities or regions besides the current city or region, the user can slide (for example, slide left or slide right) to switch weather information of different cities or regions. The user can slide anywhere in the interface, and this application does not limit this. For example, Figure 1B As shown in , the dotted arrow indicates that the user slides the screen to the left. At this time, in response to the user's sliding operation to the left, the electronic device 100 can display the Figure 1B The interface 12 shown jumps to display as follows Figure 1C The interface 13 shown enables the user to quickly view the weather information of the target city or region.

[0074] In interface 13, control 1022 is used to display the target city or region that the user needs to view. Generally, the target city is a city different from the current positioning city, and the target region is a region different from the current positioning region. Control 1032 is used to display the current temperature of the target city or region. Control 1042 is used to display the highest temperature and the lowest temperature of the target city or region. Control 1052 is used to display the current weather type and air quality of the target city or region.

[0075] It should be understood that the weather information of the target city may be the same as or different from the weather information of the current city, and this application does not impose any specific restrictions on this. Figure 1C As shown, the target city is Beijing, the current temperature is 23℃, the highest temperature is 25℃, the lowest temperature is 15℃, the current weather type is moderate rain, and the air quality is good.

[0076] Optionally, the user can also view weather information of other cities by adding other cities or searching for other cities, which is not limited in this application. It should be understood that when the user slides the screen to view weather information of another city or region, the corresponding weather information or geographical location will also be updated due to the change of the city or region (for example, Figure 1B The weather information shown is updated as follows Figure 1C weather information shown).

[0077] Optionally, the interface of the weather application also includes the source of weather information, the last update time, weather forecasts for the next few hours or weather information for different time periods, and weather forecasts for the past, present, and next few days. Figure 1B As shown, the source of weather information is China Weather, the last update time is 7:59 am, the temperature at 9:00 am is 31℃, the temperature at 10:00 am is 31℃, the temperature at 11:00 am is 32℃, and the temperature at 12:00 am is 35℃. Figure 1B Also shown is yesterday's weather forecast, today's weather forecast and tomorrow's weather forecast.

[0078] For example, when the weather application is not started, the user can click on the weather application, so that the electronic device 100 opens the weather application (such as Figure 1A Alternatively, when the weather application is already started, the user can click on the weather application, so that the electronic device 100 responds to the user's operation on the weather application, changing from an interface displaying the current city (such as Figure 1B Switch to the interface showing the target city (as shown) Figure 1C Alternatively, the user opens the weather application through a voice command, etc. The embodiment of the present application does not limit how the user opens the weather application.

[0079] In addition, the user can also switch to the weather information displayed on the main interface of the electronic device 100 by clicking on the weather information displayed on the main interface of the electronic device 100. Figure 1B As shown in interface 12, the present application does not limit the method of switching to the interface displaying weather information.

[0080] It should be understood that the above-mentioned interfaces and controls in each interface are examples and do not constitute a limitation on the interfaces in the embodiments of the present application. In another embodiment of the present application, based on different application scenarios, each interface may include more or fewer controls than those in the above-mentioned examples, and the present application does not impose specific limitations on them. For example, Figure 1B The interface shown may also include a return control ( Figure 1B (not shown), the return control is used to jump from the current interface to the upper level interface of the current interface. That is, after receiving the user's trigger operation on the return control, the electronic device 100 can change from displaying Figure 1B The interface 12 shown jumps to display as follows Figure 1A Interface 11 is shown.

[0081] Understandably, Figures 1A to 1C The weather information displayed in the interface shown is only an exemplary description, and the embodiments of the present application are not limited thereto. Figures 1A to 1CThe interface shown may also display other meteorological data in addition to temperature and weather type (e.g., air quality pollution index, abnormal weather reminder, wind direction information, and ultraviolet rays, etc.). Figure 1A The weather application shown may include multiple animation effects corresponding to different weather types. For example, the multiple animation effects may include Figure 1B The lightning animation effect and rain animation effect corresponding to the thunderstorm shown in FIG. Figure 1C The raining animation effect corresponding to moderate rain is shown. The weather application enables users to feel the current weather conditions more intuitively and enhances the user experience by displaying different animation effects corresponding to different weather types.

[0082] In some weather scenes, the weather application can also set multiple animation effects as gradient animation effects (animation effects with gradually changing brightness), so that the display effects of multiple animation effects are closer to the actual weather conditions, further enhancing the user experience. Currently, when creating animation effects, the weather application can adjust the color of the animation effects so that the animation effects can achieve gradient animation effects. Since each of the multiple animation effects is composed of multiple image frames with differences. For example, Figure 1B The lightning animation effect corresponding to thunderstorm weather shown is composed of a plurality of different lightning images, a plurality of raindrop images, and a plurality of cloud images. Figure 1C The rain animation effect corresponding to the rainy day shown is composed of a plurality of cloud images and a plurality of raindrop images with differences. When the weather application adjusts the color of the animation effect, it is necessary to reduce or increase the color value in the red green blue (RGB) color space through the shader to change the color of each image frame as a whole. In other words, when the color value in the RGB color space is reduced, the color of the image frame becomes darker as a whole; when the color value in the RGB color space is increased, the color of the image frame becomes brighter as a whole, so that the animation effect can achieve a gradual effect. However, the above setting process is relatively cumbersome, the animation effect occupies a large resource space, the final gradual animation effect changes abruptly (the brightness increases or decreases sharply), the authenticity of the animation effect is poor, and it is easy to cause discomfort to the user.

[0083] In view of this, the method for generating motion effects provided in the embodiment of the present application sets the background color to a gradient color, and combines it with the background color through different transparency parameters to obtain multiple image frames with different transparencies. Furthermore, based on multiple image frames with different transparencies, a first animation effect can be generated, and a gradient animation effect with a more natural brightness change can be obtained. The first animation effect is displayed. Thus, by generating multiple image frames with different transparencies in real time in the form of code in an open graphics library, and then generating the first animation effect, the resource space required to be occupied by the image frames in the first animation effect is saved, and the motion effect display effect presented to the user is better, which enhances the user's immersive experience in the scene corresponding to the motion effect.

[0084] Among them, the Open Graphics Library is a cross-language, cross-platform application programming interface (API) for rendering two-dimensional and three-dimensional graphics.

[0085] See also Figure 2 , Figure 2 A hardware system schematic diagram of an electronic device provided in an embodiment of the present application is shown.

[0086] like Figure 2 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L and a bone conduction sensor 180M, etc.

[0087] It should be noted that Figure 2 The structure shown does not constitute a specific limitation on the hardware system of the electronic device 100. In other embodiments of the present application, the hardware system of the electronic device 100 may include: Figure 2The components shown are more or less than the components shown, or the hardware system of the electronic device 100 may include Figure 2 A combination of some of the components shown, or a hardware system of the electronic device 100 may include Figure 2 Subcomponents of some of the components shown. For example, Figure 2 The illustrated proximity light sensor 180G may be optional. Figure 2 The components shown may be implemented in hardware, software, or a combination of software and hardware.

[0088] The processor 110 may include one or more processing units. For example, the processor 110 may include at least one of the following processing units: an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and a neural-network processing unit (NPU). Different processing units may be independent devices or integrated devices.

[0089] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0090] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0091] Figure 2 The connection relationship between the modules shown is only a schematic illustration and does not constitute a limitation on the connection relationship between the modules of the electronic device 100. Optionally, the modules of the electronic device 100 may also adopt a combination of multiple connection modes in the above embodiments.

[0092] The electronic device 100 can realize the display function through the GPU, the display screen 194 and the application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.

[0093] The display screen 194 can be used to display images or videos. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini light-emitting diode (Mini LED), a micro light-emitting diode (Micro LED), a micro OLED (Micro OLED) or a quantum dot light emitting diode (QLED). In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1. In some embodiments, the unfolded state of the display screen 194 can be as follows: Figure 1A-Figure 1C Any of the three states shown in .

[0094] The electronic device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.

[0095] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can perform algorithm optimization on the noise, brightness and color of the image. The ISP can also optimize the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0096] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard format such as RGB or YUV. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0097] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0098] The electronic device 100 can implement audio functions, such as music playing and recording, through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor.

[0099] The touch sensor 180K is also called a touch control device. The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, which is also called a touch control screen. The touch sensor 180K is used to detect a touch operation acting on or near it. The touch sensor 180K can pass the detected touch operation to the application processor to determine the type of touch event. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100 and set at a different position from the display screen 194.

[0100] The key 190 includes a power key and a volume key. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive a signal input by the key 190 and implement a function related to the signal input by the key 190.

[0101] Motor 191 can generate vibration. Motor 191 can be used for incoming call reminders and can also be used for touch feedback. Motor 191 can generate different vibration feedback effects for touch operations acting on different applications. Motor 191 can also generate different vibration feedback effects for touch operations acting on different areas of the display screen 194. Different application scenarios (for example, time reminders, receiving messages, alarm clocks, and games) can correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0102] Optionally, in some embodiments, the processor 110 is configured to generate a first number of image frames in response to information obtained from the application, obtain multiple image frames with different transparencies, generate a first animation effect based on the image frames with different transparencies, and display the first animation effect. This makes the display effect of the animation effect presented to the user better, improves the user's immersive experience in the scene corresponding to the animation effect, and does not need to occupy resource space when generating the first animation effect.

[0103] The hardware system of the electronic device 100 is described in detail above, and the software system of the electronic device 100 is introduced below. The software system can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the layered architecture as an example to exemplarily describe the software system of the electronic device 100.

[0104] See also Figure 3 , Figure 3 A schematic diagram of a software system of an electronic device provided in an embodiment of the present application is shown.

[0105] The software system of the electronic device 100 can be divided into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, Figure 3 As shown, the software system of the electronic device 100 can be an Android system architecture, which can be divided into four layers, from top to bottom, namely, an application layer (application, APP), an application framework layer (application framework), a system runtime layer and a kernel layer (linux kernel).

[0106] The application layer may include multiple applications. For example, the multiple applications may be a weather application, a settings application, a camera application, a calendar application, a music application, etc. It is understood that the multiple applications in the application layer may be third-party applications installed by the user or system applications.

[0107] The application framework layer is a framework layer used to support the operation of multiple applications in the application layer. In some embodiments, the application framework layer may include a binary archive file (android archive, AAR) of the Android library project. Since different applications implement different functions, different applications correspond to different AAR packages, and different AAR packages contain different contents and resources. For example, the AAR package corresponding to the weather application includes multiple animation effects corresponding to different weather types. Multiple animation effects are integrated in the AAR package as a weather engine and provided to the weather application in the application layer. For example, Figure 3 As shown, the AAR package related to the weather application may include hnthreedweather.aar and hngfxengine.aar. hnthreedweather.aar is used to provide multiple animation effects to the weather application. hngfxengine.aar is used to encapsulate some three-dimensional animation effects of the weather engine (for example, floating clouds, etc.) and pass them to hnthreedweather.aar to provide multiple animation effects to the weather application, so that the weather application can display animation effects corresponding to the current weather type.

[0108] 3D motion effects refer to animation effects in 3D space (e.g., space composed of X-axis, Y-axis, and Z-axis, which adds changes on the Z-axis to the X-axis and Y-axis compared to 2D space). For example, 3D motion effects can be basic motion effects for clouds. The animation effect of the overall floating of clouds can be encapsulated in hnthreedweather.aar, and the parameters of the basic motion effects of clouds (e.g., displacement parameters, transparency parameters, and scaling parameters of clouds) can be called from hngfxengine.aar.

[0109] It is understood that hnthreedweather.aar and hngfxengine.aar can be set separately. That is, hnthreedweather.aar is set as one AAR package in the AAR layer, and hngfxengine.aar is set as another AAR package in the AAR layer to jointly realize the animation effect of the weather application. Optionally, hnthreedweather.aar and hngfxengine.aar can also be combined into one AAR package and set in the AAR layer to realize the animation effect of the weather application.

[0110] It should be noted that Figure 3In the example, the AAR layer is set in the application framework layer, but the embodiments of the present application are not limited thereto. That is to say, the AAR layer can also be set independently of the application framework layer, for example, the AAR layer can be set independently between the application layer and the application framework layer, so as to provide a corresponding AAR package for the application in the application layer.

[0111] It should also be noted that Figure 3 The hnthreedweather.aar and hngfxengine.aar in the AAR layer are both extended AARs created by the embodiments of the present application (for example, specifically the terminal manufacturer), and are used to implement the method of generating animation effects proposed in the embodiments of the present application. The two are not native AARs in the Android system architecture. In other words, in order to implement the method of generating animation effects in the embodiments of the present application, the weather application can call hnthreedweather.aar and hngfxengine.aar to generate corresponding animation effects. If the weather application calls the native AAR, the animation effect corresponding to the current weather type cannot be generated.

[0112] Optionally, in another embodiment, the application framework layer may further include a programming framework. Exemplarily, the programming framework may be an open graphics library for embedded systems framework (OpenGL ES framework). The open graphics library framework for embedded systems may include a plurality of basic classes for creating and manipulating graphics. For example, the open graphics library framework for embedded systems may include a surface view (SurfaceView) module, a GLSurfaceView module, and a GLSurfaceView.Renderer module, etc. The SurfaceView module is used to draw graphics. The GLSurfaceView module is used to render graphics. The GLSurfaceView.Renderer module is a general renderer interface. OpenGL ES is an application programming interface (API) for embedded systems. In the Android system architecture, users (or developers) can use the OpenGL ES API to create and manipulate two-dimensional and three-dimensional graphics.

[0113] Among them, the GLSurfaceView module is a class that can use the OpenGL ES API call to draw and manipulate objects (i.e., graphics). The GLSurfaceView module is a class created based on the SurfaceView module, so the functions of the GLSurfaceView module and the SurfaceView module are similar. Both the GLSurfaceView module and the SurfaceView module can be used for OpenGL ES rendering, and the rendering efficiency of the GLSurfaceView module is higher than that of the SurfaceView module. Specifically, users can use the GLSurfaceView module by creating an instance of GLSurfaceView and adding the instance of GLSurfaceView to the renderer (Render).

[0114] The GLSurfaceView.Renderer module defines the methods needed to draw graphics in the GLSurfaceView module. The GLSurfaceView.Renderer module must be provided as a separate class to the GLSurfaceView module, and the GLSurfaceView module can attach the GLSurfaceView.Renderer module to the instance GLSurfaceView.Renderer.

[0115] The system runtime layer may include graphics hardware, which is used to abstract hardware. Graphics hardware may include an external library and a hardware abstraction layer library (HAL library).

[0116] Among them, the external function library may include an open graphics library for embedded systems and a business programming language. The business programming language is an interface between the open graphics library for embedded systems and the underlying native platform window system. The hardware abstraction layer library may include a hardware synthesizer (HWComposer) and a gralloc library. The hardware synthesizer is used to synthesize and display multiple layers where multiple image frames are located. The gralloc library is used to apply for a graphics buffer, and the graphics buffer can be mapped to the address space of the application in the application layer, so that the graphics to be drawn can be written into the graphics buffer.

[0117] The kernel layer is an abstract layer between hardware and software. Exemplarily, the kernel layer may include driver modules such as a graphics processor driver (GPU driver), a display driver, a camera driver, an audio driver, and a sensor driver.

[0118] The method for generating motion effects in an embodiment of the present application can be executed in the application framework layer. In some embodiments, after the electronic device 100 generates a first number of image frames in response to information obtained from the application, the electronic device 100 can generate a gradient first animation effect based on multiple image frames with different transparencies. Based on this, the electronic device 100 displays the first animation effect through the display screen 194 to show the user the corresponding gradient motion effect, so that the display effect of the gradient motion effect is better. Optionally, the generated first number of image frames are stored in the application framework layer.

[0119] It should be understood that Figure 3 The hierarchical structure shown does not constitute a specific limitation on the software system of the electronic device 100. In other embodiments of the present application, the software system of the electronic device 100 may include: Figure 3 The layered architecture shown may be more or less than the architecture shown, or each layer of the software system of the electronic device 100 may include more than Figure 3 The component structures shown may be more or less structures, and the embodiments of the present application are not limited thereto.

[0120] Based on the above description, the following Figure 4 , a specific implementation process of the electronic device 100 creating animation effects in an embodiment of the present application is described in detail.

[0121] See also Figure 4 , Figure 4 A signaling interaction diagram for an application to create an animation effect provided by an embodiment of the present application is shown.

[0122] It should be understood that Figure 4 The signaling interaction process provided in can be applied to Figure 2 In. Figure 2 As an example, assume that a weather application is installed in the electronic device 100. Figure 3 In the software architecture layer of the electronic device 100 shown, Figure 4 The weather application in Figure 3 The application layer in the software system Figure 4 The weather manager and weather scene classes in Figure 3 The software system shown is in the AAR package of the application framework layer. Figure 4 The GLSurfaceView module in can be Figure 3 The GLSurfaceView module in the application framework layer is located in the open graphics library framework.

[0123] Figure 4The GLSurfaceView.Renderer module can be Figure 3 The GLSurfaceView.Renderer module in the GLSurfaceView.Renderer is located in the Open Graphics Library framework of the Application Framework layer. Figure 3 The onSurfaceChanged() method is located in the Open Graphics Library framework of the application framework layer ( Figure 3 The requestRender() method is located in the Open Graphics Library framework of the application framework layer ( Figure 3 not shown).

[0124] like Figure 4 As shown, the specific steps for the weather application to create an animation effect in the embodiment of the present application are as follows:

[0125] Step 11, the user starts the weather application. The weather application is located at Figure 3 The application layer in the software system shown.

[0126] by Figure 1A Taking the interface shown as an example, the user can click on the icon 101 of the weather application on the display screen 194 of the electronic device 100, so that the electronic device 100 opens the weather application in response to the user's click operation.

[0127] It should be understood that the above example is only described by taking the user clicking on the weather application as an example, and the embodiments of the present application are not limited thereto, and the weather application can also be opened in other ways. For example, the user controls the electronic device to open the weather application by voice.

[0128] Step 12: The weather application may pass weather information such as the current weather type to the weather management class.

[0129] Exemplarily, the current weather type includes sunny day, rainy day (such as heavy rain, light rain or thunderstorm) or snowy day (such as heavy snow or light snow) and the like.

[0130] Optionally, the weather application can also pass a weather background image to the weather management class. The weather background image is a static base image corresponding to the current weather type, and different weather type information corresponds to different static base images.

[0131] Optionally, the weather application may also pass time information such as day or night to the weather management class. Exemplarily, when the time information passed by the weather application to the weather management class is daytime, the static base map passed by the weather application to the weather management class may be a static base map corresponding to daytime. Alternatively, when the time information passed by the weather application to the weather management class is nighttime, the static base map passed by the weather application to the weather management class may be a static base map corresponding to nighttime. For example, when the current weather type is rainy, the weather background picture may include a first static base map and a second static base map. The first static base map is a static base map corresponding to daytime, and the second static base map is a static base map corresponding to nighttime, and the background colors of the first static base map and the second static base map are different, and the transparency of the first static base map and the second static base map is also different.

[0132] It should be understood that here, the user in step 11 starts the weather application as an example to trigger step 12, and the embodiment of the present application is not limited to this. For example, the user may trigger step 12 by switching cities or searching for weather information of a certain city when the weather application is already opened.

[0133] Step 13, the weather management class can initialize the GLSurfaceView module in the open graphics library.

[0134] By initializing the GLSurfaceView module, you can assign values ​​to the static variables in the GLSurfaceView module and prepare for the subsequent creation of dynamic effects.

[0135] Step 14: The weather management class can initialize the weather scene class.

[0136] By initializing the weather scene class, you can assign values ​​to the static variables in the weather scene class.

[0137] It should be understood that there is no temporal or sequential order in which step 13 and step 14 are executed. Step 13 and step 14 may be executed simultaneously or sequentially.

[0138] Step 15, the weather management class creates a renderer (Render), and uses the renderer to render the GLSurfaceView module through the GLSurfaceView.Renderer module.

[0139] In addition, the weather management class can also pass the rendered GLSurfaceView.Renderer module to the weather application.

[0140] Step 16, the GLSurfaceView.Renderer module can pass the renderer to the GLSurfaceView module and bind the renderer to the GLSurfaceView module.

[0141] Step 17, the GLSurfaceView.Renderer module can create a drawing surface (Surface), and initialize the custom weather scene when calling the onSurfaceChanged() method, and load the resource image corresponding to the custom weather scene. The resource image includes a sequence frame resource, and the sequence frame resource can include a sequence frame corresponding to a static animation effect and / or a sequence frame corresponding to a dynamic animation effect. Surface is used to render the resource image on the screen of the display screen 194.

[0142] Step 18, the GLSurfaceView.Renderer module calls the requestRender() method to refresh the Surface to start the weather animation.

[0143] Step 19, when the GLSurfaceView.Renderer module refreshes the Surface for the first time, the weather scene class will match and create corresponding animation effects (referred to as dynamic effects) according to the weather information such as the current weather type transmitted by the weather application. Optionally, the GLSurfaceView.Renderer module can call the requestRender() method through an asynchronous callback mechanism (handler).

[0144] Step 20: The weather scene class can bind the corresponding animation effect to the weather scene class and store it in the content manager of the weather scene class. The content manager of the weather scene class is used to uniformly manage multiple animation effects.

[0145] Step 21: The weather scene class can play the corresponding animation effect in a loop.

[0146] It should be noted that each of the multiple animation effects is carried in a GLSurfaceView module for display.

[0147] Combination of the above Figure 4 This section introduces the process of creating and playing corresponding animations based on the weather information transmitted by the weather application after opening the weather application. Figure 5 , describes in detail the method for generating the first animation effect in the embodiment of the present application. For example, Figure 5 The method provided in can occur in Figure 4 Follow step 19 in the

[0148] See also Figure 5 , Figure 5 A flow chart of a method for generating motion effects provided by an embodiment of the present application is shown. Figure 5 As shown, the method for generating motion effects in the embodiment of the present application includes:

[0149] S101, generating a first number of image frames in response to information obtained from an application.

[0150] The information obtained from the application is the basic information required to generate the animation effect, which may include background information of the animation effect (such as background color, etc.) and element information in the image frame of the animation effect (such as elements such as clouds, lightning and raindrops, etc.).

[0151] Exemplarily, when the application is a weather application, the information obtained from the weather application may include weather information and time information (such as whether the current time is day or night). The weather information may include weather type information.

[0152] Optionally, the first number of image frames includes at least one first image frame, at least one second image frame, and at least one third image frame. The first image frame, the second image frame, and the third image frame are image frames with the same element content or with differences. Image frames with differences can be understood as: the elements contained in the image frames are the same, but the positions of the elements in the image frames are different; or, the elements contained in the image frames are the same, but the transparency of the elements in the image frames is different; or, the elements contained in the image frames are not the same, and the positions of the elements in the image frames are different. In addition, the transparency of the three image frames is different. For example, the first image frame can be an image frame with gradually increasing transparency (or, a luminous image frame), the second image frame can be an image frame with a transparency greater than the transparency of the first image frame and remains unchanged, and the third image frame can be an image frame with gradually decreasing transparency (or, a darkening image frame).

[0153] Exemplarily, the first number of image frames may include a first image frame, a second image frame and a third image frame. In this case, the first number of image frames are generated in the order of the first image frame, the second image frame and the third image frame.

[0154] Exemplarily, the first number of image frames may also include a plurality of first image frames, a plurality of second image frames, and a plurality of third image frames. The plurality of first image frames, the plurality of second image frames, and the plurality of third image frames may all be image frames with pre-set numbers. In this case, the first number of image frames are generated in a numbering order.

[0155] It should be understood that the numbers of the multiple first image frames can be arranged in order from small to large, or in order from large to small. The numbering of the multiple second image frames and the numbering of the multiple third image frames can be arranged in the same manner as the numbering of the multiple first image frames, or can be arranged differently, and this application does not impose any specific restrictions on them.

[0156] It should be noted that only two cases of the first number of image frames are listed above for illustration, and the first number of image frames may also include other numbers of first image frames, second image frames, and third image frames. In other words, the number of first image frames, the number of second image frames, and the number of third image frames may be the same or different. For example, the first number of image frames includes one first image frame, multiple second image frames, and multiple third image frames, which is not limited in the embodiments of the present application.

[0157] Optionally, in some embodiments, the first image frame is generated based on a first transparency parameter and a background color. The first transparency parameter is used to indicate the transparency of the first image frame. The background color means that the background color gradually changes from a first position (i.e., a top position) in the open graphics library view to a second position (i.e., a bottom position) in the open graphics library view.

[0158] For example, the gradual change of the background color can be understood as: in the RGB color space, the color value of the background color changes from small to large or from large to small. Figure 6 As shown, in the RGB color space, from the first position in the open graphics library view to the second position in the open graphics library view, the background color value gradually changes from the color value corresponding to white (255,255,255) to the color value corresponding to black (0,0,0). It should be understood that the first position and the second position in the embodiment of the present application can also be set to other colors besides white and black (for example, the first position is red and the second position is blue), and the present application does not limit this.

[0159] Alternatively, the gradual change of the background color can be understood as: in the (lab color space, Lab) color space, the color value of the background color changes from small to large or from large to small. In the Lab color space, the value range of the color value of the background color is [0,100]. Usually, the color value of the background color is set and adjusted in the RGB color space, so in the embodiment of the present application, the RGB color space is used as an example to implement the method for generating the dynamic effect in the embodiment of the present application.

[0160] Exemplarily, the OGL view may be a GLSurfaceView module, and the size of the OGL view may be the size of the GLSurfaceView module, or the size of the OGL view may be smaller than the size of the GLSurfaceView module. Both the size of the OGL view and the size of the GLSurfaceView module may be user-defined.

[0161] Optionally, in some embodiments, the size of the OGL view may be determined in the following manner: the electronic device 100 may pre-set four coordinates, namely, a first coordinate, i.e., an upper left coordinate (mLeftTop), a second coordinate, i.e., an upper right coordinate (mRightTop), a third coordinate, i.e., a lower left coordinate (mLeftBottom), and a fourth coordinate, i.e., a lower right coordinate (mRightBottom). Among them, the ordinate of the first coordinate is equal to the ordinate of the second coordinate, the abscissa of the first coordinate is equal to the abscissa of the third coordinate, the abscissa of the second coordinate is equal to the abscissa of the fourth coordinate, and the ordinate of the third coordinate is equal to the ordinate of the fourth coordinate. Thus, the electronic device 100 may determine the size of the OGL view based on the first coordinate, the second coordinate, the third coordinate, and the fourth coordinate.

[0162] Optionally, in some embodiments, the first position in the Open Graphics Library view is determined by the first coordinate and the second coordinate. The second position in the Open Graphics Library view is determined by the third coordinate and the fourth coordinate.

[0163] Optionally, in some embodiments, the line connecting the first coordinate and the second coordinate is determined as the first position in the open graphics library view. Of course, the first position can also be expanded according to actual needs. For example, Figure 6 The first position shown in is the area that is extended downward based on the line connecting the first coordinate and the second coordinate. The line connecting the third coordinate and the fourth coordinate is determined as the second position in the open graphics library view. Of course, the second position can also be expanded according to actual needs. For example, Figure 6 The second position shown in is an area extending upward based on the line connecting the third coordinate and the fourth coordinate, and this application does not limit this.

[0164] In addition, it should be noted that the above-mentioned first coordinate, second coordinate, third coordinate and fourth coordinate are usually coordinates in the screen coordinate system in the open graphics library (or OpenGL). Therefore, the electronic device 100 needs to determine the transformation matrix through the view matrix and the projection matrix, and convert the first coordinate, the second coordinate, the third coordinate and the fourth coordinate into coordinates in the world coordinate system in the open graphics library through the transformation matrix, so as to ensure that when the image frame normally displayed in the open graphics library is actually displayed on the display screen 194 of the electronic device 100, the displayed position will not be offset.

[0165] Optionally, the second image frame is generated based on a second transparency parameter and a background color. The second transparency parameter is used to indicate the transparency of the second image frame. The third image frame is generated based on a third transparency parameter and a background color. The third transparency parameter is used to indicate the transparency of the third image frame.

[0166] The user can click on the weather application to start the weather application. In response to the user's click operation, the weather application can transmit weather information such as weather type to the electronic device 100. In response to the weather information such as weather type obtained from the weather application, the electronic device 100 can generate a first number of image frames, thereby providing an image data basis for generating animation effects.

[0167] Optionally, in some embodiments, the first number of image frames generated by the electronic device 100 may be implemented by setting an array linked list, and the first number of image frames generated during the loop are stored in the array linked list. Figure 3 For the software system shown in FIG. 1 , the array linked list is located in the application framework layer of the software system. Figure 2 For the hardware system shown, the first number of image frames generated by the electronic device 100 can be stored in the internal memory 121 in the hardware system.

[0168] S102: Generate a first animation effect based on a first number of image frames.

[0169] Optionally, the first animation effect is used to show the user the process of brightness state change in different scenes, which can make the user's visual experience better. Exemplarily, the first animation effect includes an animation effect of gradual brightness change. That is, the first animation effect may include an animation effect of gradually brightening and then gradually dimming the brightness. Alternatively, the first animation effect may include an animation effect of gradually dimming and then gradually brightening the brightness. Thus, the gradual display effect of the first animation effect is better.

[0170] It should be understood that the background color of any animation effect is the same as the background color of the image frame that generates the animation effect. The background colors of different animation effects can be the same or different. Usually, the background colors of different animation effects are different, so that users can better distinguish different animation effects based on the background colors of the animation effects.

[0171] Optionally, in some embodiments, after obtaining the first number of image frames, the electronic device 100 may generate a first animation effect based on the first number of image frames, and the brightness of multiple image frames in the first animation effect gradually changes in sequence.

[0172] Optionally, in some embodiments, the first animation effect may further include an animation effect in which the brightness gradually brightens, and for a period of time, the brightness after brightening remains unchanged, and then the brightness after brightening gradually dims. Alternatively, the first animation effect may further include an animation effect in which the brightness gradually dims, and for a period of time, the brightness after dimming remains unchanged, and then the brightness after dimming gradually brightens.

[0173] S103: display a first animation effect.

[0174] After generating the first animation effect, the electronic device 100 may display the image frames corresponding to the first animation effect stored in the array linked list, that is, the first number of image frames, in the open graphics library view or the display screen 194. Moreover, the display effect of the first animation effect in the open graphics library view or the display screen 194 is the same. Moreover, the display effect is better, and the user can observe the gradual change process more intuitively.

[0175] Optionally, in some embodiments, the electronic device 100 may set the display times of the first animation effect to 1 time. That is, the electronic device 100 may display the first image frame in the first animation effect to the last image frame in the first animation effect in sequence, and in the process of displaying the first animation effect, the user can observe the first animation effect, for example, in thunderstorm weather, when the user opens the weather application, he can see the dynamic effect of the brightness gradually dimming and then gradually brightening.

[0176] Optionally, in another embodiment, the electronic device 100 may be set to display the first animation effect in a loop. That is, when displaying the first animation effect, the electronic device 100 may play from the first first image frame in the first animation effect to the last third image frame in the first animation effect, and then play from the first first image frame in the first animation effect to the last third image frame in the first animation effect, that is, the first animation effect is displayed in a loop.

[0177] Optionally, when the first number of image frames are image frames with pre-set numbers, the electronic device 100 may play multiple image frames in the first number of image frames in sequence according to the numbering order of the multiple image frames in the first number of image frames, thereby achieving a first animation effect.

[0178] The embodiment of the present application does not specifically limit the quantitative relationship between the first image frame, the second image frame, and the third image frame. Fig. 7A As shown, when the number of the first image frame and the number of the third image frame are equal, the electronic device 100 displays the first animation effect with the same speed in the two stages of gradually brightening and gradually dimming. That is, the brightness of the first image frame increases from Fig. 7A The speed at which the brightness 1 in the image gradually increases to the brightness 2 is the same as the speed at which the brightness of the third image frame increases from Fig. 7A The speed at which the brightness 2 in the image gradually decreases to the brightness 1 is the same. At this time, the user can observe the first animation effect that the brightness gradually becomes brighter, the brightness after brightening remains unchanged, and then the brightness gradually becomes darker.

[0179] like Figure 7B and Figure 7C As shown, when the number of the first image frames is not equal to the number of the third image frames, the electronic device 100 displays the first animation effect at different speeds for the two stages of gradually brightening and gradually dimming. Figure 7B As shown in FIG. 1 , when the number of the first image frames is greater than the number of the third image frames, the speed at which the brightness gradually brightens in the first animation effect is slower, and the speed at which the brightness gradually darkens is faster, that is, the brightness of the first image frame increases from Fig. 7A The speed at which the brightness 1 in the image increases gradually to the brightness 2 is slower than the speed at which the brightness of the third image frame increases from Fig. 7A The speed at which the brightness 2 in the image gradually decreases to the brightness 1. At this time, the user can observe the first animation effect that the brightness slowly brightens, keeps the brightness unchanged after brightening, and then the brightness quickly dims. Figure 7C As shown in FIG. 1 , when the number of the first image frames is less than the number of the third image frames, the speed at which the brightness gradually darkens in the first animation effect is faster, and the speed at which the brightness gradually brightens is slower, that is, the brightness of the first image frame increases from Fig. 7A The speed at which the brightness 1 in the image increases gradually to the brightness 2 is greater than the speed at which the brightness of the third image frame increases from Fig. 7A The speed at which the brightness 2 in the image gradually decreases to the brightness 1. At this time, the user can observe the first animation effect that the brightness quickly brightens, keeps the brightness unchanged after brightening, and then the brightness slowly dims.

[0180] It should be understood that Figure 7A-7CIn the description, the example of gradually increasing brightness 1 to brightness 2, then keeping brightness 2 unchanged, and then gradually decreasing from brightness 2 to brightness 1 is used. The brightness of the first animation effect may also be decreased first and then increased. In addition, in the stage where the brightness remains unchanged, the number of the second image frames may be equal to the number of the first image frames or the number of the third image frames, or may not be equal to the number of the first image frames or the number of the third image frames, and this application does not make any specific limitation thereto.

[0181] The method for generating motion effects in the embodiment of the present application can generate a first number of image frames in response to information obtained from an application, and can obtain at least one first image frame, at least one second image frame, and at least one third image frame, and the first image frame, the second image frame, and the third image frame are image frames with the same background color and different transparency. Then, based on the first number of image frames, or in other words, the first image frame, the second image frame, and the third image frame, a first animation effect can be generated, and a gradient animation effect with a more natural brightness change can be obtained. Displaying the first animation effect can show the user a gradient display effect with gradually changing brightness. Thus, it is possible to generate image frames in real time through code, saving the resource space occupied by the image frames required to generate the animation effect, and enabling users to immersively experience the gradient display effect in the actual scene, so that the motion effect display effect presented to the user is better and the visual effect is more realistic.

[0182] In actual application scenarios, the first number of image frames are usually superimposed and mixed with other image frames (for example, image frames corresponding to other animation effects, or background image frames, etc.), so that the animation effects generated based on the mixed other image frames can also achieve a gradual animation effect, thereby making the user experience more realistic.

[0183] Based on the description of S101, the following Figure 8 , a possible implementation method for generating the second animation effect in an embodiment of the present application is introduced in detail.

[0184] See also Figure 8 , Figure 8 A flow chart of a method for generating motion effects provided by an embodiment of the present application is shown. Figure 8 As shown, the method for generating motion effects in the embodiment of the present application includes the following steps:

[0185] S201, acquiring a second number of image frames.

[0186] Optionally, the second number of image frames may be image frames corresponding to other animation effects pre-stored (or pre-loaded) in the electronic device 100. Exemplarily, the second number of image frames may be Figure 4 The resource image loaded in .

[0187] For example, in a weather application scenario, the second number of image frames are lightning image frames (or images corresponding to the lightning animation effect) pre-stored in the electronic device 100. Figure 4 For example, in a weather application scenario, the second number of image frames are raindrop image frames (or images of raindrops) corresponding to the rain animation effect pre-stored in the electronic device 100. Figure 4 ).

[0188] Optionally, in some embodiments, the second number of image frames may also be background image frames pre-stored in the electronic device 100 (or, Figure 4 ).

[0189] Exemplarily, the second number of image frames includes at least one fourth image frame, at least one fifth image frame, and at least one sixth image frame. At least one fourth image frame, at least one fifth image frame, and at least one sixth image frame may include elements such as lightning, clouds, and raindrops. The fourth image frame, the fifth image frame, and the sixth image frame are introduced here only to facilitate the description of the process of mixing with the first number of image frames obtained in S101 to generate the second animation effect, or to facilitate the description, and are not intended to classify the second number of image frames into types.

[0190] Typically, the second number is less than or equal to the first number. That is, the number of the first image frames is greater than or equal to the number of the fourth image frames, the number of the second image frames is greater than or equal to the number of the fifth image frames, and the number of the third image frames is greater than or equal to the number of the sixth image frames, thereby ensuring that each image frame in the second number of image frames can be mixed with the corresponding image frame in the first number of image frames, thereby ensuring that the second animation effect can achieve the gradient display effect of the first animation effect.

[0191] After S101 is completed and the first number of image frames are obtained, the electronic device 100 can obtain a second number of image frames from the internal memory 121 to provide an image data basis for generating a second animation effect.

[0192] It should be noted that S201 may be executed before S101, or S201 may be executed simultaneously with S101, which is not limited in the present application.

[0193] S202: Mix the second number of image frames with the first number of image frames to obtain a mixed second number of image frames.

[0194] Optionally, in some embodiments, the electronic device 100 may mix the second number of image frames with the first number of image frames based on a semi-transparent mixed layer mode to obtain a mixed second number of image frames.

[0195] Exemplarily, the electronic device 100 can set the semi-transparent blending layer mode through the setBlendFunc() method. The semi-transparent blending layer mode is used to achieve blending between multiple layers, so that the display of the blended layers is more natural. The setBlendFunc() method is used to set the color blending scheme. The electronic device 100 sets the semi-transparent blending layer mode to setBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA).

[0196] Exemplarily, the first number of image frames are regarded as source colors (source, S), the second number of image frames are regarded as destination colors (destination, D), and the mixed second number of image frames are regarded as result colors (result). The factor GL_SRC_ALPHA in the setBlendFunc() method satisfies the following formula:

[0197] GL_SRC_ALPHA=(sA,sA,sA,sA);

[0198] Wherein, sA represents the transparency value of the source color in the RGB color space.

[0199] The factor GL_ONE_MINUS_SRC_ALPHA in the setBlendFunc() method satisfies the following formula:

[0200] GL_ONE_MINUS_SRC_ALPHA=(1-sA,1-sA,1-sA,1-sA).

[0201] Assume that the color array of the source color is S = (sR, sG, sB, sA), and the color array of the target color is D = (dR, dG, dB, dA);

[0202] Among them, sR represents the red color value of the source color in the RGB color space, sG represents the green color value of the source color in the RGB color space, sB represents the blue color value of the source color in the RGB color space, sA represents the transparency value of the source color in the RGB color space, dR represents the red color value of the target color in the RGB color space, dG represents the green color value of the target color in the RGB color space, dB represents the blue color value of the target color in the RGB color space, and dA represents the transparency value of the target color in the RGB color space.

[0203] Optionally, the blending formula in the semi-transparent blending layer mode = the color array of the source color * the source factor matrix + the color array of the target color * the target factor matrix. Exemplarily, the blending formula in the semi-transparent blending layer mode satisfies the following formula:

[0204] result&=S*sfactor+D*dfactor;

[0205] sfactor=(sfR,sfG,sfB,sfA);

[0206] dfactor=(dfR,dfG,dfB,dfA);

[0207] result = (rR, rG, rB, rA);

[0208] rR=sR*sfR+dR*dfR;

[0209] rG=sG*sfG+dG*dfG;

[0210] rB=sB*sfB+dB*dfB;

[0211] rA=sA*sfA+dA*dfA;

[0212] Among them, result represents the color array of the result color, S represents the color array of the source color, sfactor represents the source factor matrix, D represents the color array of the target color, dfactor represents the target factor matrix, sfR represents the first element in the source factor matrix, sfG represents the second element in the source factor matrix, sfB represents the third element in the source factor matrix, sfA represents the fourth element in the source factor matrix, dfR represents the first element in the target factor matrix, dfG represents the second element in the target factor matrix, dfB represents the third element in the target factor matrix, dfA represents the fourth element in the target factor matrix, rR represents the red color value of the result color in the RGB color space, rG represents the green color value of the result color in the RGB color space, rB represents the blue color value of the result color in the RGB color space, and rA represents the transparency value of the result color in the RGB color space.

[0213] It should be noted that the value range of the color array and the elements in the matrix in the above formula are all 0-1, and they are all floating-point data in the RGB color space. In other words, if the calculation result is greater than 1.0f, the final value is 1.0f.

[0214] Based on the above description, the electronic device 100 can enable the blending function through the glBlendFunc() method. The glBlendFunc() method is used to receive a source factor and a target factor. For example, glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) can be understood as: the value of the source factor GL_SRC_ALPHA is the transparency of the source color, and the value of the target factor GL_ONE_MINUS_SRC_ALPHA is 1-the transparency of the source color. Thereby, the source color and the target color are mixed according to the transparency to obtain the result color (or, according to the transparency, the first number of image frames and the second number of image frames are mixed to obtain the second number of image frames after mixing), and the display effect of the result color (or, the second number of image frames after mixing) obtained by mixing in the semi-transparent blending mode is more natural.

[0215] It should be noted that when the transparency sA of the source color is 0, the electronic device 100 takes the transparency dA of the target color; or, when the transparency sA of the source color is 1, the electronic device 100 takes the transparency of the source color; or, when the transparency sA of the source color is a value between 0 and 1, the electronic device 100 takes a part of the transparency of the source color and a part of the transparency of the target color, respectively, that is, if the transparency of the source color is greater, the electronic device 100 takes more source colors, and the source color has a stronger expressiveness (the greater the proportion of the source color in the result color, or, the less the target color under the source color is transmitted). If the transparency of the source color is smaller, the electronic device 100 takes more target colors, and the target color has a stronger expressiveness (the greater the proportion of the target color in the result color, or, the more the target color under the source color is transmitted).

[0216] Exemplarily, when the first number of image frames includes a first image frame, a second image frame and a third image frame, and the second number of image frames includes a fourth image frame, a fifth image frame and a sixth image frame, the first image frame is used as the source color, the fourth image frame is used as the target color, and based on the semi-transparent blending layer mode, the first image frame and the fourth image frame are mixed to obtain a mixed fourth image frame.

[0217] It should be understood that the mixing process of the second image frame and the fifth image frame and the mixing process of the third image frame and the sixth image frame are similar to the mixing process of the first image frame and the fourth image frame. The above mixing process is also applicable to the case where the first number of image frames includes multiple first image frames, multiple second image frames and multiple third image frames, and the second number of image frames includes multiple fourth image frames, multiple fifth image frames and multiple sixth image frames, which will not be described in detail here.

[0218] Optionally, in another embodiment, the source color and the target color can be mixed (or the first number of image frames and the second number of image frames can be mixed) by setting a transparency threshold in the OpenGL mechanism.

[0219] For example, with respect to the transparency of the source color (or the first number of image frames) and the transparency of the target color (or the second number of image frames), the image content corresponding to the transparency of the source color and the target color that is greater than the transparency threshold can be retained, and the image content corresponding to the transparency that is less than the transparency threshold is discarded, and the completely retained image content is the result color.

[0220] It should be understood that in addition to the above two mixing methods, those skilled in the art may also use other mixing methods to obtain the result color, and this application does not impose any specific limitations thereto.

[0221] S203: Generate a second animation effect based on the mixed second number of image frames. Optionally, the second animation effect is an animation effect superimposed with the first animation effect, that is, the second animation effect can achieve a display effect of gradual brightness change.

[0222] In the weather application scenario, the electronic device 100 can obtain the current weather type in response to the user's operation on the weather application. The embodiment of the present application does not specifically limit the triggering method for obtaining the current weather type. Figure 1A As Figure 1C In the scenario shown, the user can perform operations such as clicking on the weather application.

[0223] For example, in a weather application scenario, when the current weather type is thunderstorm weather, the second animation effect may include a lightning animation effect with gradually changing brightness.

[0224] When the second animation effect is a lightning animation effect with gradually changing brightness, the lightning animation effect is an animation effect in which the brightness gradually becomes brighter and then gradually becomes darker, or in other words, the lightning animation effect is an animation effect in which the brightness gradually increases and then gradually decreases. Figure 9A-9C As shown, Fig.9A The transparency is less than Fig. 9B transparency, Fig. 9B The transparency is greater than Fig. 9C transparency, and Fig.9A The transparency is less than Fig. 9C Due to the difference in transparency, Fig.9A The interface shown changes gradually from light gray at the top of the interface to dark gray at the bottom of the interface. At this time, the brightness of the lightning is darker. Fig. 9B The interface shown changes gradually from grayish white at the top of the interface to light gray at the bottom of the interface. At this time, the brightness of the lightning is brighter. Fig. 9CThe interface shown is a gradual change from light gray at the top of the interface to dark gray at the bottom of the interface. At this time, the brightness of the lightning is darker. In addition, by contrast Fig.9A and Fig. 9C , it is obvious that Fig.9A Compared to Fig. 9C The gray is darker and the lightning is darker. Figure 9A-9C The image frames can realize the lightning animation effect of brightening and then dimming. Usually, the lightning animation effect will keep the brightness unchanged after gradually brightening. After a certain period of time or a preset number of image frames (that is, Fig. 9B The number of image frames shown is multiple), and then the brightness gradually dims, so that the user can experience the actual changes of lightning in thunderstorm weather and enhance the user experience.

[0225] Optionally, in some embodiments, in a weather application scenario, when the weather type information is thunderstorm weather, the second animation effect may also include a rain animation effect with gradual brightness change.

[0226] When the second animation effect is a rain animation effect with gradually changing brightness, the rain animation effect is an animation effect in which the brightness gradually darkens and then gradually brightens, or in other words, the rain animation effect is an animation effect in which the transparency gradually decreases and then gradually increases. Figure 10A-10C As shown, Fig. 10A The transparency is greater than Fig. 10B transparency, and Fig. 10A The transparency is greater than Fig. 10C transparency, Fig. 10C The transparency is greater than Fig. 10B Due to the difference in transparency, Fig. 10A The interface shown changes gradually from grayish white at the top of the interface to light gray at the bottom of the interface. Fig. 10B The interface shown changes gradually from dark gray at the top of the interface to gray-black at the bottom of the interface. Fig. 10C The interface shown in the figure changes from light gray at the top of the interface to dark gray at the bottom of the interface. Fig. 10A and Fig. 10C , it is obvious that Fig. 10A Compared to Fig. 10C The gray level is lighter. Figure 10A-10C The image frames can realize the rain animation effect of dimming and then brightening. Usually, the rain animation effect will keep the brightness unchanged after the brightness gradually dims. After a certain period of time or a preset number of image frames (that is, such as Fig. 10B The number of image frames shown is multiple), and the brightness gradually becomes brighter, so that the user can immersively experience the scene conditions in thunderstorm weather and enhance the user experience.

[0227] It should be understood that the three image frames in the above lightning animation effect and the three image frames in the rain animation effect are only for the convenience of illustrating the gradual change process of the animation effect. Usually, in order to ensure that the user can clearly observe the gradual change process of the lightning animation effect and the rain animation effect, multiple image frames are used to reflect the gradual change process of the animation effect. In addition, in order to distinguish different animation effects in the weather application, Figure 9A-9C The background color of the lightning animation effect in Figure 10A-10C The background color of the rain animation effect in .

[0228] It should also be understood that in order to highlight the gradual change effect of the lightning animation effect and the rain animation effect, Figure 9A-9C as well as Figure 10A-10C In the actual scenario, other information besides temperature is not shown. Figure 9A-9C as well as Figure 10A-10C Other information may also be included (for example, city information, air quality conditions, source of weather information and last update time, etc. as shown in 1B), which is not limited in this application.

[0229] After obtaining the mixed second number of image frames, the electronic device 100 may generate a second animation effect based on the mixed second number of image frames.

[0230] Additionally, the mixed second number of image frames may be stored in an array linked list.

[0231] S204, displaying a second animation effect.

[0232] It should be understood that the specific implementation process of S204 is the same as that of S103. Please refer to the relevant description of S103, which will not be repeated here.

[0233] In summary, the first animation effect of the embodiment of the present application can be displayed synchronously with the second animation effect, or other complex animation effects, so that the second animation effect can achieve a gradient animation effect. Compared with setting different color values ​​for each image frame in the second animation effect to achieve a gradient animation effect, the operation is simpler, the resource space occupied is smaller, and the gradient effect is more natural.

[0234] In the embodiment of the present application, the electronic device 100 may generate an image frame (the image frame may be a first image frame, a second image frame or a third image frame) in a variety of implementation methods.

[0235] Based on the above description, the following Fig.11 , describing in detail the specific implementation process of creating an array linked list and generating a first number of image frames (specifically including a second number of first image frames, second image frames, and a fourth number of third image frames) in an embodiment of the present application.

[0236] See also Fig.11 , Fig.11 FIG. 1 is a flow chart of a method for generating dynamic effects in an embodiment of the present application. Fig.11 As shown, the method for generating dynamic effects in the embodiment of the present application includes the following steps:

[0237] S301, initialize and assign a value to i. The initial value of i is 0. Exemplarily, the electronic device 100 may also create an array linked list, and initialize and assign a value to i in the array linked list. Thus, the generated image frames can be stored in the array linked list, and the generated image frames can be managed through the array linked list. The array linked list is located in the AAR layer of the software system.

[0238] S302, determining whether i is less than a first number.

[0239] Wherein, i is used to represent the number of image frames currently generated, and i is an integer greater than or equal to 0. That is, i is integer (int) data. The electronic device 100 can determine whether i is less than the first number. When i is less than the first number, the electronic device 100 can execute S303-S311. When i is greater than or equal to the first number, the electronic device 100 can execute S312.

[0240] Exemplarily, when i=1, it indicates that the electronic device 100 has generated an image frame.

[0241] S303: When i is less than the first number, determine whether i is less than or equal to the second number.

[0242] Wherein, the second number is the number of at least one first image frame. When it is determined that i is less than the first number, the electronic device 100 may determine that not all image frames have been generated. At this time, the electronic device 100 may continue to determine whether i is less than or equal to the second number. If so, the electronic device 100 may execute S304 and S305 to generate a first image frame. If not, the electronic device 100 may execute S306-S310 to generate a second image frame.

[0243] S304: When i is less than or equal to the second number, determine a first transparency parameter according to i and the second number.

[0244] When it is determined that i is less than the first number and less than or equal to the second number, the electronic device 100 may determine that not all first image frames have been generated. At this time, the electronic device 100 may determine a first transparency parameter based on i and the second number. Optionally, the first transparency parameter is a ratio of the number of image frames to the second number.

[0245] Exemplarily, the first transparency parameter satisfies the following formula:

[0246]

[0247] Wherein, alpha1 represents the first transparency parameter, i represents the number of image frames currently generated, m represents the second number, and m is a positive integer greater than or equal to 1.

[0248] S305: Generate a first image frame according to the first transparency parameter and the background color.

[0249] After determining the first transparency parameter, the electronic device 100 may generate a first image frame according to the first transparency parameter and the background color. After generating all the first image frames, the electronic device 100 may execute S306.

[0250] Optionally, in some embodiments, the specific implementation process of S305 includes: in the open graphics library view, setting a first color value of the first position and a second color value of the second position. Figure 6 As shown, the first color value at the first position is (255, 255, 255), or the top color (topColor). The second color value at the second position is (0, 0, 0), or the bottom color (bottomColor). After determining the first color value and the second color value, a linear interpolation process may be performed on the first color value and the second color value to obtain a background color that gradually changes from the first color value to the second color value.

[0251] It should be understood that the first color values ​​of different animation effects may be the same or different, and the second color values ​​of different animation effects may be the same or different, and this application does not limit this.

[0252] Exemplarily, the method of obtaining the background color may include: the electronic device 100 may set the image frame, or the top color of the background layer (background) to be the first color value, and the bottom color to be the second color value, thereby obtaining an image frame with an initial color, or the background layer. The vertex shader is used to determine the position of the image frame, so the electronic device 100 may determine the position of the image frame in the vertex shader based on the first coordinate, the second coordinate, the third coordinate, and the fourth coordinate. After determining the position of the image frame, the electronic device 100 may render and color the image frame through a fragment shader, and then bind the fragment shader and the image frame to obtain a background color with a gradient from the top color to the bottom color.

[0253] The fragment shader is used to render the image frame. The rendering method using the fragment shader is: the first color value is used as the top color of the top position of the vertex shader, and the second color value is used as the bottom color of the bottom position of the vertex shader. After rendering, it gradually changes from the top color to the bottom color. Therefore, there is no need to set the color of each image frame separately through the fragment shader, and the rendering operation is simpler.

[0254] Alternatively, in the open graphics library view, after the electronic device 100 sets the first color value and the second color value, it may also set multiple color values ​​between the first color value and the second color value in a certain step size, thereby obtaining a background color that gradually changes from the first color value to the second color value. The embodiment of the present application does not impose any specific restrictions on this.

[0255] In summary, the electronic device 100 can obtain the background color, thereby providing a color data basis for generating the first image frame.

[0256] Based on the above description, after obtaining the background color, the electronic device 100 may merge the first transparency parameter and the background color to obtain the first image frame.

[0257] Exemplarily, the electronic device 100 may use a fusion function (eg, Color.argb() method) to fuse the first transparency parameter alpha1 with the background color (including the RGB value of the top color and the RGB value of the bottom color) to obtain a first image frame with different transparency points.

[0258] S306: When i is greater than the second number, determine whether i is less than a third number.

[0259] The third number is the difference between the first number and the fourth number, and the fourth number is the number of at least one third image frame.

[0260] Exemplarily, the third quantity satisfies the following formula:

[0261] n = kq;

[0262] Wherein, n represents the third number, k represents the first number, q represents the fourth number, and n, k and q are all positive integers greater than or equal to 1.

[0263] When it is determined that i is greater than the second number, the electronic device 100 may determine whether i is less than the third number. If so, the electronic device 100 may execute S307 and S308 to generate a second image frame. If not, the electronic device 100 may execute S309 and S310 to generate a third image frame.

[0264] S307: When i is less than a third number, determine that the second transparency parameter is a maximum transparency value or a minimum transparency value in the transparency range.

[0265] When it is determined that i is greater than the second number and less than the third number, the electronic device 100 may determine that the second transparency parameter is the maximum transparency value or the minimum transparency value in the transparency range. Exemplarily, the transparency range is 0.0-1.0f. That is, the electronic device 100 may determine that the second transparency parameter alpha2 is 1.0f or 0.0.

[0266] S308: Generate a second image frame according to the second transparency parameter and the background color.

[0267] After determining the second transparency parameter, the electronic device 100 may generate a second image frame according to the second transparency parameter and the background color. When the second transparency parameter is 1.0f, the brightness of the second image frame is maximum, and when the second transparency parameter is 0, the brightness of the second image frame is minimum. After generating all the second image frames, the electronic device 100 may execute S309.

[0268] S309: When i is greater than or equal to the third number, determine a third transparency parameter according to the first number, i, and the fourth number.

[0269] When it is determined that i is greater than the second number and greater than or equal to the third number, the electronic device 100 may determine a third transparency parameter based on the first number, i, and the fourth number. Exemplarily, the third transparency parameter is a ratio of the fifth number to the fourth number, and the fifth number is a difference between the first number and i. The third transparency parameter satisfies the following formula:

[0270]

[0271] Among them, alpha3 represents the third transparency parameter, k represents the first number, i represents the number of image frames currently generated, and q represents the fourth number.

[0272] S310, generating a third image frame according to a third transparency parameter and a background color.

[0273] After determining the third transparency parameter, the electronic device 100 may generate a third image frame according to the third transparency parameter and the background color.

[0274] It should be understood that the implementation process of generating the second image frame in S308 and the third image frame in S310 is similar to the implementation process of generating the first image frame in S305, and reference may be made to the above description of generating the first image frame, which will not be repeated here.

[0275] S311, update i=i+1.

[0276] When the number of image frames that have been generated is i, the electronic device 100 may update i to i+1 and repeatedly execute S301 - S311 , so that the number of image frames that have been generated is updated to i+1.

[0277] S312: When i is greater than or equal to a first number, stop generating image frames.

[0278] When it is determined that i is greater than or equal to the first number, the electronic device 100 may determine that the generation of the first number of image frames is completed, or the construction of the first animation effect is completed. At this time, the electronic device 100 may stop generating image frames.

[0279] It should be understood that the first quantity is the sum of the second quantity, the fourth quantity and the number of second image frames. The first quantity, the second quantity, the fourth quantity and the number of second image frames can be set by the user, and the set values ​​are stored in the AAR layer of the software system. If only the first quantity, the second quantity and the fourth quantity are set, the number of second image frames is the difference between the first quantity and the second quantity and the fourth quantity.

[0280] It should be noted that S301-S312 can be applied to S101, so as to generate the first number of image frames. S301-S312 are only exemplary descriptions of the specific implementation process of generating image frames in the embodiment of the present application. Those skilled in the art can also expand other implementation processes based on the implementation process of S301-S312, and the present application does not limit this.

[0281] Illustratively, the present application provides a readable storage medium, in which a computer program is stored. The processor 110 calls instructions so that the electronic device 100 implements the method in the foregoing embodiment when executing.

[0282] Exemplarily, the present application provides a chip system, which is applied to an electronic device 100 including a memory, a display screen 194 and a sensor; the chip system includes: one or more interface circuits and one or more processors 110; the interface circuit and the processor 110 are interconnected through lines; the interface circuit is used to receive a signal from the memory and send a signal to the processor 110, the signal including a computer code or instruction stored in the memory; the processor 110 calls the instruction so that the electronic device 100 executes the method in the previous embodiment.

[0283] Exemplarily, the present application provides a computer program product, which enables the electronic device 100 to implement the method in the foregoing embodiment when the computer program product is executed on a computer.

[0284] In the above embodiments, all or part of the functions can be implemented by software, hardware, or a combination of software and hardware. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer codes or instructions. When the computer program code or instructions are loaded and executed on a computer, the process or function according to the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer code or instructions can be stored in a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integration. Available media can be magnetic media, (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media (e.g., solid state disk (SSD)), etc.

[0285] A person skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by a computer program to instruct the relevant hardware, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned method embodiments. The aforementioned storage medium includes: a read-only memory (ROM) or a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

Claims

1. A method for generating a dynamic effect, characterized in that: include: In response to information obtained from the application, a first number of image frames are generated, the first number of image frames comprising at least one first image frame, at least one second image frame, and at least one third image frame, the first image frame is generated based on a first transparency parameter and a background color, the second image frame is generated based on a second transparency parameter and the background color, the third image frame is generated based on a third transparency parameter and the background color, the background color refers to: the background color gradually changes from a first position in an open graphics library view to a second position in the open graphics library view; generating a first animation effect based on the first number of image frames, wherein the first animation effect comprises an animation effect of gradual brightness change; The first animation effect is displayed.

2. The method according to claim 1, characterized in that The first animation effect includes an animation effect in which the brightness gradually becomes brighter and then gradually becomes darker, or the first animation effect includes an animation effect in which the brightness gradually becomes darker and then gradually becomes brighter.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: acquiring a second number of image frames; Mixing the second number of image frames with the first number of image frames to obtain mixed second number of image frames; generating a second animation effect based on the mixed second number of image frames, where the second animation effect is an animation effect superimposed with the first animation effect; The second animation effect is displayed.

4. The method according to claim 3, characterized in that The information obtained from the application includes weather type information. When the weather type information is thunderstorm, the second animation effect includes a lightning animation effect with gradually changing brightness.

5. The method according to claim 3 or 4, characterized in that: The method further comprises: Based on the semi-transparent blending layer mode, the second number of image frames are blended with the first number of image frames to obtain the blended second number of image frames.

6. The method according to any one of claims 1 to 5, characterized in that: The generating a first number of image frames comprises: When i is less than a first number, determining whether i is less than or equal to a second number, where the second number is the number of the at least one first image frame, i represents the number of image frames currently generated, and i is an integer greater than or equal to 0; When the i is less than or equal to the second number, determining the first transparency parameter according to the i and the second number; The first image frame is generated according to the first transparency parameter and the background color.

7. The method according to claim 6, characterized in that The step of generating the first image frame according to the first transparency parameter and the background color includes: In the open graphics library view, setting a first color value of the first position and a second color value of the second position; Performing linear interpolation processing on the first color value and the second color value to obtain the background color; The first transparency parameter and the background color are merged to obtain the first image frame.

8. The method according to claim 7, characterized in that The first transparency parameter is the ratio of i and the second number.

9. The method according to any one of claims 6 to 8, characterized in that The generating of the first number of image frames further comprises: When i is greater than the second number, determining whether i is less than a third number, the third number being a difference between the first number and a fourth number, the fourth number being the number of the at least one third image frame; When the i is less than the third number, determining the second transparency parameter to be the maximum transparency value or the minimum transparency value in the transparency range; generating the second image frame according to the second transparency parameter and the background color; When the i is greater than or equal to the third number, determining the third transparency parameter according to the first number, the i and the fourth number; The third image frame is generated according to the third transparency parameter and the background color.

10. The method according to claim 9, characterized in that The third transparency parameter is a ratio of a fifth number to the fourth number, and the fifth number is a difference between the first number and i.

11. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the processor and the memory are coupled, the memory is used to store a computer program, and the processor calls instructions so that the electronic device executes the method according to any one of claims 1 to 10.

12. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and the processor calls instructions so that the electronic device executes any one of claims 1 to 10.

13. A chip system, characterized in that: The chip system is applied to an electronic device including a memory, a display screen and a sensor; the chip system includes: one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected through lines; the interface circuit is used to receive signals from the memory and send signals to the processor, and the signals include computer codes or instructions stored in the memory; the processor calls instructions so that the electronic device executes the method described in any one of claims 1 to 10.

Citation Information

Cited By

  • Dynamic effect display method, electronic device, readable storage medium and chip

    WO2026174804A1