Script setting method and device based on LED character display

By using CSS and JavaScript in HTML pages to simulate the brightness and shadow effects of LED fonts and setting peripheral curve functions, the problems of degraded performance, poor compatibility and high development complexity in LED text display are solved, and cross-platform compatibility and personality are achieved LED text display effect.

CN118939897APending Publication Date: 2024-11-12ONE NETWORK INTEROPERABILITY (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410978816.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

The existing technology has problems such as performance degradation, poor compatibility, high development complexity and insufficient flexibility in LED text display. Especially when complex animations and large-scale text display, CSS and JavaScript may lead to decreased browser performance, compatibility Inconsistent, high development threshold and difficult to integrate with other front-end components.

Method used

By creating container elements for displaying LED text in HTML pages, setting font, color and size attributes using CSS, and writing JavaScript scripts to simulate the brightness changes and shadow effects of LED fonts, using timers to periodically update content and set peripherals Curve function to form a ripple pattern that changes over time, ensuring real-time update of LED display content.

Benefits of technology

It realizes cross-platform compatible LED text display, reduces development complexity, improves flexibility and scalability, and is especially suitable for application scenarios such as digital clocks, and overcomes the hardware dependence and high cost problems of traditional LED display systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939897A_ABST
    Figure CN118939897A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a script setting method and device based on LED character display and electronic equipment, and belongs to the technical field of image processing.The method comprises the steps that a container element used for displaying LED characters is created on an HTML page where the LED characters are displayed; setting fonts, colors and size attributes of displayed characters by using CSS, simulating a brightness change process of LED fonts by setting a brightness function G1, and simulating a shadow effect of the LED fonts by setting a shadow function G2; setting a peripheral curve function G3, and setting an LED display content ripple graph changing along with time on the periphery of the LED display content to form peripheral display content corresponding to the LED display content; when the HTML page is loaded, an updating function is called immediately, and the updating function is used for calling and updating the brightness function G1, the shadow function G2 and the peripheral curve function G3. According to the scheme, the defects of a traditional LED display system in the aspects of hardware dependence, development complexity and cost are overcome, and cross-platform compatibility is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a script setting method, device and electronic equipment based on LED text display. Background Art

[0002] LED text display in web pages refers to a visual expression method that imitates the effect of traditional LED display screens to display text in web design. This effect is usually not a real LED hardware display, but a visual simulation achieved through front-end technologies such as HTML, CSS and JavaScript. Its purpose is to create a text display effect with a sense of technology, retro or specific atmosphere in the web interface. It is commonly seen in retro-style website design, digital clock display, bulletin board effects or web elements with specific themes.

[0003] The existing technology has the following problems in the process of LED text display:

[0004] 1. Performance issues

[0005] When displaying complex animations and large-scale text, CSS and JavaScript may cause browser performance to degrade, resulting in lag or unsmoothness.

[0006] 2. Compatibility issues:

[0007] Different browsers have different support for CSS and JavaScript standards, which may result in inconsistent effects on some browsers.

[0008] 3. Development complexity:

[0009] To achieve high-quality LED text display effects, you usually need to master CSS animation, JavaScript programming, Canvas drawing and other technologies, which has a high development threshold. A large amount of code and complex logic are required to achieve dynamic effects and interactions, which increases development and maintenance costs.

[0010] 4. Insufficient flexibility and scalability:

[0011] LED effects implemented with pure CSS and JavaScript usually have fixed styles and animations, which are difficult to flexibly adjust and expand. It is difficult to integrate well with other front-end components and frameworks, and lacks modularity and reusability.

[0012] The above problems become technical problems that need to be solved. Summary of the invention

[0013] In view of this, an embodiment of the present invention provides a script setting method, device and electronic device based on LED text display, which at least partially solve the problems existing in the prior art.

[0014] In a first aspect, an embodiment of the present invention provides a script setting method based on LED text display, comprising:

[0015] On an HTML page displaying LED text, create a container element for displaying LED text, the container element having a first identifier, and the content in the container element will be dynamically updated according to the first identifier;

[0016] Use CSS to set the font, color and size attributes of the displayed text. Set the brightness function G1 to simulate the brightness change process of the LED font. Set the shadow function G2 to simulate the shadow effect of the LED font.

[0017] Write a JavaScript script to periodically update the displayed text content through a timer, obtain the current time in the script, format it into hours, minutes and seconds, form dynamic data, and update the dynamic data to the specified HTML element through the first identifier through JavaScript DOM operation to form the display content corresponding to the LED text. By setting the peripheral curve function G3, a LED display content ripple diagram that changes with time is set around the LED display content to form peripheral display content corresponding to the LED display content;

[0018] When the HTML page is loaded, the update function is called immediately, and the update function is used to call and update the brightness function G1, the shadow function G2 and the peripheral curve function G3. The update function is called periodically by using a timer to ensure real-time update of the LED display content.

[0019] According to a specific implementation of the embodiment of the present disclosure, in the HTML page displaying LED text, a container element for displaying LED text is created, including:

[0020] In the HTML page section, add a element, The element is used to display dynamic LED text;

[0021] for Elements are assigned a unique ID that is used for reference and manipulation element.

[0022] According to a specific implementation of the embodiment of the present disclosure, the brightness change process of the LED font is simulated by setting the brightness function G1, including:

[0023] Use the basic pulse P(t) to maintain the periodic brightness pulse effect and control the light and dark cycle of the LED.

[0024]

[0025] Among them, t is the current time, A1 is the basic amplitude, f1 is the basic frequency, T1 is the basic period, and φ1 is the first phase offset;

[0026] Set the exponential decay function D(t) to simulate the process in which the brightness of the LED rises rapidly to the peak value and then gradually stabilizes when it is turned on.

[0027] D(t)=e -λ·t

[0028] λ is the decay rate, which controls how fast the brightness stabilizes after rising;

[0029] Add high-frequency small fluctuations V(t) to simulate the natural light intensity fluctuations caused by small changes in current in LEDs.

[0030]

[0031] A2 is the amplitude of small fluctuations, f2 is the frequency of high-frequency fluctuations, T2 is the period of small fluctuations, φ2 is the second phase shift, f2>f1;

[0032] The final brightness change function is obtained by weighted summation:

[0033] G1=I f (t)=P(t)·D(t)+V(t)·C

[0034] Wherein, C is the first adjustment parameter, which is used to adjust the relative strength of the small fluctuation with respect to the basic pulse and the attenuation effect.

[0035] According to a specific implementation of the embodiment of the present disclosure, the simulating the brightness change process of the LED font by setting the brightness function G1 also includes:

[0036] Add random variables to the phase shifts φ1 and φ2 of the base pulse P(t) and the small fluctuation V(t):

[0037]

[0038]

[0039] and is a randomly generated value within a preset range. and is the base phase shift; adds random fluctuations in frequencies f1 and f2 and

[0040]

[0041]

[0042] and Around the fundamental frequency and Randomly change within a preset ratio.

[0043] According to a specific implementation of the embodiment of the present disclosure, the shadow effect of the LED font is simulated by setting the shadow function G2, including:

[0044] Set n light sources, each of which is represented by a position vector And light intensity I i Description, where i = 1, 2, ..., n;

[0045] Set the shadow intensity D(r) of the light source:

[0046]

[0047] r is the distance from the shadow position to the light source, k is the control parameter that controls the rate of square decay, s is the saturation factor, and r0 is the characteristic length of exponential decay;

[0048] For each light source, calculate the point To the light source Vector Then according to The direction determines the direction and offset of the shadow;

[0049] For each pixel, calculate the shadow effect it receives from each light source and accumulate it. The final shadow C shadow It is expressed as:

[0050]

[0051] in, is a vector The unit direction vector is used to determine the offset direction of the shadow. is the color contribution of light source i, Represents the modulus of the vector, that is, the distance from the light source to the pixel.

[0052] According to a specific implementation of the embodiment of the present disclosure, by setting the peripheral curve function G3, a LED display content ripple diagram that changes with time is set on the periphery of the LED display content, including:

[0053] Constructing a basic sine wave component:

[0054] S(t)=A s (t)·sin(2πf s t+φ s )

[0055] A s (t) represents the amplitude of the sine wave changing with time, f s is the fundamental frequency of the sine wave, φ s is the initial phase of the sine wave;

[0056] Construct the basic cosine wave component:

[0057] C(t)=A c (t)·cos(2πf c t+φ c )

[0058] A c (t) is the amplitude of the cosine wave, f c is the frequency of the cosine wave, φ c is the initial phase of the cosine wave, which is different from the phase of the sine wave;

[0059] Construct the noise term N(t):

[0060]

[0061] Where η is a scalar that controls the noise intensity, Indicates that the mean is 0 and the variance is σ 2 A normally distributed random variable of ;

[0062] Finally, the LED display content ripple graph W(t) that changes with time is constructed:

[0063] W(t)=S(t)+C(t)+N(t)

[0064] Among them, W(t) is the final displayed waveform, and N(t) is the random noise term that varies with time.

[0065] According to a specific implementation of the embodiment of the present disclosure, when the HTML page is loaded, the update function is immediately called, and the update function is used to call and update the brightness function G1, the shadow function G2 and the peripheral curve function G3. The update function is periodically called by using a timer to ensure the real-time update of the LED display content, including:

[0066] Create an update function updateLEDDisplay(), use the update function to call G1, G2 and G3 in sequence, and apply their calculation results to the corresponding elements of the HTML page.

[0067] According to a specific implementation of the embodiment of the present disclosure, when the HTML page is loaded, the update function is immediately called, and the update function is used to call and update the brightness function G1, the shadow function G2 and the peripheral curve function G3. By using a timer to periodically call the update function, the real-time update of the LED display content is ensured, and it also includes:

[0068] After the page is loaded, call the updateLEDDisplay() function immediately to ensure that the initial state is displayed correctly;

[0069] Set a timer to periodically call updateLEDDisplay() at fixed intervals to ensure dynamic updating of content.

[0070] In a second aspect, an embodiment of the present invention provides a script setting device based on LED text display, comprising:

[0071] A creation module is used to create a container element for displaying LED text on an HTML page for displaying LED text, wherein the container element has a first identifier, and the content in the container element will be dynamically updated according to the first identifier;

[0072] Setting module, use CSS to set the font, color and size attributes of the displayed text, simulate the brightness change process of the LED font by setting the brightness function G1, and simulate the shadow effect of the LED font by setting the shadow function G2;

[0073] Form a module, write a JavaScript script, periodically update the displayed text content through a timer, obtain the current time in the script, format it into hours, minutes and seconds, form dynamic data, update the dynamic data to the specified HTML element through the first identifier through JavaScript DOM operation, form the display content corresponding to the LED text, and set a LED display content ripple diagram that changes with time around the LED display content by setting the peripheral curve function G3, so as to form peripheral display content corresponding to the LED display content;

[0074] The update module immediately calls the update function when the HTML page is loaded. The update function is used to call and update the brightness function G1, the shadow function G2 and the peripheral curve function G3. The update function is periodically called by using a timer to ensure real-time update of the LED display content.

[0075] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0076] at least one processor; and,

