Marquee animation display method of string light control program and terminal
By generating multiple lamp bead graphics and unified animation effects, the problem of high performance consumption of the lamp string control program when displaying animations is solved, and efficient and smooth marble animation display is achieved, improving the user experience.
Patent Information
- Application Number
- CN202411869492.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-18
AI Technical Summary
The existing light string control program consumes a lot of performance when controlling Bluetooth light string display animation effects, causing terminal devices to heat up, stutter, and even causing program crashes.
The shape generator generates multiple lamp bead graphics, and the shape of the lamp string graphics is formed by multiple lamp bead graphics. The animation generator generates a unified animation effect to control the color changes of multiple lamp bead graphics at the same time, so that the lamp string graphics can achieve dynamic animation effects.
This method optimizes the performance of the light string control program, avoids the running burden of calculating the animation effect of each light bead in real time, improves the efficiency and fluency of the marble animation display, reduces the performance consumption of terminal devices, and improves the user experience.
Smart Images

Figure CN119767484A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of display control technology, and in particular to a method and a terminal for displaying a marquee animation of a light string control program. Background Art
[0002] Smart Bluetooth light strings are lighting products that can be controlled via Bluetooth technology and are widely used in home decoration, stage performances, festivals and celebrations. Users can control the light strings according to the light string control program on the terminal device. The light string control program will display animation effects on the terminal device and control the Bluetooth light string to display the same animation effects.
[0003] When displaying animation effects, the existing light string control program needs to calculate the color or position of each lamp bead in real time according to the movement laws and parameters of the animation. As a result, when processing complex animations or displaying multiple different animations at the same time, the light string control program needs to use a large amount of computing resources, which can easily cause the terminal device to heat up, freeze, or even cause the program to crash. The light string control program has high performance consumption during operation, which not only reduces the running smoothness of the light string control program, but may also shorten the battery life of the terminal device, affecting the user's use of the terminal device to control the Bluetooth light string to display the marquee animation. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a method for displaying a marquee animation for a Bluetooth light string control program, so as to solve the problem of high performance consumption of the existing light string control program when controlling the Bluetooth light string to display animation effects.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is: a method for displaying a marquee animation of a light string control program, comprising 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: Animation generator generates key frame animation; S3: Bind the lamp bead graphic with the key frame animation, and add the light string graphic to the display view to display the marquee animation effect of the light string graphic.
[0006] Further, in step S1, the shape generator generates a plurality of lamp bead patterns, and the plurality of lamp bead patterns constitute a light string pattern, specifically including the following steps: S11: Obtaining preset graphic data; S12: generating a plurality of lamp bead graphic objects corresponding one-to-one to the plurality of lamp bead graphics according to the preset graphic data, and storing the plurality of lamp bead graphics in a lamp bead graphic array.
[0007] Further, the preset graphic data includes a plurality of lamp bead parameters corresponding to the plurality of lamp bead graphics one by one, and the lamp bead parameters include lamp bead position parameters and lamp bead graphic parameters; In the step S12, a plurality of lamp bead graphic objects are generated according to the preset graphic data, and the plurality of lamp bead graphic objects are stored in a lamp bead graphic array, specifically including: S121: Create the lamp bead graphic array; S122: Acquire a scaling factor according to the size of the view of the preset graphic data and the size of the display view; S123: traverse the lamp bead parameters, and obtain a lamp bead graphic object according to the scaling factor and the lamp bead parameters, and the lamp bead graphic object is stored in the lamp bead graphic array.
[0008] Furthermore, the preset graphic data also includes background parameters; The step S1 also includes the steps of: generating a background graphic object according to the background parameters; The step S3 also includes the step of adding the background graphic object to the display view, so as to display the overall shape of the light string controlled by the light string control program in the display view.
[0009] Furthermore, in step S2, the animation generator generates a key frame animation, which specifically includes the following steps: S21: creating a key frame animation, wherein the key path of the key frame animation is set as a fill color to control the color change of the lamp bead graphic; S22: creating a key frame array for storing key frame elements, wherein the key frame elements include lamp bead colors and the number of times the lamp bead colors appear continuously; S23: The key frame animation sets a plurality of key frames corresponding to the plurality of key frame elements one by one.
[0010] Furthermore, in step S23, the key frame animation sets a plurality of key frames corresponding to the plurality of key frame elements one by one, specifically including: S231: traverse the key frame elements of the key frame array to obtain the total number of times the lamp bead color appears, so as to calculate the total animation duration according to the preset lamp bead animation duration and the total number of times the lamp bead color appears; S232: Obtain a key frame corresponding to the key frame element according to the number of times the lamp bead color appears continuously.
[0011] Further, in step S3, the lamp bead graphic is bound to the key frame animation, and the light string graphic is added to the display view to display the marquee animation effect of the light string graphic, which specifically includes the following steps: S31: adding animation effects to all the lamp bead graphics according to the key frame animation; S32: adding the light string graphics to the display view, and all the lamp bead graphics generate animation effects according to the key frame animation.
[0012] Furthermore, in the step S31, adding animation effects to all the lamp bead graphics according to the key frame animation specifically includes: The lamp bead graphics constituting the lamp string graphics are traversed, and the animation start time of the traversed lamp bead graphics is set according to the traversal index of the traversed lamp bead graphics and the lamp bead animation duration of the key frame animation.
[0013] Furthermore, in the step S31, adding animation effects to all the lamp bead graphics according to the key frame animation also includes: setting a traversal order according to the direction of the marquee animation, and traversing the lamp bead graphics constituting the light string graphics according to the traversal order.
[0014] Another object of the present invention is to provide a light string control terminal, comprising a memory, a processor, and a light string control program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned marquee animation display method when executing the light string control program, and 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: Animation generator generates key frame animation; S3: Bind the lamp bead graphic with the key frame animation, and add the light string graphic to the display view to display the marquee animation effect of the light string graphic.
[0015] Furthermore, in step S2, the animation generator generates a key frame animation, which specifically includes the following steps: S21: creating a key frame animation, wherein the key path of the key frame animation is set as a fill color to control the color change of the lamp bead graphic; S22: creating a key frame array for storing key frame elements, wherein the key frame elements include lamp bead colors and the number of times the lamp bead colors appear continuously; S23: The key frame animation sets a plurality of key frames corresponding to the plurality of key frame elements one by one.
[0016] The beneficial effects of the present invention are: the marquee animation display method provided by the present invention can generate multiple lamp bead graphics through a shape generator, and the shape of the light string graphics is composed of multiple lamp bead graphics, and a unified animation effect is generated through the animation generator to simultaneously control the color changes of multiple lamp bead graphics, so that the light string graphics can achieve dynamic animation effects, and at the same time optimize the performance of the light string control program to avoid the operating burden of the light string control program to calculate the animation effects of each lamp bead in real time. The marquee animation display method can improve the efficiency and smoothness of the marquee animation display, reduce the performance consumption of the terminal device running the light string control program, and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A flowchart of the steps of the marquee display method of the light string control program of the present invention; Figure 2 This is a structural diagram of the light string control terminal described in the present invention. DETAILED DESCRIPTION
[0018] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.
[0019] Please refer to Figure 1 as well as Figure 2 The present invention provides a method for displaying a marquee animation of a light string control program, comprising 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: Animation generator generates key frame animation; S3: Bind the lamp bead graphic with the key frame animation, and add the light string graphic to the display view to display the marquee animation effect of the light string graphic.
[0020] From the above description, it can be seen that the beneficial effects of the present invention are: the marquee animation display method provided by the present invention can generate multiple lamp bead graphics through a shape generator, and the shape of the light string graphics is composed of multiple lamp bead graphics, and a unified animation effect is generated through the animation generator to simultaneously control the color changes of multiple lamp bead graphics, so that the light string graphics can achieve dynamic animation effects, and at the same time optimize the performance of the light string control program to avoid the operating burden of the light string control program to calculate the animation effects of each lamp bead in real time. The marquee animation display method can improve the efficiency and smoothness of the marquee animation display, reduce the performance consumption of the terminal device running the light string control program, and improve the user experience.
[0021] Further, in step S1, the shape generator generates a plurality of lamp bead patterns, and the plurality of lamp bead patterns constitute a light string pattern, specifically including the following steps: S11: Obtaining preset graphic data; S12: generating a plurality of lamp bead graphic objects corresponding one-to-one to the plurality of lamp bead graphics according to the preset graphic data, and storing the plurality of lamp bead graphics in a lamp bead graphic array.
[0022] Further, the preset graphic data includes a plurality of lamp bead parameters corresponding to the plurality of lamp bead graphics one by one, and the lamp bead parameters include lamp bead position parameters and lamp bead graphic parameters; In the step S12, a plurality of lamp bead graphic objects are generated according to the preset graphic data, and the plurality of lamp bead graphic objects are stored in a lamp bead graphic array, specifically including: S121: Create the lamp bead graphic array; S122: Acquire a scaling factor according to the size of the view of the preset graphic data and the size of the display view; S123: traverse the lamp bead parameters, and obtain a lamp bead graphic object according to the scaling factor and the lamp bead parameters, and the lamp bead graphic object is stored in the lamp bead graphic array.
[0023] From the above description, it can be seen that the shape generator can generate multiple lamp bead graphic objects corresponding one-to-one to multiple lamp bead graphics according to preset graphic data, and the multiple lamp bead graphic objects are stored as a lamp bead graphic array. The display view can draw multiple lamp bead graphics according to the lamp bead graphic array, and fill the lamp bead graphics with lamp bead colors to form a light string graphic through multiple lamp bead graphics.
[0024] Furthermore, the preset graphic data also includes background parameters; The step S1 also includes the steps of: generating a background graphic object according to the background parameters; The step S3 also includes the step of adding the background graphic object to the display view, so as to display the overall shape of the light string controlled by the light string control program in the display view.
[0025] From the above description, it can be seen that the display view can display the shape of the light string according to the background graphic object, and can display the layout position of each lamp bead in the light string, the size of each lamp bead, and the color of each lamp bead in the light string according to the lamp bead graphic array.
[0026] Furthermore, in step S2, the animation generator generates a key frame animation, which specifically includes the following steps: S21: creating a key frame animation, wherein the key path of the key frame animation is set as a fill color to control the color change of the lamp bead graphic; S22: creating a key frame array for storing key frame elements, wherein the key frame elements include lamp bead colors and the number of times the lamp bead colors appear continuously; S23: The key frame animation sets a plurality of key frames corresponding to the plurality of key frame elements one by one.
[0027] From the above description, it can be seen that the method of the present invention fills the color of the lamp bead graphic according to the key frame animation to present an animation effect in which the lamp bead graphic displays different lamp bead colors in sequence. The key frame animation sets a key frame element for each lamp bead color displayed by the lamp bead graphic. The lamp bead graphic will change color in the corresponding key frame to make the lamp bead graphic present a smooth transition of the lamp bead color change animation effect.
[0028] Furthermore, in step S23, the key frame animation sets a plurality of key frames corresponding to the plurality of key frame elements one by one, specifically including: S231: traverse the key frame elements of the key frame array to obtain the total number of times the lamp bead color appears, so as to calculate the total animation duration according to the preset lamp bead animation duration and the total number of times the lamp bead color appears; S232: Obtain a key frame corresponding to the key frame element according to the number of times the lamp bead color appears continuously.
[0029] It can be seen from the above description that in the method provided by the present invention, the total duration of the animation is calculated by traversing the key frame elements of the key frame array, and the key frames are obtained according to the total duration of the animation and the key frame elements.
[0030] Further, in step S3, the lamp bead graphic is bound to the key frame animation, and the light string graphic is added to the display view to display the marquee animation effect of the light string graphic, which specifically includes the following steps: S31: adding animation effects to all the lamp bead graphics according to the key frame animation; S32: adding the light string graphics to the display view, and all the lamp bead graphics generate animation effects according to the key frame animation.
[0031] From the above description, it can be seen that all lamp bead graphics are bound to the corresponding key frames in the key frame animation according to their lamp bead colors. All lamp bead graphics of the light string graphics can share a key frame animation, and the animation effects produced by each lamp bead graphics are consistent. Only the animation start time is different, which can reduce the memory usage and performance consumption of the light string control program.
[0032] Furthermore, in the step S31, adding animation effects to all the lamp bead graphics according to the key frame animation specifically includes: The lamp bead graphics constituting the lamp string graphics are traversed, and the animation start time of the traversed lamp bead graphics is set according to the traversal index of the traversed lamp bead graphics and the lamp bead animation duration of the key frame animation.
[0033] From the above description, it can be seen that the method provided by the present invention can set the time difference of the animation start time for two adjacent lamp bead graphics. For example, the animation start time of two adjacent lamp bead graphics differs by one lamp bead animation duration. In this way, the lamp beads can light up the preset lamp bead colors in turn, forming a marquee animation effect of a continuously moving light string graphic.
[0034] Furthermore, in the step S31, adding animation effects to all the lamp bead graphics according to the key frame animation also includes: setting a traversal order according to the direction of the marquee animation, and traversing the lamp bead graphics constituting the light string graphics according to the traversal order.
[0035] It can be seen from the above description that the marquee animation display method provided by the present invention can produce positive animation effects and reverse animation effects.
[0036] Another object of the present invention is to provide a light string control terminal, comprising a memory, a processor, and a light string control program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned marquee animation display method when executing the light string control program, and the following steps are performed: S1: a shape generator generates a plurality of lamp bead patterns, and the plurality of lamp bead patterns constitute a lamp string pattern; S2: Animation generator generates key frame animation; S3: Bind the lamp bead graphic with the key frame animation, and add the light string graphic to the display view to display the marquee animation effect of the light string graphic.
[0037] Furthermore, in step S2, the animation generator generates a key frame animation, which specifically includes the following steps: S21: creating a key frame animation, wherein the key path of the key frame animation is set as a fill color to control the color change of the lamp bead graphic; S22: creating a key frame array for storing key frame elements, wherein the key frame elements include lamp bead colors and the number of times the lamp bead colors appear continuously; S23: The key frame animation sets a plurality of key frames corresponding to the plurality of key frame elements one by one.
[0038] Embodiment 1 Please refer to Figure 1 and Figure 2Embodiment 1 of the present invention is to provide a method for displaying a marquee animation of a light string control software, so as to solve the problem that the existing light string control program has high performance consumption when controlling a Bluetooth light string to display animation effects.
[0039] Specifically, the marquee animation display method provided in this embodiment includes step S1: a shape generator generates a plurality of lamp bead patterns, and the plurality of lamp bead patterns constitute a light string pattern.
[0040] In this embodiment, the shape generator is used to generate light string graphics of different shapes according to the user's selection, such as Christmas trees, eaves lights, fence lights, etc.
[0041] The above step S1 specifically includes the following steps: S11: Obtaining preset graphic data.
[0042] First, the user can select a shape enumeration value, such as “Christmas tree”, through the light string control program, and the light string control program obtains preset graphic data of the shape enumeration value according to the selected shape enumeration value.
[0043] Among them, the above-mentioned preset graphic data includes background parameters and multiple lamp bead parameters corresponding to the multiple lamp bead graphics one by one, and the lamp bead parameters include lamp bead position parameters and lamp bead graphic parameters.
[0044] S12: Generate a background graphic object according to the background parameters; generate a plurality of lamp bead graphic objects corresponding to the plurality of lamp bead graphics one by one according to the preset graphic data, and store the plurality of lamp bead graphics in a lamp bead graphic array.
[0045] In this embodiment, after obtaining the preset graphic data, the shape generator can use CAShapeLayer to draw the background graphics according to the background parameters. CAShapeLayer serves as a container for graphic drawing. It presents the overall shape of the light string by adding a background picture and generates a background graphic object so that the display view can display the overall shape of the light string according to the background graphic object.
[0046] In the above step S12 of this embodiment, a plurality of lamp bead graphic objects corresponding to the plurality of lamp bead graphics are generated according to the preset graphic data, and the plurality of lamp bead graphics are stored in a lamp bead graphic array, which specifically includes the following steps: S121: Create the lamp bead graphic array. First, create a lamp bead graphic array for storing each lamp bead graphic object. In this embodiment, the shape generator can use CAShapeLayer to draw each lamp bead graphic according to the lamp bead data. Therefore, the lamp bead graphic object can be a CAShapeLayer object, and the lamp bead graphic array can be an array for storing multiple CAShapeLayer objects.
[0047] S122: Obtain a scaling factor according to the size of the view of the preset graphic data and the band width of the display view. The scaling factor is used to adjust the position and size of the generated lamp bead graphic object so that the light string graphic can adapt to the display area of the display view when added to the display view.
[0048] S123: Traverse the lamp bead parameters, obtain the lamp bead graphic object according to the scaling factor and the lamp bead parameters, and store the lamp bead graphic object in the lamp bead graphic array. The position parameters and shape parameters of the lamp bead graphic object corresponding to the lamp bead graphic will be scaled according to the view size of the display view to calculate the lamp bead view position parameters and lamp bead view shape parameters of the lamp bead graphic on the display view, so as to ensure that each lamp bead graphic can be correctly displayed on the real view.
[0049] In this embodiment, the lamp bead graphics can be drawn according to the following steps: according to the lamp bead graphics parameters and lamp bead position parameters of the lamp bead graphics object, a circular vector graphics path is created for each lamp bead graphics through the CGPathCreateWithEllipseInRect method to display the shape of the lamp bead graphics. The fillColor property of each lamp bead graphics object is set to the lamp bead color to ensure that each lamp bead graphics has the correct display color.
[0050] In this embodiment, through the above steps S11 to S12, the shape generator can finally generate a background graphic object and a lamp bead graphic array including all lamp bead graphics. These graphic objects will be used for subsequent animation and effect rendering.
[0051] The method for displaying a marquee animation provided by this embodiment further includes step S2: the animation generator generates a key frame animation.
[0052] The role of the animation generator is to generate a unified animation effect for the entire marquee animation. In this embodiment, the animation generator can control the color change of the lamp bead graphic through the values attribute of CAKeyframeAnimation, and realize the marquee animation effect by controlling the lamp bead color of the lamp bead graphic to change in sequence. In this embodiment, the keyframe animation sets a keyframe element for each lamp bead color displayed by the lamp bead graphic, and sets the keyframe according to the keyframe element, so that the lamp bead graphic can change its displayed lamp bead color at the keyframe, thereby making the light string graphic produce a marquee animation effect.
[0053] The above step S2 specifically includes the following steps: S21: creating a key frame animation, wherein the key path of the key frame animation is set to a fill color to control the color change of the lamp bead graphic.
[0054] In this embodiment, the animation generator creates a keyframe animation through CAKeyframeAnimation. The keyPath property of the keyframe animation is set to fillColor to control the color change of the lamp bead graphic. The goal of the keyframe animation is to make the color change of the lamp bead graphic smooth and connected, so the repeatCount of the keyframe animation is set to HUGE_VALF to ensure that the animation can be played in a continuous loop.
[0055] S22: Create a key frame array for storing key frame elements, wherein the key frame elements include lamp bead colors and the number of times the lamp bead colors appear continuously.
[0056] The animation generator obtains the color that the lamp bead graphic needs to display, and the number of times each lamp bead color appears continuously to construct a key frame element, so that the lamp bead graphic can display different lamp bead colors according to each key frame element in the key frame array, and the time for the lamp bead graphic to display the lamp bead color is generated according to the number of times the lamp bead color connection appears in the corresponding key frame element.
[0057] For example, the keyframe array includes keyframe elements (redColor, 10), (greenColor, 10), and (blueColor, 10). The keyframe element (redColor, 10) indicates that the red color of the lamp beads is displayed 10 times in a row in the light string graphic. According to the keyframe array, the lamp bead graphic can produce the following animation effects in sequence: the lamp bead graphic displays the red color 10 times in a row, then the lamp bead graphic displays the green color 10 times in a row, and finally the lamp bead graphic displays the blue color 10 times in a row.
[0058] S23: The key frame animation sets a plurality of key frames corresponding to the plurality of key frame elements one by one.
[0059] The animation generator assigns the keyframe array to the values property of CAKeyframeAnimation. The values property of CAKeyframeAnimation will store the set of lamp bead colors that need to be displayed in the lamp bead graphic, and a keyframe is set for each lamp bead color displayed in the lamp bead graphic to ensure that the lamp bead graphic can display different lamp bead colors at different times.
[0060] Specifically, the above step S23 includes the following steps: S231: traverse the key frame elements of the key frame array to obtain the total number of times the lamp bead color appears, so as to calculate the total animation duration according to the preset lamp bead animation duration and the total number of times the lamp bead color appears.
[0061] By traversing the keyframe array, the total animation duration of the lamp bead graphic to complete an animation effect can be calculated. It is easy to understand that the total animation duration can be obtained by multiplying the total number of times the lamp bead graphic displays the lamp bead color by the preset lamp bead animation duration. Therefore, by adjusting the preset lamp bead animation duration, the playback speed of the marquee animation effect can be controlled.
[0062] For example: the keyframe array includes keyframe elements (redColor, 10), (greenColor, 10), (blueColor, 10), and the preset lamp bead animation duration is 0.1 seconds. Then the lamp bead graphic needs to display the lamp bead color 10+10+10=30 times according to the keyframe array, so the total animation duration is 30*0.1=3 seconds.
[0063] S232: Obtain a key frame corresponding to the key frame element according to the number of times the lamp bead color appears continuously.
[0064] Each keyframe element in the keyframe array corresponds to a keyframe. The keyframe is calculated based on the number of times the color of the lamp bead appears continuously. Specifically, when traversing the lamp bead graphics, the number of times the color of the lamp bead displayed by the currently traversed lamp bead graphics needs to appear continuously is divided by the total number of times the lamp bead graphics need to display the color of the lamp bead. The position of the keyframe of the lamp bead color corresponding to the keyframe element in the marquee animation can be obtained. The change of the color of each lamp bead graphic will occur at the corresponding keyframe to ensure a smooth transition of the color of the lamp bead graphics.
[0065] As an example: the key frame array includes key frame elements (redColor, 10), (greenColor, 10), (blueColor, 10), and the key frame range is set to 0-1. The animation starts at 0 and ends at 1. According to the above key frame array, a total of 3 key frames can be obtained: the red lamp bead color key frame is 0 / 30=0; the green lamp bead color key frame is 10 / 30=0.333; the blue lamp bead color key frame is (10+10) / 30=0.666.
[0066] The method for displaying a marquee animation provided in this embodiment also includes step S3: binding the lamp bead graphic with the key frame animation, and adding the light string graphic to the display view to display the marquee animation effect of the light string graphic.
[0067] In step S3 of this embodiment, each lamp bead graphic needs to be bound to a key frame animation so that the marquee animation effect of the light string graphic can be displayed on the view.
[0068] The above step S3 specifically includes the following steps: S31: 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; adding animation effects to all the lamp bead graphics according to the key frame animation.
[0069] In step S3, the background graphic object in step S12 is first added to the layer of the display view, where the background graphic object only includes the background image, and does not include other shapes or lamp bead graphics. By adding the background graphic object to the display view, the overall appearance of the light string graphic can be presented, providing background support for subsequent animation effects.
[0070] S32: adding the light string graphics to the display view, and all the lamp bead graphics generate animation effects according to the key frame animation.
[0071] The above step S32 specifically includes the following steps: traversing the lamp bead graphics that constitute the light string graphics; setting the animation start time of the traversed lamp bead graphics according to the traversal index of the traversed lamp bead graphics and the lamp bead animation duration of the key frame animation.
[0072] Specifically, step S32 specifically includes: S321: Traverse the lamp bead graphic array.
[0073] The method for displaying the marquee animation provided in this embodiment can set the traversal order according to the direction of the marquee animation, and traverse the lamp bead graphics constituting the light string graphics according to the traversal order. As an example: if the animation direction of the selected marquee is forward, traverse in the forward order of the lamp bead graphics array; if the animation direction of the selected marquee is reverse, traverse in the reverse order of the lamp bead graphics data, so that the last lamp bead graphics in the light string graphics starts the animation first, so as to achieve the effect of reverse lighting.
[0074] S322: Set the start time of the key frame animation. For each lamp bead graphic object in the traversed lamp bead graphic array, set the beginTime attribute of the key frame animation created in step S21 to CACurrentMediaTime()+i×preset lamp bead animation duration; where i is the current traversal index and the starting value of i is 0.
[0075] Among them, the preset animation duration is used to control the offset effect of the animation start time of adjacent lamp bead graphics. In this way, the animation start time of two adjacent lamp bead graphics differs by a preset animation duration, so that adjacent lamp bead graphics in the light string graphics light up in turn, forming a continuously moving marquee effect.
[0076] S323: Add the key frame animation to the lamp bead graphic object.
[0077] All the lamp bead graphics in the light string graphics share a key frame animation, and the animation effects of the key frame animation are consistent. The animation start times of the lamp bead graphics in the light string graphics are different, so the memory usage and performance consumption of the light string control program can be effectively reduced.
[0078] S324: Add the array of lamp bead graphics to the layer of the view. After this step is completed, all lamp bead graphics can be displayed on the display view, and the color of the lamp bead graphics changes in sequence according to the setting of the key frame animation to present the marquee animation effect of the light string graphics.
[0079] In summary, the present invention provides a method for displaying a marquee animation that can generate multiple lamp bead graphics through a shape generator, and the multiple lamp bead graphics form the shape of a light string graphic, and generate a unified animation effect through an animation generator to simultaneously control the color changes of multiple lamp bead graphics, so that the light string graphics can achieve dynamic animation effects, and at the same time optimize the performance of the light string control program to avoid the operating burden of the light string control program to calculate the animation effect of each lamp bead in real time. The marquee animation effect control method provides a high-performance, customizable marquee animation effect, which not only meets the user's personalized needs for dynamic lighting effects, but also reduces the performance consumption of the terminal device and improves the overall user experience. The marquee animation display method can improve the efficiency and smoothness of the marquee animation display, reduce the performance consumption of the terminal device running the light string control program, and improve the user experience.
[0080] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for displaying a marquee animation of a light string control program, characterized in that: The following steps are involved: S1: a shape generator generates a plurality of lamp bead patterns, and the plurality of lamp bead patterns constitute a lamp string pattern; S2: Animation generator generates key frame animation; S3: Binding the lamp bead graphic with the key frame animation, and adding the light string graphic to the display view to display the marquee animation effect of the light string graphic; Wherein, in step S2, the animation generator generates a key frame animation, which specifically includes the following steps: S21: creating a key frame animation, wherein the key path of the key frame animation is set as a fill color to control the color change of the lamp bead graphic; S22: creating a key frame array for storing key frame elements, wherein the key frame elements include lamp bead colors and the number of times the lamp bead colors appear continuously; S23: The key frame animation sets a plurality of key frames corresponding to the plurality of key frame elements one by one.
2. The method for displaying a marquee animation according to claim 1, characterized in that: In step S1, a shape generator generates a plurality of lamp bead patterns, and the plurality of lamp bead patterns constitute a light string pattern, specifically including the following steps: S11: Obtaining preset graphic data; S12: generating a plurality of lamp bead graphic objects corresponding one-to-one to the plurality of lamp bead graphics according to the preset graphic data, and storing the plurality of lamp bead graphics in a lamp bead graphic array.
3. The method for displaying a marquee animation according to claim 2, characterized in that: The preset graphic data includes a plurality of lamp bead parameters corresponding to the plurality of lamp bead graphics one by one, and the lamp bead parameters include lamp bead position parameters and lamp bead graphic parameters; In the step S12, a plurality of lamp bead graphic objects are generated according to the preset graphic data, and the plurality of lamp bead graphic objects are stored in a lamp bead graphic array, specifically including: S121: Create the lamp bead graphic array; S122: Acquire a scaling factor according to the size of the view of the preset graphic data and the size of the display view; S123: traverse the lamp bead parameters, and obtain a lamp bead graphic object according to the scaling factor and the lamp bead parameters, and store the lamp bead graphic object in the lamp bead graphic array.
4. The method for displaying a marquee animation according to claim 2, characterized in that: The preset graphic data also includes background parameters; The step S1 also includes the steps of: generating a background graphic object according to the background parameters; The step S3 also includes the step of adding the background graphic object to the display view, so as to display the overall shape of the light string controlled by the light string control program in the display view.
5. The method for displaying a marquee animation according to claim 1, characterized in that: In the step S23, the key frame animation sets a plurality of key frames corresponding to the plurality of key frame elements one by one, specifically including: S231: traverse the key frame elements of the key frame array to obtain the total number of times the lamp bead color appears, so as to calculate the total animation duration according to the preset lamp bead animation duration and the total number of times the lamp bead color appears; S232: Obtain a key frame corresponding to the key frame element according to the number of times the lamp bead color appears continuously.
6. The method for displaying a marquee animation according to claim 1, characterized in that: In step S3, the lamp bead graphic is bound to the key frame animation, and the light string graphic is added to the display view to display the marquee animation effect of the light string graphic, which specifically includes the following steps: S31: adding animation effects to all the lamp bead graphics according to the key frame animation; S32: adding the light string graphics to the display view, and all the lamp bead graphics generate animation effects according to the key frame animation.
7. The method for displaying a marquee animation according to claim 6, characterized in that: In the step S31, adding animation effects to all the lamp bead graphics according to the key frame animation specifically includes: The lamp bead graphics constituting the lamp string graphics are traversed, and the animation start time of the traversed lamp bead graphics is set according to the traversal index of the traversed lamp bead graphics and the lamp bead animation duration of the key frame animation.
8. The method for displaying a marquee animation according to claim 7, characterized in that: In the step S31, animation effects are added to all the lamp bead graphics according to the key frame animation, and the method further includes: setting a traversal order according to the direction of the marquee animation, and traversing the lamp bead graphics constituting the light string graphics according to the traversal order.
9. A light string control terminal, comprising a memory, a processor, and a light string control program stored in the memory and executable on the processor, characterized in that: When the processor executes the light string control program, the method for displaying a marquee animation according to any one of claims 1 to 8 is implemented, which 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: Animation generator generates key frame animation; S3: Bind the lamp bead graphic with the key frame animation, and add the light string graphic to the display view to display the marquee animation effect of the light string graphic.
10. The light string control terminal according to claim 9, characterized in that: In step S2, the animation generator generates a key frame animation, which specifically includes the following steps: S21: creating a key frame animation, wherein the key path of the key frame animation is set as a fill color to control the color change of the lamp bead graphic; S22: creating a key frame array for storing key frame elements, wherein the key frame elements include lamp bead colors and the number of times the lamp bead colors appear continuously; S23: The key frame animation sets a plurality of key frames corresponding to the plurality of key frame elements one by one.
Citation Information
Patent Citations
Lamp effect control method and lamp effect control system
CN113342291A
Lamp effect control method of interactive lamp, electronic equipment and vehicle
CN116347699A
LED lamp string pattern dynamic control method
CN116994521A
Lamp effect control method, device, equipment and medium
CN117615492A
User terminal device for providing animation effect and display method thereof
US20140320507A1