A running light animation display method of a light string control program and a terminal
By generating LED bead graphics and using keyframe animation binding technology, the performance of the LED string control program was optimized, solving the performance consumption problem of the LED string control program when displaying animation effects, and realizing efficient display of marquee animation.
Patent Information
- Application Number
- CN202411869492.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2044-12-18
AI Technical Summary
Existing string light control programs consume a lot of resources when displaying animation effects, causing terminal devices to overheat and lag, which affects user experience and battery life.
Multiple LED bead shapes are generated by a shape generator to form a string of lights. A keyframe animation is generated by an animation generator, and the LED bead shapes are bound to the keyframe animation to achieve a marquee animation effect, reducing the burden of real-time calculation of the animation of each LED bead.
It improves the efficiency and smoothness of the marquee animation display, reduces the performance consumption of terminal devices, and enhances the user experience.
Smart Images

Figure CN119767484B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of display control technology, and in particular to a method and terminal for displaying a marquee animation using a string light control program. Background Technology
[0002] Smart Bluetooth string lights are lighting products that can be controlled via Bluetooth technology. They are widely used in home decoration, stage performances, and festival celebrations. Users can control the string lights using a control program on their terminal device. The control program displays animation effects on the terminal device and controls the Bluetooth string lights to display the same animation effects.
[0003] Existing string light control programs require real-time calculation of the color or position of each LED based on the animation's motion patterns and parameters when displaying animation effects. This results in the string light control program consuming a large amount of computing resources when processing complex animations or displaying multiple different animations simultaneously. This can easily cause the terminal device to overheat, lag, or even crash. The high performance consumption of the string light control program during operation not only reduces the smoothness of the program's operation but may also shorten the battery life of the terminal device, affecting the user's ability to control the Bluetooth string light display to show the running light animation. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method for displaying marquee animation in a Bluetooth light string control program, so as to solve the problem of high performance consumption in existing light string control programs when controlling the display animation effects of Bluetooth light strings.
[0005] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a method for displaying a running light animation in a string light control program, comprising the following steps:
[0006] S1: The shape generator generates multiple LED bead shapes, and the multiple LED bead shapes constitute a light string pattern;
[0007] S2: Animation generator generates keyframe animations;
[0008] S3: Bind the LED bead graphic to the keyframe animation, and add the LED string graphic to the display view to display the marquee animation effect of the LED string graphic.
[0009] Furthermore, in step S1, the shape generator generates multiple LED bead patterns, and the multiple LED bead patterns constitute a light string pattern, specifically including the following steps:
[0010] S11: Obtain preset graphic data;
[0011] S12: Generate multiple LED bead graphic objects that correspond one-to-one with the multiple LED bead graphics according to the preset graphic data, and store the multiple LED bead graphics in an LED bead graphic array.
[0012] Furthermore, the preset graphic data includes multiple LED parameters that correspond one-to-one with the multiple LED graphics, and the LED parameters include LED position parameters and LED graphic parameters;
[0013] In step S12, multiple LED bead graphic objects are generated based on the preset graphic data, and these multiple LED bead graphic objects are stored in an LED bead graphic array, specifically including:
[0014] S121: Create the array of LED bead patterns;
[0015] S122: Obtain the scaling factor based on the size of the view of the preset graphic data and the size of the display view;
[0016] S123: Traverse the LED parameters, obtain the LED graphic object according to the scaling factor and the LED parameters, and store the LED graphic object in the LED graphic array.
[0017] Furthermore, the preset graphic data also includes background parameters;
[0018] Step S1 further includes the step of generating a background graphic object based on the background parameters;
[0019] Step S3 further includes the step of adding the background graphic object to the display view to display the overall shape of the light string controlled by the light string control program in the display view.
[0020] Furthermore, in step S2, the animation generator generates keyframe animations, specifically including the following steps:
[0021] S21: Create a keyframe animation, wherein the key path of the keyframe animation is set to the fill color to control the color change of the LED bead graphic;
[0022] S22: Create a keyframe array to store keyframe elements, wherein the keyframe elements include the LED color and the number of times the LED color appears consecutively;
[0023] S23: The keyframe animation settings are multiple keyframes that correspond one-to-one with multiple keyframe elements.
[0024] Furthermore, in step S23, the keyframe animation setting includes multiple keyframes that correspond one-to-one with multiple keyframe elements, specifically including:
[0025] S231: Traverse the keyframe elements of the keyframe array to obtain the total number of times the light bead color appears, and calculate the total animation duration based on the preset light bead animation duration and the total number of times the light bead color appears;
[0026] S232: Obtain the keyframe corresponding to the keyframe element based on the number of times the color of the LED bead appears consecutively.
[0027] Furthermore, in step S3, the LED bead graphic is bound to the keyframe animation, and the LED string graphic is added to the display view to display the marquee animation effect of the LED string graphic. This specifically includes the following steps:
[0028] S31: Add animation effects to all the LED bead graphics based on the keyframe animation;
[0029] S32: Add the string of lights graphic to the display view, and all the light bead graphics generate animation effects according to the keyframe animation.
[0030] Furthermore, in step S31, animation effects are added to all the LED bead graphics based on the keyframe animation, specifically including:
[0031] Traverse the LED bead patterns that make up the LED string pattern, and set the animation start time of the traversed LED bead pattern according to the traversal index of the traversed LED bead pattern and the LED bead animation duration of the keyframe animation.
[0032] Furthermore, in step S31, adding animation effects to all the LED bead graphics according to the keyframe animation also includes: setting the traversal order according to the direction of the marquee animation, and traversing the LED bead graphics that constitute the LED string graphic according to the traversal order.
[0033] Another object of the present invention is to provide a string light control terminal, including a memory, a processor, and a string light control program stored in the memory and executable on the processor. When the processor executes the string light control program, it implements the above-mentioned marquee animation display method, which includes the following steps:
[0034] S1: The shape generator generates multiple LED bead shapes, and the multiple LED bead shapes constitute a light string pattern;
[0035] S2: Animation generator generates keyframe animations;
[0036] S3: Bind the LED bead graphic to the keyframe animation, and add the LED string graphic to the display view to display the marquee animation effect of the LED string graphic.
[0037] Furthermore, in step S2, the animation generator generates keyframe animations, specifically including the following steps:
[0038] S21: Create a keyframe animation, wherein the key path of the keyframe animation is set to the fill color to control the color change of the LED bead graphic;
[0039] S22: Create a keyframe array to store keyframe elements, wherein the keyframe elements include the LED color and the number of times the LED color appears consecutively;
[0040] S23: The keyframe animation settings are multiple keyframes that correspond one-to-one with multiple keyframe elements.
[0041] The beneficial effects of this invention are as follows: The marquee animation display method provided by this invention can generate multiple LED bead graphics through a shape generator, and the shape of the light string graphic is formed by multiple LED bead graphics. A unified animation effect is generated through an animation generator to simultaneously control the color changes of multiple LED bead graphics, so that the light string graphic can achieve a dynamic animation effect. At the same time, the performance of the light string control program is optimized, avoiding the operational burden of the light string control program to calculate the animation effect of each LED bead in real time. This marquee animation display method can improve the efficiency and smoothness of marquee animation display, reduce the performance consumption of the terminal device running the light string control program, and improve the user experience. Attached Figure Description
[0042] Figure 1 This is a flowchart of the steps of the marquee display method of the light string control program of the present invention;
[0043] Figure 2 This is a structural diagram of the light string control terminal described in this invention. Detailed Implementation
[0044] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.
[0045] Please refer to Figure 1 as well as Figure 2 This invention provides a method for displaying a running light animation in a string light control program, comprising the following steps:
[0046] S1: The shape generator generates multiple LED bead shapes, and the multiple LED bead shapes constitute a light string pattern;
[0047] S2: Animation generator generates keyframe animations;
[0048] S3: Bind the LED bead graphic to the keyframe animation, and add the LED string graphic to the display view to display the marquee animation effect of the LED string graphic.
[0049] As described above, the beneficial effects of this invention are as follows: The marquee animation display method provided by this invention can generate multiple LED bead graphics through a shape generator, and the multiple LED bead graphics form the shape of the light string graphic. A unified animation effect is generated through an animation generator to simultaneously control the color changes of multiple LED bead graphics, enabling the light string graphic to achieve a dynamic animation effect. At the same time, the performance of the light string control program is optimized, avoiding the operational burden of the light string control program calculating the animation effect of each LED bead in real time. This marquee animation display method can improve the efficiency and smoothness of marquee animation display, reduce the performance consumption of the terminal device running the light string control program, and improve the user experience.
[0050] Furthermore, in step S1, the shape generator generates multiple LED bead patterns, and the multiple LED bead patterns constitute a light string pattern, specifically including the following steps:
[0051] S11: Obtain preset graphic data;
[0052] S12: Generate multiple LED bead graphic objects that correspond one-to-one with the multiple LED bead graphics according to the preset graphic data, and store the multiple LED bead graphics in an LED bead graphic array.
[0053] Furthermore, the preset graphic data includes multiple LED parameters that correspond one-to-one with the multiple LED graphics, and the LED parameters include LED position parameters and LED graphic parameters;
[0054] In step S12, multiple LED bead graphic objects are generated based on the preset graphic data, and these multiple LED bead graphic objects are stored in an LED bead graphic array, specifically including:
[0055] S121: Create the array of LED bead patterns;
[0056] S122: Obtain the scaling factor based on the size of the view of the preset graphic data and the size of the display view;
[0057] S123: Traverse the LED parameters, obtain the LED graphic object according to the scaling factor and the LED parameters, and store the LED graphic object in the LED graphic array.
[0058] As described above, the shape generator can generate multiple LED bead graphic objects that correspond one-to-one with multiple LED bead graphics based on preset graphic data, and the multiple LED bead graphic objects are stored as an LED bead graphic array. The display view can draw multiple LED bead graphics based on the LED bead graphic array and fill the LED bead graphics with LED bead colors so as to form a light string graphic through multiple LED bead graphics.
[0059] Furthermore, the preset graphic data also includes background parameters;
[0060] Step S1 further includes the step of generating a background graphic object based on the background parameters;
[0061] Step S3 further includes the step of adding the background graphic object to the display view to display the overall shape of the light string controlled by the light string control program in the display view.
[0062] As described above, the display view can display the shape of the light string based on the background graphic object, and can display the layout position of each light bead in the light string, the size of each light bead, and the color of each light bead in the light string graphic display light string.
[0063] Furthermore, in step S2, the animation generator generates keyframe animations, specifically including the following steps:
[0064] S21: Create a keyframe animation, wherein the key path of the keyframe animation is set to the fill color to control the color change of the LED bead graphic;
[0065] S22: Create a keyframe array to store keyframe elements, wherein the keyframe elements include the LED color and the number of times the LED color appears consecutively;
[0066] S23: The keyframe animation settings are multiple keyframes that correspond one-to-one with multiple keyframe elements.
[0067] As described above, the method of the present invention fills the LED bead graphic with color according to keyframe animation to present an animation effect in which the LED bead graphic displays different LED bead colors in sequence. The keyframe animation sets a keyframe element for each LED bead color displayed by the LED bead graphic, and the LED bead graphic will change color in the corresponding keyframe to make the LED bead graphic present a smooth transition of LED bead color change animation effect.
[0068] Furthermore, in step S23, the keyframe animation setting includes multiple keyframes that correspond one-to-one with multiple keyframe elements, specifically including:
[0069] S231: Traverse the keyframe elements of the keyframe array to obtain the total number of times the light bead color appears, and calculate the total animation duration based on the preset light bead animation duration and the total number of times the light bead color appears;
[0070] S232: Obtain the keyframe corresponding to the keyframe element based on the number of times the color of the LED bead appears consecutively.
[0071] As described above, in the method provided by the present invention, the total duration of the animation is calculated by traversing the keyframe elements of the keyframe array, and keyframes are obtained based on the total duration of the animation and the keyframe elements.
[0072] Furthermore, in step S3, the LED bead graphic is bound to the keyframe animation, and the LED string graphic is added to the display view to display the marquee animation effect of the LED string graphic. This specifically includes the following steps:
[0073] S31: Add animation effects to all the LED bead graphics based on the keyframe animation;
[0074] S32: Add the string of lights graphic to the display view, and all the light bead graphics generate animation effects according to the keyframe animation.
[0075] As described above, all LED patterns are bound to the corresponding keyframes in the keyframe animation based on their LED colors. All LED patterns in the LED string can share a single keyframe animation, and the animation effects produced by each LED pattern are consistent, with only the animation start time differing. This can reduce the memory usage and performance consumption of the LED string control program.
[0076] Furthermore, in step S31, animation effects are added to all the LED bead graphics based on the keyframe animation, specifically including:
[0077] Traverse the LED bead patterns that make up the LED string pattern, and set the animation start time of the traversed LED bead pattern according to the traversal index of the traversed LED bead pattern and the LED bead animation duration of the keyframe animation.
[0078] As described above, the method provided by the present invention can set a time difference between the start times of the animation of two adjacent LED bead patterns. For example, the start times of the animation of two adjacent LED bead patterns are different by one LED bead animation duration. In this way, the LEDs can be lit up in sequence with preset LED bead colors to form a running light animation effect of a continuously moving LED string pattern.
[0079] Furthermore, in step S31, adding animation effects to all the LED bead graphics according to the keyframe animation also includes: setting the traversal order according to the direction of the marquee animation, and traversing the LED bead graphics that constitute the LED string graphic according to the traversal order.
[0080] As can be seen from the above description, the marquee animation display method provided by the present invention can produce both positive and negative animation effects.
[0081] Another objective of this invention is to provide a string light control terminal, including a memory, a processor, and a string light control program stored in the memory and executable on the processor. When the processor executes the string light control program, it implements the aforementioned marquee animation display method, comprising the following steps:
[0082] S1: The shape generator generates multiple LED bead shapes, and the multiple LED bead shapes constitute a light string pattern;
[0083] S2: Animation generator generates keyframe animations;
[0084] S3: Bind the LED bead graphic to the keyframe animation, and add the LED string graphic to the display view to display the marquee animation effect of the LED string graphic.
[0085] Furthermore, in step S2, the animation generator generates keyframe animations, specifically including the following steps:
[0086] S21: Create a keyframe animation, wherein the key path of the keyframe animation is set to the fill color to control the color change of the LED bead graphic;
[0087] S22: Create a keyframe array to store keyframe elements, wherein the keyframe elements include the LED color and the number of times the LED color appears consecutively;
[0088] S23: The keyframe animation settings are multiple keyframes that correspond one-to-one with multiple keyframe elements.
[0089] Example 1
[0090] Please refer to Figure 1 and Figure 2 The first embodiment of the present invention is: to provide a method for displaying a marquee animation in a string light control software, so as to solve the problem of high performance consumption when the existing string light control program controls the display animation effect of Bluetooth string lights.
[0091] Specifically, the marquee animation display method provided in this embodiment includes step S1: a shape generator generates multiple LED bead graphics, and the multiple LED bead graphics constitute a string of lights.
[0092] In this embodiment, the shape generator is used to generate different shapes of light string graphics according to the user's selection, such as Christmas trees, eaves lights, fence lights, etc.
[0093] Step S1 above specifically includes the following steps:
[0094] S11: Obtain preset graphic data.
[0095] First, the user can select a shape enumeration value through the string light control program, such as "Christmas tree". The string light control program then obtains the preset graphic data of the selected shape enumeration value.
[0096] The aforementioned preset graphic data includes background parameters and multiple LED parameters that correspond one-to-one with the multiple LED graphics. The LED parameters include LED position parameters and LED graphic parameters.
[0097] S12: Generate a background graphic object according to the background parameters; generate multiple LED graphic objects that correspond one-to-one with the multiple LED graphic objects according to the preset graphic data, and store the multiple LED graphic objects in an LED graphic array.
[0098] In this embodiment, after obtaining the preset graphic data, the shape generator can use CAShapeLayer to draw a background graphic based on the background parameters. CAShapeLayer serves as a container for graphic drawing, and by adding a background image, it presents the overall shape of the light string and generates a background graphic object so that the display view can display the overall shape of the light string based on the background graphic object.
[0099] In step S12 of this embodiment, multiple LED bead graphic objects corresponding one-to-one with the multiple LED bead graphics are generated according to the preset graphic data, and the multiple LED bead graphics are stored in an LED bead graphic array. Specifically, this includes the following steps:
[0100] S121: Create the LED bead graphic array. First, create an LED bead graphic array to store each LED bead graphic object. In this embodiment, the shape generator can use CAShapeLayer to draw each LED bead graphic based on the LED bead data. Therefore, the LED bead graphic object can be a CAShapeLayer object, and the LED bead graphic array can be an array used to store multiple CAShapeLayer objects.
[0101] S122: Obtain a scaling factor based on the size of the view of the preset graphic data and the width of the display view. This scaling factor is used to adjust the position and size of the generated LED bead graphic object so that the LED string graphic can fit the display area of the display view when added to the display view.
[0102] S123: Iterate through the LED parameters, and obtain LED graphic objects based on the scaling factor and the LED parameters. The LED graphic objects are stored in the LED graphic array. The position and shape parameters of the LED graphic objects corresponding to the LED graphics are scaled according to the view size of the display view to calculate the LED view position and shape parameters on the display view, ensuring that each LED graphic can be correctly displayed on the actual view.
[0103] In this embodiment, the LED bead graphics can be drawn according to the following steps: Based on the LED bead graphic parameters and LED bead position parameters of the LED bead graphic object, a circular vector graphic path is created for each LED bead graphic using the CGPathCreateWithEllipseInRect method to display the shape of the LED bead graphic. The fillColor property of each LED bead graphic object is set to the LED bead color to ensure that each LED bead graphic has the correct display color.
[0104] In this embodiment, through steps S11 to S12 described above, the shape generator is ultimately able to generate a background graphic object and an array of LED graphic objects containing all the LED graphic objects. These graphic objects will be used for subsequent animation and effects rendering.
[0105] The marquee animation display method provided in this embodiment also includes step S2: the animation generator generates keyframe animation.
[0106] The animation generator's role is to create a unified animation effect for the entire marquee animation. In this embodiment, the animation generator can control the color changes of the LED bead graphic using the `values` property of `CAKeyframeAnimation`. By controlling the sequential changes in the LED bead colors, the marquee animation effect is achieved. In this embodiment, the keyframe animation sets a keyframe element for each LED bead color displayed by the LED bead graphic, and sets keyframes based on the keyframe elements, so that the LED bead graphic can change the displayed LED bead color at the keyframe, thereby producing a marquee animation effect for the LED string graphic.
[0107] Step S2 above specifically includes the following steps:
[0108] S21: Create a keyframe animation, wherein the key path of the keyframe animation is set to the fill color to control the color change of the LED graphic.
[0109] In this embodiment, the animation generator creates a keyframe animation using CAKeyframeAnimation. The keyPath property of this keyframe animation is set to fillColor to control the color changes of the LED graphic. The goal of the keyframe animation is to make the color changes of the LED graphic smooth and continuous; therefore, the repeatCount of the keyframe animation is set to HUGE_VALF to ensure that the animation can continuously loop.
[0110] S22: Create a keyframe array to store keyframe elements, wherein the keyframe elements include the LED color and the number of times the LED color appears consecutively.
[0111] The animation generator obtains the colors that the LED bead graphic needs to display, as well as the number of consecutive occurrences of each LED bead color, to construct keyframe elements. This allows the LED bead graphic to display different LED bead colors based on each keyframe element in the keyframe array. Furthermore, the duration of the LED bead color displayed by the LED bead graphic is generated based on the number of consecutive occurrences of the LED bead color in its corresponding keyframe element.
[0112] As an example: if the keyframe array includes keyframe elements (redColor, 10), (greenColor, 10), and (blueColor, 10), then the keyframe element (redColor, 10) represents the display of the red LED color 10 times consecutively in the string light graphic. Based on this keyframe array, the LED graphic can produce the following animation effects in sequence: the LED graphic displays the red LED color 10 times consecutively, then the LED graphic displays the green LED color 10 times consecutively, and finally the LED graphic displays the blue LED color 10 times consecutively.
[0113] S23: The keyframe animation settings are multiple keyframes that correspond one-to-one with multiple keyframe elements.
[0114] The animation generator assigns an array of keyframes to the `values` property of `CAKeyframeAnimation`. The `values` property of `CAKeyframeAnimation` stores a set of LED colors that need to be displayed in the LED graphic, and sets a keyframe for each LED color displayed in the graphic, ensuring that the LED graphic can display different LED colors at different times.
[0115] Specifically, step S23 above includes the following steps:
[0116] S231: Traverse the keyframe elements of the keyframe array to obtain the total number of times the light bead color appears, and calculate the total animation duration based on the preset light bead animation duration and the total number of times the light bead color appears.
[0117] By iterating through the keyframe array, the total animation duration for the LED graphic to complete one animation effect can be calculated. Simply put, multiplying the total number of times the LED graphic displays its color by the preset LED animation duration gives the total animation duration. Therefore, adjusting the preset LED animation duration allows control over the playback speed of the marquee animation effect.
[0118] As an example: the keyframe array includes keyframe elements (redColor, 10), (greenColor, 10), and (blueColor, 10), and the preset LED animation duration is 0.1 seconds. Therefore, the LED graphic needs to display the LED color 10 + 10 + 10 = 30 times according to the keyframe array. Thus, the total animation duration is 30 * 0.1 = 3 seconds.
[0119] S232: Obtain the keyframe corresponding to the keyframe element based on the number of times the color of the LED bead appears consecutively.
[0120] Each keyframe element in the keyframe array corresponds to a keyframe. Keyframes are calculated based on the number of consecutive occurrences of the LED color. Specifically, when traversing the LED graphic, the number of consecutive occurrences of the LED color required for the currently traversed LED graphic is divided by the total number of times the LED color needs to be displayed in the LED graphic. This gives the position of the keyframe corresponding to the keyframe element in the marquee animation. The change in LED color for each LED graphic will occur at the corresponding keyframe to ensure a smooth transition of LED colors in the LED graphic.
[0121] As an example: The keyframe array includes keyframe elements (redColor, 10), (greenColor, 10), and (blueColor, 10). The keyframe range is set to 0-1, with 0 for the start of the animation and 1 for the end. Based on the above keyframe array, a total of 3 keyframes can be obtained: the keyframe for the red LED color is 0 / 30=0; the keyframe for the green LED color is 10 / 30=0.333; and the keyframe for the blue LED color is (10+10) / 30=0.666.
[0122] The marquee animation display method provided in this embodiment further includes step S3: binding the LED bead graphic with the keyframe animation, and adding the LED string graphic to the display view to display the marquee animation effect of the LED string graphic.
[0123] In step S3 of this embodiment, each LED bead graphic needs to be bound to a keyframe animation so that the view can display the marquee animation effect of the LED string graphic.
[0124] Step S3 above specifically includes the following steps:
[0125] S31: Add the background graphic object to the display view to display the overall shape of the light string controlled by the light string control program in the display view; add animation effects to all the light bead graphics according to the keyframe animation.
[0126] In step S3, the background graphic object from step S12 is first added to the layer of the display view. This background graphic object contains only the background image and does not include other shapes or LED bead graphics. Adding the background graphic object to the display view presents the overall appearance of the string of lights, providing background support for subsequent animation effects.
[0127] S32: Add the string of lights graphic to the display view, and all the light bead graphics generate animation effects according to the keyframe animation.
[0128] The above step S32 specifically includes the following steps: traversing the LED bead patterns that constitute the LED string pattern; setting the animation start time of the traversed LED bead pattern according to the traversal index of the traversed LED bead pattern and the LED bead animation duration of the keyframe animation.
[0129] Specifically, step S32 includes:
[0130] S321: Traverse the array of LED bead patterns.
[0131] The marquee animation display method provided in this embodiment can set the traversal order according to the direction of the marquee animation, and traverse the LED patterns that make up the light string graphic according to the traversal order. As an example: if the selected marquee animation direction is forward, then the LED pattern array is traversed in forward order; if the selected marquee animation direction is reverse, then the LED pattern data is traversed in reverse order, so that the last LED pattern in the light string graphic starts animate first, achieving the effect of reverse lighting.
[0132] S322: Set the start time of the keyframe animation. For each LED graphic object in the array of LED graphic objects that are traversed, set the beginTime property of the keyframe animation created in step S21 to CACurrentMediaTime()+i×preset LED animation duration; where i is the index of the current traversal, and the initial value of i is 0.
[0133] The preset animation duration is used to control the offset effect of the animation start time of adjacent LED bead graphics. In this way, the animation start time of two adjacent LED bead graphics differs by a preset animation duration, so that adjacent LED bead graphics in the light string graphic light up in sequence, forming a continuously moving marquee effect.
[0134] S323: Add keyframe animation to the LED graphic object.
[0135] All the LED patterns in the string light graphic share a single keyframe animation, and the animation effects of the keyframe animation are consistent. The animation start times of the LED patterns in the string light graphic are different, which can effectively reduce the memory usage and performance consumption of the string light control program.
[0136] S324: Add the array of LED bead graphics to the view's layer. After this step, all LED bead graphics will be displayed on the view, and the colors of the LED beads will change sequentially according to the keyframe animation settings to create a marquee animation effect for the LED string graphics.
[0137] In summary, the marquee animation display method provided by this invention can generate multiple LED bead graphics through a shape generator, and these multiple LED bead graphics form the shape of a light string graphic. An animation generator then generates a unified animation effect to simultaneously control the color changes of multiple LED bead graphics, enabling the light string graphic to achieve a dynamic animation effect. Simultaneously, it optimizes the performance of the light string control program, avoiding the operational burden of real-time calculation of the animation effect of each LED bead. This marquee animation effect control method provides high-performance, customizable marquee animation effects, satisfying users' personalized needs for dynamic lighting effects while reducing the performance consumption of terminal devices, thus improving the overall user experience. This marquee animation display method can improve the efficiency and smoothness of marquee animation display, reduce the performance consumption of terminal devices running the light string control program, and enhance the user experience.
[0138] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for displaying a marquee animation of a light string control program, characterized by, The method comprises the following steps: S1: a shape generator generates a plurality of lamp bead patterns, and the plurality of lamp bead patterns constitute a lamp string pattern; S2: an animation generator generates a keyframe animation; S3: the lamp bead patterns are bound with the keyframe animation, and the lamp string pattern is added to a display view to display a marquee animation effect of the lamp string pattern; In the step S2, the animation generator generates a keyframe animation, specifically comprising the following steps: S21: a keyframe animation is created, and a key path of the keyframe animation is set as a fill color to control color change of the lamp bead patterns; S22: a keyframe array for storing keyframe elements is created, and the keyframe elements include a lamp bead color and a number of continuous appearances of the lamp bead color; S23: the keyframe animation is set with a plurality of keyframes corresponding to a plurality of keyframe elements.
2. The marquee animation display method according to claim 1, characterized by In the step S1, the shape generator generates a plurality of lamp bead patterns, and the plurality of lamp bead patterns constitute a lamp string pattern, specifically comprising the following steps: S11: preset pattern data is acquired; S12: a plurality of lamp bead pattern objects corresponding to the plurality of lamp bead patterns are generated according to the preset pattern data, and the plurality of lamp bead patterns are stored in a lamp bead pattern array.
3. The marquee animation display method according to claim 2, characterized by The preset pattern data includes a plurality of lamp bead parameters corresponding to the plurality of lamp bead patterns, and the lamp bead parameters include a lamp bead position parameter and a lamp bead pattern parameter; In the step S12, the plurality of lamp bead pattern objects are generated according to the preset pattern data, and the plurality of lamp bead pattern objects are stored in the lamp bead pattern array, specifically comprising: S121: the lamp bead pattern array is created; S122: a scaling factor is acquired according to a size of a view of the preset pattern data and a size of the display view; S123: the lamp bead pattern objects are acquired according to the scaling factor and the lamp bead parameters by traversing the lamp bead parameters, and the lamp bead pattern objects are stored in the lamp bead pattern array.
4. The marquee animation display method according to claim 2, characterized by The preset pattern data further includes a background parameter; In the step S1, a background pattern object is further generated according to the background parameter; In the step S3, the background pattern object is further added to the display view to display an overall shape of the lamp string controlled by the lamp string control program in the display view.
5. The marquee animation display method according to claim 1, characterized by In the step S23, the keyframe animation is set with a plurality of keyframes corresponding to a plurality of keyframe elements, specifically comprising: S231: a total number of appearances of the lamp bead color is acquired by traversing the keyframe elements of the keyframe array, so as to calculate an animation total duration according to a preset lamp bead animation duration and the total number of appearances of the lamp bead color; S232: a keyframe corresponding to the keyframe element is acquired according to the number of continuous appearances of the lamp bead color.
6. The marquee animation display method according to claim 1, characterized by In the step S3, the lamp bead patterns are bound with the keyframe animation, and the lamp string pattern is added to the display view to display the marquee animation effect of the lamp string pattern, specifically comprising the following steps: S31: animation effects are added to all the lamp bead patterns according to the keyframe animation; S32: adding the light string pattern into the display view, and animating all the lamp bead patterns according to the keyframe animation.
7. The marquee animation display method according to claim 6, characterized by In the step S31, the animation is added to all the lamp bead patterns according to the keyframe animation, specifically including: Traversing the lamp bead patterns constituting the light string pattern, and setting the animation start time of the traversed lamp bead pattern according to the traversed index of the traversed lamp bead pattern and the lamp bead animation time length of the keyframe animation.
8. The marquee animation display method according to claim 7, characterized by, In the step S31, the animation is added to all the lamp bead patterns according to the keyframe animation, and further including: setting the traversal order according to the direction of the marquee animation, and traversing the lamp bead patterns constituting the light string pattern according to the traversal order.
9. A light string control terminal comprising a memory, a processor, and a light string control program stored on the memory and executable on the processor, wherein, The processor executes the light string control program to realize the marquee animation display method of any one of claims 1 to 8, which includes the following steps: S1: a shape generator generates a plurality of lamp bead patterns, and the plurality of lamp bead patterns constitute a light string pattern; S2: an animation generator generates a keyframe animation; S3: the lamp bead patterns are bound with the keyframe animation, and the light string pattern is added into a display view to display the marquee animation effect of the light string pattern.
10. The string of lights control terminal according to claim 9, characterized in that, In the step S2, the animation generator generates a keyframe animation, specifically including the following steps: S21: creating a keyframe animation, and setting the key path of the keyframe animation as a fill color to control the color change of the lamp bead pattern; S22: creating a keyframe array for storing keyframe elements, and the keyframe elements include a lamp bead color and the number of continuous appearances of the lamp bead color; S23: the keyframe animation is set with a plurality of keyframes corresponding to a plurality of keyframe elements.
Citation Information
Patent Citations
LED lamp string pattern dynamic control method
CN116994521A
Lamp effect control method, device, equipment and medium
CN117615492A