[0077] a memory communicatively connected to the at least one processor; wherein,

[0078] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the script setting method based on LED text display in any of the first aspects or any implementation of the first aspect.

[0079] In a fourth aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the script setting method based on LED text display in the aforementioned first aspect or any implementation of the first aspect.

[0080] In a fifth aspect, an embodiment of the present invention further provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the script setting method based on LED text display in the aforementioned first aspect or any implementation of the first aspect.

[0081] The script setting scheme based on LED text display in the embodiment of the present invention includes: creating a container element for displaying LED text in an HTML page displaying LED text, the container element having a first identifier, and the content in the container element will be dynamically updated through the first identifier; using CSS to set the font, color and size attributes of the displayed text, simulating the brightness change process of the LED font by setting the brightness function G1, and simulating the shadow effect of the LED font by setting the shadow function G2; writing a JavaScript script to periodically update the displayed text content through a timer, obtaining the current time in the script, formatting it into hours, minutes and seconds, forming dynamic data, updating the dynamic data to a specified HTML element through the first identifier through JavaScript DOM operation, forming display content corresponding to the LED text, setting a LED display content ripple diagram that changes with time around the LED display content by setting the peripheral curve function G3, and forming peripheral display content corresponding to the LED display content; when the HTML page is loaded, calling the update function immediately, the update function is used to call and update the brightness function G1, the shadow function G2 and the peripheral curve function G3, and the update function is periodically called by using a timer to ensure real-time update of the LED display content. This solution creates an HTML structure containing a display container, uses CSS to define the LED style, and dynamically updates the display content through JavaScript. It is particularly suitable for application scenarios such as digital clocks. It overcomes the shortcomings of traditional LED display systems in hardware dependence, development complexity and cost, and achieves cross-platform compatibility and personalized display. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0083] Figure 1 A flowchart of a script setting method based on LED text display provided by an embodiment of the present invention;

[0084] Figure 2 A schematic flow chart of another script setting method based on LED text display provided by an embodiment of the present invention;

[0085] Figure 3 A schematic diagram of the structure of a script setting device based on LED text display provided by an embodiment of the present invention;

[0086] Figure 4 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0087] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0088] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.

[0089] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.

[0090] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The drawings only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0091] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.

[0092] The disclosed embodiment provides a script setting method based on LED text display. The script setting method based on LED text display provided in this embodiment can be executed by a computing device, which can be implemented as software, or as a combination of software and hardware, and the computing device can be integrated in a server, terminal device, etc.

[0093] See also Figure 1 and Figure 2 The present disclosure provides a script setting method based on LED text display, including:

[0094] S101, on an HTML page displaying LED text, create a container element for displaying LED text, the container element having a first identifier, and the content in the container element will be dynamically updated according to the first identifier.

[0095] HTML documents generally contain a basic structure, including <!DOCTYPE html> declaration, tag pairs, internal and partial. You can add a element, which will be the container for displaying dynamic LED text. Assign a unique ID so you can reference and manipulate it later in JavaScript.

[0096] For example, you can set <div id="leddisplay"> , <div id="leddisplay"> This is where the LED style text is displayed dynamically. The ID "ledDisplay" is an identifier that will be used in JavaScript code to locate and modify the content of this element.

[0097] S102, using CSS to set the font, color and size attributes of the displayed text, simulating the brightness change process of the LED font by setting the brightness function G1, and simulating the shadow effect of the LED font by setting the shadow function G2.

[0098] To simulate the display effect of LED text, you can create a CSS style sheet to beautify the previously defined HTML <div id="leddisplay">element. Can be used directly within a section <style>标签编写内联CSS,或者创建一个外部CSS文件(例如styles.css),并通过<link>标签在HTML的<head>中引用它。

[0099] 为了模仿LED显示屏的字体,可以选择一种类似LED的无衬线、像素化或数字风格的字体。LED常见的颜色是绿色或红色,可以使用color属性设定字体颜色,可以根据需要调整文字的大小,使用font-size属性,单位可以是像素(px)、点(pt)等。

[0100] 可以通过设置亮度函数G1,模拟LED字体的亮度变化过程,具体的,可以使用基础脉冲P(t)保持周期性亮度脉冲效果,控制LED的明暗周期,

[0101]

[0102] 其中,t为当前时间,A1为基础振幅,f1为基础频率,T1为基础周期,φ1为第一相位偏移;

[0103] 设置指数衰减函数D(t),模拟LED启动时亮度迅速上升至峰值后逐渐稳定的过程

[0104] D(t)=e-λ·t

[0105] λ是衰减率,控制亮度上升后稳定的速度;

[0106] 添加高频率的小幅波动V(t),模拟LED因电流微小变化产生的自然光强波动,

[0107]

[0108] A2为微小波动的振幅,f2为高频波动的频率,T2为微小波动的周期,φ2为第二相位偏移,f2>f1;

[0109] 通过加权求和得到最终的亮度变化函数:

[0110] G1=If(t)=P(t)·D(t)+V(t)·C

[0111] 其中,C是第一调节参数,用于调整微小波动相对于基础脉冲和衰减效果的相对强度。

[0112] 为了提高LED字体的逼真度,还可以在基础脉冲P(t)和小幅波动V(t)的相位偏移φ1和φ2中加入随机变量:

[0113]

[0114]

[0115] 和是在预设范围内随机生成的值,和是基础相位偏移;

[0116] 在频率f1和f2中增加随机波动和

[0117]

[0118]

[0119] 和分别围绕基础频率和在预设比例范围内随机变化。

[0120] 为了进一步提高LED字体的效果,还可以设置阴影函数G2,模拟LED字体的阴影效果,包括:

[0121] 设置n个光源,每个光源由位置向量和光强Ii描述,其中i=1,2,...,n;

[0122] 设置光源的阴影强度D(r):

[0123]

[0124] r为阴影位置到光源的距离,k为控制参数,控制平方衰减的速率,s是饱和度因子,r0是指数衰减的特征长度;

[0125] 对于每个光源,计算点到光源的向量然后根据的方向确定阴影的方向和偏移量;

[0126] 对于每个像素点,计算其从各个光源接收的阴影效果并累加,最终的阴影Cshadow表示为:

[0127]

[0128] 其中,是向量的单位方向向量,用于决定阴影的偏移方向,是光源i的颜色贡献,表示向量的模,即光源到像素点的距离。

[0129] S103,编写JavaScript脚本,通过定时器周期性更新显示的文字内容,脚本中获取当前时间,格式化为小时、分钟和秒钟,形成动态数据,通过JavaScript的DOM操作,将所述动态数据通过所述第一标识符更新到指定的HTML元素中,形成LED文字对应的显示内容,通过设置外围曲线函数G3,在LED显示内容的外围设置一个随时间变化的LED显示内容波纹图,形成与LED显示内容对应的外围展示内容。

[0130] 可以使用JavaScript的Date对象获取当前时间,并将其格式化为小时、分钟和秒钟的字符串。通过DOM操作,定期更新上述容器元素的文本内容,使其显示当前时间。

[0131] 为了提高LED字体的美观度,可以定义一个函数来创建并更新一个模拟LED波纹的外围效果,可以对一个围绕LED文字显示区域的元素进行样式动画处理,比如改变边框的颜色或宽度,模拟波纹扩散效果。

[0132] 作为一个具体的例子,可以通过设置外围曲线函数G3,在LED显示内容的外围设置一个随时间变化的LED显示内容波纹图,包括:

[0133] 构建基础正弦波成分:

[0134] S(t)=As(t)·sin(2πfst+φs)

[0135] As(t)表示正弦波的随时间变化的振幅,fs是正弦波的基础频率,φs是正弦波的初始相位;

[0136] 构建基础余弦波成分:

[0137] C(t)=Ac(t)·cos(2πfct+φc)

[0138] Ac(t)是余弦波的振幅,fc是余弦波的频率,φc是余弦波的初始相位,与正弦波相位不同;

[0139] 构建噪声项N(t):

[0140]

[0141] 其中,η是一个标量,控制噪声强度,表示均值为0、方差为σ2的正态分布随机变量;

[0142] 最终构建随时间变化的LED显示内容波纹图W(t):

[0143] W(t)=S(t)+C(t)+N(t)

[0144] 其中,W(t)是最终显示的波形,N(t)是随时间变化的随机噪声项。

[0145] S104,在HTML页面加载时,立即调用更新函数,所述更新函数用于调用和更新亮度函数G1、阴影函数G2和外围曲线函数G3,通过使用定时器周期性调用所述更新函数,确保LED显示内容的实时更新。

[0146] 可以在JavaScript文件的顶层或在DOMContentLoaded事件监听器中,调用updateLEDDisplay()。这确保了页面一加载,LED显示就处于最新状态。

[0147] 使用window.onload或DOMContentLoaded事件确保DOM完全加载后,设置一个定时器,如:

[0148]

[0149]

[0150] 在updateLEDDisplay()函数内部,顺序调用G1()、G2()和G3()。这些函数各自处理它们负责的视觉效果,并通过DOM操作将这些变化应用到页面上。

[0151] 该方案创建了包含显示容器的HTML结构,利用CSS定义LED样式,通过JavaScript动态更新显示内容,特别适用于数字时钟等应用场景,克服了传统LED显示系统在硬件依赖性、开发复杂度和成本方面的缺陷,实现了跨平台兼容和个性化展示。

[0152] 根据本公开实施例的一种具体实现方式,所述在显示LED文字的HTML页面,创建一个用于显示LED文字的容器元素,包括:

[0153] 在HTML页面<body>部分,添加一个元素,元素用来显示动态LED文字;

[0154] 为元素分配一个唯一ID,所述唯一ID用于引用和操控元素。

[0155] 根据本公开实施例的一种具体实现方式,所述通过设置亮度函数G1,模拟LED字体的亮度变化过程,包括:

[0156] 使用基础脉冲P(t)保持周期性亮度脉冲效果,控制LED的明暗周期,

[0157]

[0158] 其中,t为当前时间,A1为基础振幅,f1为基础频率,T1为基础周期,φ1为第一相位偏移;

[0159] 设置指数衰减函数D(t),模拟LED启动时亮度迅速上升至峰值后逐渐稳定的过程

[0160] D(t)=e-λ·t

[0161] λ是衰减率,控制亮度上升后稳定的速度;

[0162] 添加高频率的小幅波动V(t),模拟LED因电流微小变化产生的自然光强波动,

[0163]

[0164] A2为微小波动的振幅,f2为高频波动的频率,T2为微小波动的周期,φ2为第二相位偏移,f2>f1;

[0165] 通过加权求和得到最终的亮度变化函数:

[0166] G1=If(t)=P(t)·D(t)+V(t)·C

[0167] 其中,C是第一调节参数,用于调整微小波动相对于基础脉冲和衰减效果的相对强度。

[0168] 根据本公开实施例的一种具体实现方式,所述通过设置亮度函数G1,模拟LED字体的亮度变化过程,还包括:

[0169] 在基础脉冲P(t)和小幅波动V(t)的相位偏移φ1和φ2中加入随机变量:

[0170]

[0171]

[0172] 和是在预设范围内随机生成的值,和是基础相位偏移;

[0173] 在频率f1和f2中增加随机波动和

[0174]

[0175]

[0176] 和分别围绕基础频率和在预设比例范围内随机变化。

[0177] 根据本公开实施例的一种具体实现方式,所述通过设置阴影函数G2,模拟LED字体的阴影效果,包括:

[0178] 设置n个光源,每个光源由位置向量和光强Ii描述,其中i=1,2,...,n;

[0179] 设置光源的阴影强度D(r):

[0180]

[0181] r为阴影位置到光源的距离,k为控制参数,控制平方衰减的速率,s是饱和度因子,r0是指数衰减的特征长度;

[0182] 对于每个光源,计算点到光源的向量然后根据的方向确定阴影的方向和偏移量;

[0183] 对于每个像素点,计算其从各个光源接收的阴影效果并累加,最终的阴影Cshadow表示为:

[0184]

[0185] 其中,是向量的单位方向向量,用于决定阴影的偏移方向,是光源i的颜色贡献,表示向量的模,即光源到像素点的距离。

[0186] 根据本公开实施例的一种具体实现方式,所述通过设置外围曲线函数G3,在LED显示内容的外围设置一个随时间变化的LED显示内容波纹图,包括:

[0187] 构建基础正弦波成分:

[0188] S(t)=As(t)·sin(2πfst+φs)

[0189] As(t)表示正弦波的随时间变化的振幅,fs是正弦波的基础频率,φs是正弦波的初始相位;

[0190] 构建基础余弦波成分:

[0191] C(t)=Ac(t)·cos(2πfct+φc)

[0192] Ac(t)是余弦波的振幅,fc是余弦波的频率,φc是余弦波的初始相位,与正弦波相位不同;

[0193] 构建噪声项N(t):

[0194]

[0195] 其中,η是一个标量,控制噪声强度,表示均值为0、方差为σ2的正态分布随机变量;

[0196] 最终构建随时间变化的LED显示内容波纹图W(t):

[0197] W(t)=S(t)+C(t)+N(t)

[0198] 其中,W(t)是最终显示的波形,N(t)是随时间变化的随机噪声项。

[0199] 根据本公开实施例的一种具体实现方式,所述在HTML页面加载时,立即调用更新函数,所述更新函数用于调用和更新亮度函数G1、阴影函数G2和外围曲线函数G3,通过使用定时器周期性调用所述更新函数,确保LED显示内容的实时更新,包括:

[0200] 创建更新函数updateLEDDisplay(),利用更新函数依次调用G1、G2和G3,并应用它们的计算结果到HTML页面的相应元素上。

[0201] 根据本公开实施例的一种具体实现方式,所述在HTML页面加载时,立即调用更新函数,所述更新函数用于调用和更新亮度函数G1、阴影函数G2和外围曲线函数G3,通过使用定时器周期性调用所述更新函数,确保LED显示内容的实时更新,还包括:

[0202] 在页面加载完成后,立即调用updateLEDDisplay()函数,确保初始状态正确显示;

[0203] 设置定时器,以固定的时间间隔周期性地调用updateLEDDisplay(),确保内容的动态更新。

[0204] 与上面的方法实施例相对应,参见图3,本发明实施例还公开了一种基于LED文字展示的脚本设置装置30,包括:

[0205] 创建模块301,在显示LED文字的HTML页面,创建一个用于显示LED文字的容器元素,所述容器元素具有第一标识符,所述容器元素内的内容将通过所述第一标识符进行动态更新;

[0206] 设置模块302,使用CSS设置显示文字的字体、颜色和大小属性,通过设置亮度函数G1,模拟LED字体的亮度变化过程,通过设置阴影函数G2,模拟LED字体的阴影效果;

[0207] 形成模块303,编写JavaScript脚本,通过定时器周期性更新显示的文字内容,脚本中获取当前时间,格式化为小时、分钟和秒钟,形成动态数据,通过JavaScript的DOM操作,将所述动态数据通过所述第一标识符更新到指定的HTML元素中,形成LED文字对应的显示内容,通过设置外围曲线函数G3,在LED显示内容的外围设置一个随时间变化的LED显示内容波纹图,形成与LED显示内容对应的外围展示内容;

[0208] 更新模块304,在HTML页面加载时,立即调用更新函数,所述更新函数用于调用和更新亮度函数G1、阴影函数G2和外围曲线函数G3,通过使用定时器周期性调用所述更新函数,确保LED显示内容的实时更新。

[0209] 参见图4,本发明实施例还提供了一种电子设备60,该电子设备包括:

[0210] 至少一个处理器;以及,

[0211] 与该至少一个处理器通信连接的存储器;其中,

[0212] 该存储器存储有可被该至少一个处理器执行的指令,该指令被该至少一个处理器执行,以使该至少一个处理器能够执行前述方法实施例中基于LED文字展示的脚本设置方法。

[0213] 本发明实施例还提供了一种非暂态计算机可读存储介质,该非暂态计算机可读存储介质存储计算机指令,该计算机指令用于使该计算机执行前述方法实施例中。

[0214] 本发明实施例还提供了一种计算机程序产品,该计算机程序产品包括存储在非暂态计算机可读存储介质上的计算程序,该计算机程序包括程序指令,当该程序指令被计算机执行时,使该计算机执行前述方法实施例中的基于LED文字展示的脚本设置方法。

[0215] 下面参考图4,其示出了适于用来实现本公开实施例的电子设备60的结构示意图。本公开实施例中的电子设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图4示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。

[0216] 如图4所示,电子设备60可以包括处理装置(例如中央处理器、图形处理器等)601,其可以根据存储在只读存储器(ROM)602中的程序或者从存储装置608加载到随机访问存储器(RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有电子设备60操作所需的各种程序和数据。处理装置601、ROM 602以及RAM 603通过总线604彼此相连。输入 / 输出(I / O)接口605也连接至总线604。

[0217] 通常,以下装置可以连接至I / O接口605:包括例如触摸屏、触摸板、键盘、鼠标、图像传感器、麦克风、加响应计、陀螺仪等的输入装置606;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置607;包括例如磁带、硬盘等的存储装置608;以及通信装置609。通信装置609可以允许电子设备60与其他设备进行无线或有线通信以交换数据。虽然图4示出了具有各种装置的电子设备60,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。

[0218] 特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置609从网络上被下载和安装,或者从存储装置608被安装,或者从ROM 602被安装。在该计算机程序被处理装置601执行时,执行本公开实施例的方法中限定的上述功能。

[0219] 以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。< / style>

Claims

1. A script setting method based on LED text display, characterized in that: include: On an HTML page displaying LED text, create a container element for displaying LED text, the container element having a first identifier, and the content in the container element will be dynamically updated according to the first identifier; Use CSS to set the font, color and size attributes of the displayed text. Set the brightness function G1 to simulate the brightness change process of the LED font. Set the shadow function G2 to simulate the shadow effect of the LED font. Write a JavaScript script to periodically update the displayed text content through a timer, obtain the current time in the script, format it into hours, minutes and seconds, form dynamic data, and update the dynamic data to the specified HTML element through the first identifier through JavaScript DOM operation to form the display content corresponding to the LED text. By setting the peripheral curve function G3, a LED display content ripple diagram that changes with time is set around the LED display content to form peripheral display content corresponding to the LED display content; When the HTML page is loaded, the update function is called immediately, and the update function is used to call and update the brightness function G1, the shadow function G2 and the peripheral curve function G3. The update function is called periodically by using a timer to ensure real-time update of the LED display content.

2. The method according to claim 1, characterized in that In the HTML page that displays LED text, create a container element for displaying LED text, including: In the HTML page section, add a element, The element is used to display dynamic LED text; for Elements are assigned a unique ID that is used for reference and manipulation element.

3. The method according to claim 2, characterized in that The brightness function G1 is set to simulate the brightness change process of the LED font, including: Use the basic pulse P(t) to maintain the periodic brightness pulse effect and control the light and dark cycle of the LED. Among them, t is the current time, A1 is the basic amplitude, f1 is the basic frequency, T1 is the basic period, and φ1 is the first phase offset; Set the exponential decay function D(t) to simulate the process in which the brightness of the LED rises rapidly to the peak value and then gradually stabilizes when it is turned on. D(t)=e -λ·t λ is the decay rate, which controls how fast the brightness stabilizes after rising; Add high-frequency small fluctuations V(t) to simulate the natural light intensity fluctuations caused by small changes in current in LEDs. A2 is the amplitude of small fluctuations, f2 is the frequency of high-frequency fluctuations, T2 is the period of small fluctuations, φ2 is the second phase shift, f2>f1; The final brightness change function is obtained by weighted summation: G1=I f (t)=P(t)·D(t)+V(t)·C Wherein, C is the first adjustment parameter, which is used to adjust the relative strength of the small fluctuation with respect to the basic pulse and the attenuation effect.

4. The method according to claim 3, characterized in that The process of simulating the brightness change of the LED font by setting the brightness function G1 also includes: Add random variables to the phase shifts φ1 and φ2 of the base pulse P(t) and the small fluctuation V(t): and is a randomly generated value within a preset range. and is the fundamental phase shift; Add random fluctuations at frequencies f1 and f2 and and Around the fundamental frequency and Randomly change within a preset ratio.

5. The method according to claim 4, characterized in that The shadow effect of the LED font is simulated by setting the shadow function G2, including: Set n light sources, each of which is represented by a position vector And light intensity I i Description, where i=1, 2, ..., n; Set the shadow intensity D(r) of the light source: r is the distance from the shadow position to the light source, k is the control parameter that controls the rate of square decay, s is the saturation factor, and r0 is the characteristic length of exponential decay; For each light source, calculate the point To the light source Vector Then according to The direction determines the direction and offset of the shadow; For each pixel, calculate the shadow effect it receives from each light source and accumulate it. The final shadow C shadow It is expressed as: in, is a vector The unit direction vector is used to determine the offset direction of the shadow. is the color contribution of light source i, Represents the modulus of the vector, that is, the distance from the light source to the pixel.

6. The method according to claim 5, characterized in that The method of setting a peripheral curve function G3 to set a LED display content ripple diagram that changes with time on the periphery of the LED display content includes: Constructing a basic sine wave component: S(t)=A s (t)·sin(2πf s t+φ s ) A s (t) represents the amplitude of the sine wave changing with time, f s is the fundamental frequency of the sine wave, φ s is the initial phase of the sine wave; Construct the basic cosine wave component: C(t)=A c (t)·cos(2πf c t+φ c ) A c (t) is the amplitude of the cosine wave, f c is the frequency of the cosine wave, φ c is the initial phase of the cosine wave, which is different from the phase of the sine wave; Construct the noise term N(t): Where η is a scalar that controls the noise intensity, Indicates that the mean is 0 and the variance is σ 2 A normally distributed random variable of ; Finally, the LED display content ripple graph W(t) that changes with time is constructed: W(t)=S(t)+C(t)+N(t) Among them, W(t) is the final displayed waveform, and N(t) is the random noise term that varies with time.

7. The method according to claim 6, characterized in that When the HTML page is loaded, the update function is immediately called, and the update function is used to call and update the brightness function G1, the shadow function G2 and the peripheral curve function G3. The update function is periodically called by using a timer to ensure the real-time update of the LED display content, including: Create an update function updateLEDDisplay(), use the update function to call G1, G2 and G3 in sequence, and apply their calculation results to the corresponding elements of the HTML page.

8. The method according to claim 7, characterized in that When the HTML page is loaded, the update function is immediately called, and the update function is used to call and update the brightness function G1, the shadow function G2 and the peripheral curve function G3. By using a timer to periodically call the update function, the real-time update of the LED display content is ensured, and the method also includes: After the page is loaded, call the updateLEDDisplay() function immediately to ensure that the initial state is displayed correctly; Set a timer to periodically call updateLEDDisplay() at fixed intervals to ensure dynamic updating of content.

9. A script setting device based on LED text display, characterized in that: include: A creation module is used to create a container element for displaying LED text on an HTML page for displaying LED text, wherein the container element has a first identifier, and the content in the container element will be dynamically updated according to the first identifier; Setting module, use CSS to set the font, color and size attributes of the displayed text, simulate the brightness change process of the LED font by setting the brightness function G1, and simulate the shadow effect of the LED font by setting the shadow function G2; Form a module, write a JavaScript script, periodically update the displayed text content through a timer, obtain the current time in the script, format it into hours, minutes and seconds, form dynamic data, update the dynamic data to the specified HTML element through the first identifier through JavaScript DOM operation, form the display content corresponding to the LED text, and set a LED display content ripple diagram that changes with time around the LED display content by setting the peripheral curve function G3, so as to form peripheral display content corresponding to the LED display content; The update module immediately calls the update function when the HTML page is loaded. The update function is used to call and update the brightness function G1, the shadow function G2 and the peripheral curve function G3. The update function is periodically called by using a timer to ensure real-time update of the LED display content.

10. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the script setting method based on LED text display as described in any one of claims 1 to 8.