Program implementation method, device and equipment of program engine based on Konva dynamic effect library and medium
Through the program engine based on the Konva motion library, the problem of device compatibility and resource consumption of the game engine when looking for differences in comparison pictures has been solved, improving stability and compatibility and improving the user experience.
Patent Information
- Application Number
- CN202410682015.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-10-11
AI Technical Summary
When existing game engines look for differences in comparison images, they have poor device compatibility and consume a lot of system resources, which may cause the user terminal to experience stuck responses, delays or crashes, affecting the user experience.
Using a program engine based on the Konva motion library, it implements the rendering and display of comparison images by initializing the program, loading image resources, obtaining user level selection results, monitoring user touch operations, identifying target points and marking them, ensuring the stability and stability of the application. compatibility.
The rendering of contrast images and user operation monitoring are implemented through the Konva motion effect library, which improves the stability and compatibility of the application, reduces the restrictions on running smoothness caused by device configuration, and improves the user experience.
Smart Images

Figure CN118750880A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of Internet technology, and specifically relates to a program implementation method, device, equipment and medium of a program engine based on the Konva motion effect library. Background Art
[0002] Spot the Differences games provide a fun and easy way to train observation, attention and detail recognition. The pictures in the game can also be themed or have fascinating content to increase entertainment and appeal.
[0003] At present, most programs for finding differences in comparison pictures rely on game engines, that is, building scenes in the game engine and writing logic codes to interact with users. However, game engines have poor device compatibility and consume more system resources to run. If the user's terminal device configuration is poor, it is very likely that the application will respond to problems such as lag, delay or crash, which greatly affects the user experience.
[0004] Therefore, how to ensure the stability of applications and improve the compatibility of applications is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a program implementation method, device, equipment and medium for a program engine based on the Konva motion effect library, which can realize the rendering and display of comparison pictures, as well as monitoring and feedback of user operations through the Konva motion effect library, which is conducive to ensuring the stability of the application, improving program compatibility, and reducing the restrictions of device configuration on the smoothness of program operation.
[0006] In a first aspect, an embodiment of the present application provides a method for implementing a program engine based on a Konva motion effect library, the method comprising:
[0007] In response to the program running trigger operation, the program is initialized through the Konva animation library program engine;
[0008] Load the image resources for comparison;
[0009] Obtaining the level selection result of the user, and determining configuration parameters according to the level selection result; wherein the configuration parameters include a distinguishing coordinate range, an initial duration, and a comparison threshold;
[0010] Display the comparison picture and start the countdown according to the initial duration;
[0011] Use the Konva animation library to monitor the user's touch operations and obtain the user's touch position coordinates;
[0012] Identify whether the touch position coordinates are within the distinguishing coordinate range, and if so, determine it as a target point, and mark the target point in the comparison picture;
[0013] The number of target points and the remaining time are obtained, and when the number of target points reaches the comparison threshold and the remaining time is greater than 0, it is determined that the image comparison is successful.
[0014] Furthermore, the image resources for comparison are loaded, including:
[0015] Create a canvas;
[0016] Obtain image resources according to a preset address, set the attribute information of the image through the Konva animation library, and import the comparison image into the canvas according to the attribute information; wherein the attribute information includes the position and size of the image in the canvas, and the color and width of the border.
[0017] Further, build a canvas, including:
[0018] Get the user's screen size and resolution;
[0019] The canvas size and display position are determined according to the screen size and resolution, and the canvas is established according to the canvas size and display position.
[0020] Furthermore, after importing the comparison image into the canvas according to the attribute information, the method further includes:
[0021] Rendering the comparison picture;
[0022] The first picture and the second picture in the comparison picture are coordinately positioned in the canvas.
[0023] Furthermore, the Konva animation library is used to monitor the user's touch operations and record the user's touch position coordinates, including:
[0024] Monitor the user's touch operation through the Konva animation library, identify the user's touch position, and determine whether the touch position is in the first picture in the comparison picture;
[0025] If the touch position is in the first picture, the coordinate point of the touch position in the first picture is recorded; if the touch position is not in the first picture, the coordinate point of the touch position in the second picture is recorded;
[0026] or,
[0027] Monitor the user's touch operation through the Konva animation library, identify the user's touch position, and determine whether the touch position is in the second picture in the comparison picture;
[0028] If the touch position is in the second picture, the corresponding coordinate point of the touch position in the first picture is calculated based on the positional relationship between the second picture and the first picture, and the corresponding coordinate point is recorded as the user's touch position coordinate; if the user's touch position is in the first picture, the coordinates of the touch position are recorded.
[0029] Furthermore, marking the target point in the comparison picture includes:
[0030] Determine the marking range in the first image according to the coordinates of the target point;
[0031] Obtaining a corresponding marked range in the second picture for the marked range in the first picture;
[0032] Mark the first picture and the second picture respectively according to the marking range and the corresponding marking range;
[0033] or,
[0034] Determine the marking range in the second image according to the coordinates of the target point;
[0035] Obtaining a corresponding marked range in the first picture for the marked range in the second picture;
[0036] The second picture and the first picture are marked respectively according to the marking range and the corresponding marking range.
[0037] Further, identifying whether the touch position coordinates are within the distinguishing coordinate range, and determining the touch position as a target point if within the distinguishing coordinate range, includes:
[0038] Identifying whether the touch position coordinates are within a distinguishing coordinate range;
[0039] If it is within the distinguishing coordinate range, identifying whether the touch position is an existing target point;
[0040] If the touch position is not an existing target point, the touch position is used as the target point.
[0041] In a second aspect, an embodiment of the present application provides a program implementation device of a program engine based on a Konva motion effect library, the device comprising:
[0042] A program initialization module, for initializing the program through the Konva animation library program engine in response to a program running trigger operation;
[0043] Image resource loading module, used to load image resources for comparison;
[0044] A configuration parameter determination module, used to obtain the level selection result of the user, and determine the configuration parameters according to the level selection result; wherein the configuration parameters include a distinguishing coordinate range, an initial duration, and a comparison threshold;
[0045] A countdown start module, used to display the comparison picture and start the countdown according to the initial duration;
[0046] The touch position coordinate acquisition module is used to monitor the user's touch operation through the Konva animation library and obtain the user's touch position coordinates;
[0047] a target point determination module, used to identify whether the touch position coordinates are within the distinguishing coordinate range, and if so, determine it as a target point, and mark the target point in the comparison picture;
[0048] The picture comparison success determination module is used to obtain the number of target points and the remaining time. When the number of target points reaches the comparison threshold and the remaining time is greater than 0, it is determined that the picture comparison is successful.
[0049] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0050] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0051] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0052] In an embodiment of the present application, in response to a program running trigger operation, the program is initialized through the Konva motion effect library program engine; image resources for comparison are loaded; the user's level selection result is obtained, and configuration parameters are determined according to the level selection result; wherein the configuration parameters include a difference coordinate range, an initial duration, and a comparison threshold; the comparison image is displayed, and a countdown is started according to the initial duration; the user's touch operation is monitored through the Konva motion effect library to obtain the user's touch position coordinates; it is identified whether the touch position coordinates are within the difference coordinate range, and if so, it is determined to be a target point, and the target point is marked in the comparison image; the number of target points and the remaining duration are obtained, and when the number of target points reaches the comparison threshold and the remaining duration is greater than 0, it is determined that the image comparison is successful.
[0053] Through the above-mentioned method of implementing a program based on the program engine of the Konva motion effect library, the Konva motion effect library can be used to render and display comparison pictures, as well as monitor and feedback user operations, which is conducive to ensuring the stability of the application, improving program compatibility, and reducing the restrictions of device configuration on the smoothness of program operation. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 It is a flowchart of a method for implementing a program engine based on the Konva motion effect library provided in the first embodiment of the present application;
[0055] Figure 2 It is a flowchart of a method for implementing a program engine based on the Konva motion effect library provided in the second embodiment of the present application;
[0056] Figure 3 It is a flowchart of a method for implementing a program engine based on the Konva motion effect library provided in the third embodiment of the present application;
[0057] Figure 4 It is a flowchart of a method for implementing a program engine based on the Konva motion effect library provided in the fourth embodiment of the present application;
[0058] Figure 5 It is a flowchart of a method for implementing a program engine based on the Konva motion effect library provided in Embodiment 5 of the present application;
[0059] Figure 6 It is a flowchart of a method for implementing a program engine based on the Konva motion effect library provided in Example 6 of the present application;
[0060] Figure 7It is a flowchart of a method for implementing a program engine based on the Konva motion effect library provided in Embodiment 7 of the present application;
[0061] Figure 8 This is a schematic diagram of the running flow of the spot the difference game program based on the Konva animation library provided in Example 8 of the present application.
[0062] Fig. 9 It is a structural schematic diagram of a program implementation device of a program engine based on the Konva motion effect library provided in the ninth embodiment of the present application;
[0063] Fig.10 It is a schematic diagram of the structure of an electronic device provided in the tenth embodiment of the present application. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
[0065] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0066] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0067] In combination with the accompanying drawings, the program implementation method, device, equipment and medium of a program engine based on the Konva animation library provided by the embodiment of the present application are described in detail through specific embodiments and their application scenarios.
[0068] Embodiment 1
[0069] Figure 1 1 is a flowchart of a method for implementing a program engine based on the Konva animation library provided in the first embodiment of the present application. Figure 1 As shown, the specific steps include:
[0070] S101, in response to a program running trigger operation, initializing the program through the Konva motion effect library program engine;
[0071] The application scenario of this solution can be to provide users with comparison pictures through the Konva animation library and identify whether the user has found all the differences between the comparison pictures.
[0072] Based on the above scenario, it can be understood that the executor of this scenario can be a smart terminal used to run the Konva animation library, such as a tablet computer, interactive multimedia, etc., and no excessive restrictions are made here.
[0073] The program runs a trigger operation, which may be an operation such as the user clicking on a specified area to open the image comparison interface.
[0074] Konva is a JavaScript library for creating interactive graphics and animations, which provides rich functions and an easy-to-use API (Application Programming Interface). This enables developers to easily build rich and diverse interactive graphics and animation effects on web pages, thereby enhancing the visual effects and user experience of web pages.
[0075] Program engines can be the core components of developing programs or systems on electronic platforms. Using the engine, developers can quickly build and lay out the functions required by the program.
[0076] The program can be initialized by the Konva animation library program engine. The staff can pre-write a picture comparison program through the Konva animation library program engine. After recognizing that the user has triggered the program, the settings are read from the configuration file, environment variables, or command line parameters, and the variables and data structures in the program are set to initial values. The system is checked as necessary to ensure that the program can run safely in the current environment, such as checking file permissions, memory usage, or hardware compatibility. After the necessary checks are completed, the Konva stage and layers are initialized, that is, according to the pre-written program code, a Konva stage that adapts to the user's screen ratio is established, and some layers are added to the stage, so that comparison pictures and related prompt information can be displayed to the user on the stage later.
[0077] S102, loading image resources for comparison;
[0078] Image resources can be original images and difference images that may be used for comparison and placed in a designated file by the staff in advance. The original image can be stored in a designated location by the staff in advance, or can be randomly called from an existing image library through big data as a comparison for the difference image. The difference image can be a modification of some details in the original image, so that users can find the differences between the difference image and the original image.
[0079] The method of loading the image resources for comparison may be to import two images for comparison from a pre-specified file, adjust the image ratio according to the screen size, determine the placement of the two images in the canvas, and record the center point coordinates of the original image and the difference image, as well as the distance between the two images.
[0080] S103, obtaining the level selection result of the user, and determining configuration parameters according to the level selection result; wherein the configuration parameters include a distinguishing coordinate range, an initial duration, and a comparison threshold;
[0081] The difference coordinate range can be obtained by obtaining the coordinates of different points in the difference image compared to the original image, and appropriately expanding the range with the coordinates of the different points as the center point as the difference coordinate range. When the user's touch position falls within the difference coordinate range, it is considered that the user has touched the different point position, that is, the difference between the difference image and the original image has been correctly found.
[0082] The initial duration may be the total search duration that the user has in this round of searching for image differences. The user needs to find all the differences between the difference image and the original image within the initial duration.
[0083] The comparison threshold may be the number of all differences between the difference image and the original image. When the number of different points found by the user reaches the comparison threshold, it can be determined that the user has found all the differences.
[0084] The method of obtaining the level selection result is that the user can select the level of this image difference search by clicking the simple or difficult option icon before starting to find the difference between the images. In the simple level, the difference positions in the two compared images are fewer; in the difficult level, the number of difference positions in the images is appropriately increased compared to the simple level.
[0085] The method of determining the configuration parameters according to the level selection result can be that the staff originally specifies different configuration parameter data according to each level, for example, the initial time in the simple mode is 60 seconds, and the comparison threshold is 3 different points; the initial time in the difficult mode is 45 seconds, and the comparison threshold is 6 different points. After the user selects the level, the corresponding configuration parameters are obtained according to the user's level selection result, and the corresponding parameter data in the image comparison program is changed according to the configuration parameters.
[0086] S104, displaying the comparison picture, and starting the countdown according to the initial duration;
[0087] The comparison image may be displayed by rendering the image on a canvas according to the coordinates of the center point of the comparison image determined when loading the image resource, as well as parameter data such as size and border, so as to display the image to the user.
[0088] The method of starting the countdown according to the initial duration is to obtain the initial duration in the configuration parameters, start the timer, and continuously reduce the initial duration according to the time format. For example, if the initial duration is 60 seconds, then starting from the current moment, 1 is reduced from the value of 60 every second until 60 seconds is reduced to 0.
[0089] S105, monitoring the user's touch operation through the Konva animation library, and obtaining the user's touch position coordinates;
[0090] The way to monitor the user's touch operation through the Konva animation library is to set a listener in the comparison image through the Konva animation library, and use the touch operation as the monitoring event node. When the user touches the comparison image, it can be monitored by the pre-set listener. Among them, the listener can be a special component used to monitor the occurrence of certain specific events in the Web application and execute predefined operations or processing logic when these events occur.
[0091] The method of obtaining the coordinates of the user's touch position is to use the Konva animation library to add a node in the comparison picture, use the touch operation as a monitoring event node, and set it to obtain the coordinates of the touch position in the node after the touch operation is monitored. When the user touches the comparison picture, the coordinate acquisition instruction is triggered, and the smart terminal reads the coordinate point of the touch position in the comparison picture.
[0092] S106, identifying whether the touch position coordinates are within the distinguishing coordinate range, and if so, determining the touch position as a target point, and marking the target point in the comparison picture;
[0093] The method for determining the target point is to traverse the distinguishing coordinate range after obtaining the coordinates of the touch position, and identify whether the coordinates of the touch position are included in the distinguishing coordinate range. If the coordinates of the touch position are within the distinguishing range, the touch position is used as the target point, and accordingly, the coordinates of the touch position are used as the coordinates of the target point.
[0094] The target point can be marked in the comparison picture by circling the target point in the form of a red circle with the target point coordinates as the center, and the size of the red circle can be determined according to the size of the difference figure in the comparison picture. In this solution, the original picture and the difference picture are marked with a red circle, and the marking position in the original picture and the difference picture is guaranteed to be consistent.
[0095] S107, obtaining the number of target points and the remaining time, and determining that the image comparison is successful when the number of target points reaches a comparison threshold and the remaining time is greater than 0.
[0096] The number of target points may be the number of different points between the difference image found by the user and the original image.
[0097] The remaining time can be the remaining time after the countdown of the initial time at the current moment, that is, the time that the user can still use.
[0098] The method for determining whether the image comparison is successful is that when the countdown is turned on, the remaining time is set to be consistent with the initial time value, and gradually decreases as time increases until it decreases to 0, and the user cannot continue to find the target point. If the user finds the target point before the remaining time decreases to 0, the number of target points is compared with the comparison threshold. When the number of target points reaches the comparison threshold, it is checked again whether the current remaining time is 0. If the remaining time is not 0, it is determined that the image comparison is successful.
[0099] In an embodiment of the present application, in response to a program running trigger operation, the program is initialized through the Konva motion effect library program engine; image resources for comparison are loaded; the user's level selection result is obtained, and configuration parameters are determined according to the level selection result; wherein the configuration parameters include a difference coordinate range, an initial duration, and a comparison threshold; the comparison image is displayed, and a countdown is started according to the initial duration; the user's touch operation is monitored through the Konva motion effect library to obtain the user's touch position coordinates; it is identified whether the touch position coordinates are within the difference coordinate range, and if so, it is determined to be a target point, and the target point is marked in the comparison image; the number of target points and the remaining duration are obtained, and when the number of target points reaches the comparison threshold and the remaining duration is greater than 0, it is determined that the image comparison is successful.
[0100] Through the above-mentioned method of implementing a program based on the program engine of the Konva motion effect library, the Konva motion effect library can be used to render and display comparison pictures, as well as monitor and feedback user operations, which is conducive to ensuring the stability of the application, improving program compatibility, and reducing the restrictions of device configuration on the smoothness of program operation.
[0101] Embodiment 2
[0102] Figure 2 It is a flowchart of the program running method based on the Konva motion effect library program engine provided in the second embodiment of the present application. This solution makes a better improvement on the above embodiment, and the specific improvement is: loading the image resources for comparison, including: establishing a canvas; obtaining the image resources according to the preset address, setting the attribute information of the image through the Konva motion effect library, and importing the comparison image into the canvas according to the attribute information; wherein the attribute information includes the position and size of the image in the canvas, and the color and width of the border.
[0103] like Figure 2 As shown, specifically including the following:
[0104] S201, in response to a program running trigger operation, initializing the program through the Konva motion effect library program engine;
[0105] S202, establish a canvas;
[0106] The canvas can be a window used to carry out drawing operations and render content. Pictures and information can be typeset and displayed in the canvas to facilitate subsequent operations by users.
[0107] The way to create a canvas is to determine the size of the canvas according to the size of the user's screen and the preset ratio. Use the program function this.stage&&(this.stage=new Konva.Stage) to create a canvas of the specified size in the center of the page. Use the program function this.layer&&(this.layer=new Konva.Layer()) to create a new Konva layer on the canvas for drawing graphics on the canvas. In Konva, all graphic objects (such as shapes, pictures, etc.) need to be added to the layer, and then the layer is added to the canvas.
[0108] S203, obtaining a picture resource according to a preset address, setting the attribute information of the picture through the Konva motion effect library, and importing the comparison picture into the canvas according to the attribute information; wherein the attribute information includes the position and size of the picture in the canvas, and the color and width of the border;
[0109] The preset address may be the address of the location where the image resource to be compared is stored. The staff may set the path for obtaining the image resource in the program in advance. When the program is run, the required image may be directly read from the preset address.
[0110] To set the attribute information of the picture, you can determine the position of the picture in the canvas by the layout of the canvas content, and determine the size of the picture according to the size information of the canvas. For example, you can arrange two contrasting pictures horizontally on both sides of the center line of the canvas, or place them close to the center line so that the center of the picture is in the middle of the canvas height. In this solution, you can determine the position parameters of the picture by setting the coordinates of the center point of the picture in the canvas, and determine the size parameters of the picture by setting the specific values of the length and width of the picture. You can add a border to the picture to highlight the picture. The width and color of the border can be set in the program. If the width of the border is set to 0, the picture is displayed without a border.
[0111] The method of importing the comparison image into the canvas according to the attribute information can be to adjust the length and width values of the image according to the size of the image in the attribute information, place the center point of the image at the specified coordinates according to the position parameters in the attribute information, and add corresponding lines to the edge of the comparison image according to the width and color of the border in the attribute information.
[0112] S204, obtaining the level selection result of the user, and determining configuration parameters according to the level selection result; wherein the configuration parameters include a distinguishing coordinate range, an initial duration, and a comparison threshold;
[0113] S205, displaying the comparison picture, and starting the countdown according to the initial duration;
[0114] S206, monitoring the user's touch operation through the Konva animation library to obtain the user's touch position coordinates;
[0115] S207, identifying whether the touch position coordinates are within the distinguishing coordinate range, and if so, determining the touch position as a target point, and marking the target point in the comparison picture;
[0116] S208, obtaining the number of target points and the remaining time, and determining that the image comparison is successful when the number of target points reaches a comparison threshold and the remaining time is greater than 0.
[0117] The advantage of this setting is that you can import images into the created canvas, which is conducive to the subsequent processing of images and adding monitoring events through the Konva animation library, thereby improving the display and interactive effects of images.
[0118] Embodiment 3
[0119] Figure 3 This is a flowchart of a program running method based on the Konva animation library program engine provided in Example 3 of the present application. This solution makes a better improvement on the above-mentioned embodiment, and the specific improvement is: establishing a canvas, including: obtaining the user's screen size and resolution; determining the canvas size and display position according to the screen size and resolution, and establishing the canvas according to the canvas size and display position.
[0120] like Figure 3 As shown, specifically including the following:
[0121] S301, in response to a program running trigger operation, initializing the program through the Konva motion effect library program engine;
[0122] S302, obtaining the user's screen size and resolution;
[0123] Screen size can be the actual physical size of the display screen, usually expressed as the length of the screen diagonal. Resolution can refer to the number of pixels in the horizontal and vertical directions of the screen, usually expressed as vertical pixels multiplied by horizontal pixels, for example, 768*1224. The screen resolution determines the number of pixels that can be displayed on the screen. The higher the resolution, the more pixels can be displayed on the screen, the finer the image, and the more information can be displayed.
[0124] The method for obtaining the user's screen size and resolution may be to send an information acquisition instruction to the user's terminal device, and after the user's terminal device responds, receive feedback information from the user's terminal device, interpret the feedback information, and extract the screen size and resolution data therein.
[0125] S303, determining a canvas size and a display position according to the screen size and resolution, and establishing a canvas according to the canvas size and the display position;
[0126] The canvas size can be determined by obtaining multiple sets of screen sizes, resolutions, and corresponding canvas sizes through big data, using the canvas size as a label, the screen size and resolution as input variables, and performing supervised training to obtain the correlation between the screen size and resolution and the canvas size, and then building a big data model. The currently obtained screen size and resolution are input into the big data model, and the corresponding canvas size is determined according to the output result of the big data model.
[0127] The display position may be determined by calculating the actual center point of the user's screen according to the screen size and resolution, and setting the center point of the canvas to the actual center point.
[0128] The method of establishing a canvas according to the canvas size and display position may be to create a canvas of corresponding size according to the canvas length value and the canvas width value in the canvas size, extract the position coordinates in the display position, and place the center point of the canvas at the coordinate point.
[0129] S304, obtaining a picture resource according to a preset address, setting the attribute information of the picture through the Konva motion effect library, and importing the comparison picture into the canvas according to the attribute information; wherein the attribute information includes the position and size of the picture in the canvas, and the color and width of the border;
[0130] S305, obtaining the level selection result of the user, and determining configuration parameters according to the level selection result; wherein the configuration parameters include a distinguishing coordinate range, an initial duration, and a comparison threshold;
[0131] S306, displaying the comparison picture, and starting the countdown according to the initial duration;
[0132] S307, monitoring the user's touch operation through the Konva animation library, and obtaining the user's touch position coordinates;
[0133] S308, identifying whether the touch position coordinates are within the distinguishing coordinate range, and if so, determining the touch position as a target point, and marking the target point in the comparison picture;
[0134] S309: Obtain the number of target points and the remaining time. When the number of target points reaches the comparison threshold and the remaining time is greater than 0, determine that the image comparison is successful.
[0135] The benefit of this arrangement of the solution is that the canvas is established according to the user's screen size and resolution so that the canvas can adapt to the user's screen, which is conducive to presenting better visual effects to the user and improving the user's experience.
[0136] Embodiment 4
[0137] Figure 4 This is a flowchart of a program running method based on the Konva animation library program engine provided in the fourth embodiment of the present application. This solution makes a better improvement on the above embodiment, and the specific improvement is: after importing the comparison image into the canvas according to the attribute information, the method also includes: rendering the comparison image; and locating the coordinates of the first image and the second image in the comparison image in the canvas.
[0138] like Figure 4 As shown, specifically including the following:
[0139] S401, in response to a program running trigger operation, initializing the program through the Konva motion effect library program engine;
[0140] S402, establishing a canvas;
[0141] S403, obtaining a picture resource according to a preset address, setting the attribute information of the picture through the Konva motion effect library, and importing the comparison picture into the canvas according to the attribute information; wherein the attribute information includes the position and size of the picture in the canvas, and the color and width of the border;
[0142] S404, rendering the comparison picture;
[0143] Rendering can be the process of converting a 3D image or scene into a 2D image or displaying it on the screen. Specifically, rendering is the process of generating the final 2D image by calculating and combining various elements in the 3D scene, such as models, light sources, materials, textures, cameras, etc. This process can present the models, textures, light and shadow elements in the 3D scene in a realistic way, making the picture more realistic.
[0144] The way to render the comparison image can be to set the color, texture, reflection and other properties of the elements in the image to determine the appearance of each element in the rendered image. Set the appropriate light source according to the design requirements and the image scene. For example, the light source can be ambient light, parallel light, point light, etc. The shadow and shading effects of the elements under different light sources are different. Set the resolution and picture quality of the image to adjust the clarity and detail of the image. After the rendering is completed, the image can be post-processed, for example, the color and contrast of the image can be adjusted to further improve the quality and appearance of the image.
[0145] S405, performing coordinate positioning of the first picture and the second picture in the comparison picture in the canvas;
[0146] The first picture may be an unmodified picture used for comparison when the user is looking for different points in the picture.
[0147] The second picture may be a picture that is different from the first picture when the user is looking for different points in the picture. The second picture may be a picture obtained by retaining the main elements and adding or deleting some minor elements on the basis of the first picture. The amount of addition or deletion is consistent with the comparison threshold.
[0148] The method for coordinate positioning the first image and the second image in the comparison image can be to identify the image edges of the first image and the second image, and obtain the coordinate data of each image edge in the canvas to obtain the coordinate range occupied by the first image and the second image in the canvas.
[0149] S406, obtaining the level selection result of the user, and determining configuration parameters according to the level selection result; wherein the configuration parameters include a distinguishing coordinate range, an initial duration, and a comparison threshold;
[0150] S407, displaying the comparison picture, and starting the countdown according to the initial duration;
[0151] S408, monitoring the user's touch operation through the Konva animation library to obtain the user's touch position coordinates;
[0152] S409, identifying whether the touch position coordinates are within the distinguishing coordinate range, and if so, determining the touch position as a target point, and marking the target point in the comparison picture;
[0153] S410, obtaining the number of target points and the remaining time, and determining that the image comparison is successful when the number of target points reaches a comparison threshold and the remaining time is greater than 0.
[0154] The advantage of this setting is that the image imported into the canvas can be rendered, which is conducive to improving the texture and display effect of the image; the coordinate positioning of the image is conducive to improving the accuracy of target point determination.
[0155] Embodiment 5
[0156] Figure 5It is a flowchart of the program running method based on the Konva motion effect library program engine provided in Example 5 of the present application. This solution makes a better improvement on the above-mentioned embodiment, and the specific improvement is: monitoring the user's touch operation through the Konva motion effect library and recording the user's touch position coordinates, including: monitoring the user's touch operation through the Konva motion effect library, identifying the user's touch position, and judging whether the touch position is in the first picture in the comparison picture; if the touch position is in the first picture, then recording the coordinate point of the touch position in the first picture, if the touch position is not in the first picture, then recording the coordinate point of the touch position in the second picture; or, monitoring the user's touch operation through the Konva motion effect library, identifying the user's touch position, and judging whether the touch position is in the second picture in the comparison picture; if the touch position is in the second picture, then calculating the corresponding coordinate point of the touch position in the first picture according to the positional relationship between the second picture and the first picture, and recording the corresponding coordinate point as the user's touch position coordinates; if the user touch position is in the first picture, then recording the coordinates of the touch position.
[0157] like Figure 5 As shown, specifically including the following:
[0158] S501, in response to a program running trigger operation, initializing the program through the Konva motion effect library program engine;
[0159] S502, loading image resources for comparison;
[0160] S503, obtaining the level selection result of the user, and determining configuration parameters according to the level selection result; wherein the configuration parameters include a distinguishing coordinate range, an initial duration, and a comparison threshold;
[0161] S504, display the comparison picture, and start the countdown according to the initial duration; execute S505 or S507;
[0162] S505, monitoring the user's touch operation through the Konva animation library, identifying the user's touch position, and determining whether the touch position is in the first picture in the comparison pictures;
[0163] The user's touch operation may be an operation such as touching and clicking a corresponding position on the screen when the user finds a difference between the compared images.
[0164] The way to monitor the user's touch operation through the Konva animation library is to use Konva's on method to set the touch event listener on the canvas. For example, Konva supports multiple touch events, such as touchstart, touchmove, touchend, etc. In the touch listener, set one or more touch event processing methods. The touch event processing method will be called when the user performs a touch operation. For example, when the user touches the canvas, the coordinates of the user's touch position are obtained.
[0165] The method for identifying the user's touch position can be that when the user touches the screen, the intelligent terminal generates a touch event and passes it to the corresponding view or interface element, and then triggers the preset touch listener. The method in the touch listener will be called and execute the program for obtaining the coordinates of the user's touch position to obtain the corresponding coordinates of the user's touch position in the canvas.
[0166] A method for determining whether the touch position is in the first picture in the comparison picture may be to obtain the coordinate range corresponding to the first picture in the canvas, and identify whether the horizontal coordinate and the vertical coordinate of the touch position are both within the coordinate range of the first picture; if the horizontal coordinate and the vertical coordinate of the touch position are both within the coordinate range of the first picture, then the touch position is in the first picture in the comparison picture.
[0167] S506: If the touch position is in the first picture, record the coordinate point of the touch position in the first picture; if the touch position is not in the first picture, record the coordinate point of the touch position in the second picture;
[0168] The method of recording the coordinate points of the touch position may be that when it is determined that the touch position is in the first picture in the comparison picture, the coordinate points of the touch position currently acquired are recorded and the label of the first picture is added; when it is determined that the touch position is not in the first picture in the comparison picture, the coordinate points of the touch position currently acquired are recorded and the label of the second picture is added. In this embodiment, when identifying whether the touch position coordinates are within the difference coordinate range, part of the difference coordinate range contained in the first picture or the second picture can be selected for identification according to the label of the touch position coordinates, which greatly reduces the amount of calculation in the identification process and saves identification time.
[0169] S507, monitoring the user's touch operation through the Konva animation library, identifying the user's touch position, and determining whether the touch position is in the second picture in the comparison picture;
[0170] A method for determining whether the touch position is in the second picture in the comparison picture may be to obtain the coordinate range corresponding to the second picture in the canvas, and identify whether the horizontal coordinate and the vertical coordinate of the touch position are both within the coordinate range of the second picture; if the horizontal coordinate and the vertical coordinate of the touch position are both within the coordinate range of the second picture, then the touch position is in the second picture in the comparison picture.
[0171] S508: If the touch position is in the second picture, calculate the corresponding coordinate point of the touch position in the first picture according to the positional relationship between the second picture and the first picture, and record the corresponding coordinate point as the coordinate of the user's touch position; if the user's touch position is in the first picture, record the coordinate of the touch position;
[0172] The method of recording the coordinate points of the touch position may be, after determining that the touch position is in the second picture, obtaining the translation vector between the coordinates of the center point of the second picture and the coordinates of the center point of the first picture, and moving the coordinates of the touch position according to the translation vector. At this time, the coordinates after the movement are in the first picture and correspond to the touch position of the second picture. The coordinates after the movement are recorded as the coordinates of the touch position of the current user; if it is determined that the touch position is not in the second picture, the coordinates corresponding to the touch position in the canvas are directly recorded.
[0173] S509, identifying whether the touch position coordinates are within the distinguishing coordinate range, and if so, determining the touch position as a target point, and marking the target point in the comparison picture;
[0174] S510, obtaining the number of target points and the remaining time, and determining that the image comparison is successful when the number of target points reaches a comparison threshold and the remaining time is greater than 0.
[0175] The advantage of this arrangement of the present solution is that the amount of calculation for target point identification can be reduced and the efficiency of target point determination can be improved by identifying the image area where the touch position is located or by making the touch position correspond to the same image area.
[0176] Embodiment 6
[0177] Figure 6It is a flowchart of the program running method based on the Konva motion effect library program engine provided in Example 6 of the present application. This solution makes a better improvement on the above-mentioned embodiment, and the specific improvement is: marking the target point in the comparison picture, including: determining the marking range in the first picture according to the coordinates of the target point; obtaining the corresponding marking range of the marking range in the first picture in the second picture; marking the first picture and the second picture according to the marking range and the corresponding marking range; or determining the marking range in the second picture according to the coordinates of the target point; obtaining the corresponding marking range of the marking range in the second picture in the first picture; marking the second picture and the first picture according to the marking range and the corresponding marking range.
[0178] like Figure 6 As shown, specifically including the following:
[0179] S601, in response to a program running trigger operation, initializing the program through the Konva motion effect library program engine;
[0180] S602, loading image resources for comparison;
[0181] S603, obtaining the level selection result of the user, and determining configuration parameters according to the level selection result; wherein the configuration parameters include a distinguishing coordinate range, an initial duration, and a comparison threshold;
[0182] S604, displaying the comparison picture, and starting the countdown according to the initial duration;
[0183] S605, monitoring the user's touch operation through the Konva animation library to obtain the user's touch position coordinates;
[0184] S606, identifying whether the touch position coordinates are within the distinguishing coordinate range, and if so, determining the touch position as a target point; executing S607 or S610;
[0185] S607, determining a marking range in the first image according to the coordinates of the target point;
[0186] The method of determining the marking range in the first image according to the coordinates of the target point may be to pre-set the shape and size of the marking graphic. For example, for the target point, a red circle with a radius of x is used for marking. The coordinates of the target point are obtained, and the coordinates of the target point are used as the center point position of the marking graphic to further determine the coordinate range of the marking graphic. For example, a red circle is marked with the coordinates of the target point (a, b) as the center and x as the radius. At this time, all coordinates covered by the red circle are the marking range.
[0187] S608: Obtain a corresponding marked range in the second picture for the marked range in the first picture;
[0188] A method for obtaining the corresponding marked range in the second image of the marked range in the first image can be to obtain the translation vector between the center point coordinates of the second image and the center point coordinates of the first image, and move the marked range in the first image according to the translation vector. At this time, the moved marked range is the corresponding marked range in the second image.
[0189] S609: Mark the first picture and the second picture respectively according to the marking range and the corresponding marking range;
[0190] The first picture and the second picture may be marked by adding a marking graphic in the first picture according to the marking range and adding a marking graphic in the second picture according to the corresponding marking range. In this case, the locations of different points are marked in both the first picture and the second picture.
[0191] S610, determining a marking range in the second image according to the coordinates of the target point;
[0192] The method of determining the marking range in the second image according to the coordinates of the target point can be to pre-set the shape and size of the marking graphic. For example, for the target point, a red circle with a radius of x is used to mark it. The coordinates of the target point are obtained, and the coordinates of the target point are used as the center point position of the marking graphic to further determine the coordinate range of the marking graphic. For example, a red circle is marked with the coordinates of the target point (a, b) as the center and x as the radius. At this time, all coordinates covered by the red circle are the marking range.
[0193] S611, obtaining a corresponding marked range in the first picture of the marked range in the second picture;
[0194] A method for obtaining the corresponding marked range in the first image of the marked range in the second image can be to obtain the translation vector between the center point coordinates of the first image and the center point coordinates of the second image, and move the marked range in the second image according to the translation vector. At this time, the moved marked range is the corresponding marked range in the first image.
[0195] S612: Mark the second picture and the first picture respectively according to the marking range and the corresponding marking range;
[0196] The second picture and the first picture may be marked by adding a marking graphic in the second picture according to the marking range, and adding a marking graphic in the first picture according to the corresponding marking range. At this time, the locations of different points are marked in both the first picture and the second picture.
[0197] S613: Obtain the number of target points and the remaining time. When the number of target points reaches a comparison threshold and the remaining time is greater than 0, determine that the image comparison is successful.
[0198] The advantage of this arrangement of the present invention is that different points can be marked in both the first picture and the second picture, which is helpful in assisting users to record existing target points, providing users with an effective feedback mechanism, and improving the user experience.
[0199] Embodiment 7
[0200] Figure 7 This is a flowchart of a program running method based on the Konva animation library program engine provided in Example 7 of the present application. This solution makes a better improvement on the above-mentioned embodiment, and the specific improvement is: identifying whether the touch position coordinates are within the distinguishing coordinate range, and if so, determining it as a target point, including: identifying whether the touch position coordinates are within the distinguishing coordinate range; if within the distinguishing coordinate range, identifying whether the touch position is an existing target point; if the touch position is not an existing target point, using the touch position as a target point.
[0201] like Figure 7 As shown, specifically including the following:
[0202] S701, in response to a program running trigger operation, initializing the program through the Konva motion effect library program engine;
[0203] S702, loading image resources for comparison;
[0204] S703, obtaining the level selection result of the user, and determining configuration parameters according to the level selection result; wherein the configuration parameters include a distinguishing coordinate range, an initial duration, and a comparison threshold;
[0205] S704, displaying the comparison picture, and starting the countdown according to the initial duration;
[0206] S705, monitoring the user's touch operation through the Konva animation library, and obtaining the user's touch position coordinates;
[0207] S706, identifying whether the touch position coordinates are within a distinguishing coordinate range;
[0208] The method for identifying whether the touch position coordinates are within the distinguishing coordinate range can be to obtain the distinguishing coordinate range in the configuration parameters, extract all horizontal coordinate range segments in the distinguishing coordinate range, and identify whether there is a segment in the horizontal coordinate range segment that contains the horizontal coordinate of the touch position coordinates. If not, the touch position coordinates are not within the distinguishing coordinate range; if so, obtain the vertical coordinate range corresponding to the horizontal coordinate range segment, and identify whether the vertical coordinate range contains the vertical coordinate of the touch position coordinates. If not, the touch position coordinates are not within the distinguishing coordinate range; if included, the touch position coordinates are within the distinguishing coordinate range.
[0209] S707: If the touch position is within the distinguished coordinate range, identify whether the touch position is an existing target point;
[0210] The existing target point may be a target point that the user has found after the countdown starts.
[0211] The method of identifying whether the touch position is an existing target point can be, after determining that the touch position coordinates are within the distinguishing coordinate range, obtaining all distinguishing coordinate range segments containing the existing target points, identifying whether the touch position coordinates are within the distinguishing coordinate range segments containing the existing target points, if the touch position coordinates are within any distinguishing coordinate range segment containing the existing target point, then the current touch position is an existing target point; if the touch position coordinates are not within all distinguishing coordinate range segments containing the existing target point, then the current touch position is not an existing target point. In this solution, for the touch position that is an existing target point, it will not be repeatedly marked and counted.
[0212] S708: If the touch position is not an existing target point, use the touch position as a target point, and mark the target point in the comparison picture;
[0213] The touch position may be used as the target point in such a manner that when the touch position coordinates are within the difference coordinate range and the current touch position is not an existing target point, the touch position is determined to be the target point, that is, the different position of the comparison picture newly found by the user.
[0214] For example, the Konva animation library uses the listeners touchstart and touchend to listen to the player's touch events (finger pressing or leaving the screen). When the screen is pressed, the touch point position is obtained and assigned to this.markPoint. When the touch ends, the data items in this.correctData are traversed to check whether the position of each item coincides with this.markPoint and whether the point has not been marked.
[0215] S709: Obtain the number of target points and the remaining time. When the number of target points reaches the comparison threshold and the remaining time is greater than 0, determine that the image comparison is successful.
[0216] The advantage of this arrangement of the present solution is that it is possible to check whether the current touch position is an existing target point before determining the target point, so as to avoid the user repeatedly marking the same difference position, causing problems such as confusion in the feedback mechanism.
[0217] Embodiment 8
[0218] Figure 8 This is a schematic diagram of the running flow of the spot the difference game program based on the Konva animation library provided in Example 8 of the present application.
[0219] This embodiment takes the spot-difference game program based on the Konva animation library as an example to demonstrate the program running process. Figure 8 As shown in the figure, the Find Differences mini-game is an additional mini-game of a certain game. After the user enters the mini-game by clicking on the Find Differences mini-game element in the game, the running program of the Find Differences mini-game can be triggered and the Find Differences mini-game pop-up window can be opened. The mini-game program is initialized and a canvas is created. The imported image resources are rendered and listening events are added through the Konva animation library. During this process, the mini-game pop-up window shows the user a prompt message that the resources are loading... until the comparison image, mini-game title, mini-game countdown and other elements are added to the canvas, and the configuration parameters are set, the mini-game pop-up window displays the game screen. After the user finds the difference between the two compared pictures, he can click on the different point in either picture. During this process, the listener pre-set by the Konva animation library listens to the user's touch operation. When the touch operation is detected, the coordinates of the touch position are immediately obtained, and it is identified whether the touch position coordinates are within the pre-set different coordinate range. If the touch position coordinates are within the pre-set different coordinate range, the corresponding coordinates of the current touch position in the other picture are determined according to the difference in distance between the two compared pictures, and the touch position coordinates and the corresponding coordinates are marked with circles in the two pictures respectively; if the touch position coordinates are within the pre-set different coordinate range, the game screen will not respond.
[0220] This embodiment provides a spot-difference game program code based on the Konva animation library for reference:
[0221]
[0222]
[0223]
[0224]
[0225]
[0226]
[0227]
[0228]
[0229] Embodiment 9
[0230] Fig. 9 It is a structural diagram of a program running device based on the Konva motion effect library program engine provided in Example 9 of the present application.
[0231] like Fig. 9 As shown, specifically including the following:
[0232] A program initialization module 901 is used to initialize the program through the Konva motion effect library program engine in response to a program running trigger operation;
[0233] The picture resource loading module 902 is used to load picture resources for comparison;
[0234] Configuration parameter determination module 903, used to obtain the level selection result of the user, and determine the configuration parameters according to the level selection result; wherein the configuration parameters include the difference coordinate range, the initial time length and the comparison threshold;
[0235] A countdown start module 904 is used to display the comparison picture and start the countdown according to the initial duration;
[0236] A touch position coordinate acquisition module 905 is used to monitor the user's touch operation through the Konva animation library and acquire the user's touch position coordinates;
[0237] A target point determination module 906 is used to identify whether the touch position coordinates are within the distinguishing coordinate range, and if so, determine it as a target point, and mark the target point in the comparison picture;
[0238] The picture comparison success determination module 907 is used to obtain the number of target points and the remaining time, and determine that the picture comparison is successful when the number of target points reaches the comparison threshold and the remaining time is greater than 0.
[0239] In an embodiment of the present application, a program initialization module is used to respond to a program running trigger operation and initialize the program through the Konva animation library program engine; a picture resource loading module is used to load picture resources for comparison; a configuration parameter determination module is used to obtain the user's level selection result and determine the configuration parameters according to the level selection result; wherein the configuration parameters include a difference coordinate range, an initial duration and a comparison threshold; a countdown start module is used to display the comparison picture and start the countdown according to the initial duration; a touch position coordinate acquisition module is used to monitor the user's touch operation through the Konva animation library and obtain the user's touch position coordinates; a target point determination module is used to identify whether the touch position coordinates are within the difference coordinate range, and if so, it is determined as a target point and the target point is marked in the comparison picture; a picture comparison success determination module is used to obtain the number of target points and the remaining duration, and when the number of target points reaches the comparison threshold and the remaining duration is greater than 0, it is determined that the picture comparison is successful.
[0240] Through the above-mentioned program implementation device of the program engine based on the Konva motion effect library, the Konva motion effect library can be used to realize the rendering and display of comparison pictures, as well as the monitoring and feedback of user operations, which is conducive to ensuring the stability of the application, improving program compatibility, and reducing the restrictions of device configuration on the smoothness of program operation.
[0241] A program implementation device of a program engine based on the Konva animation library in an embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiments of the present application.
[0242] In the embodiment of the present application, a device for implementing a program based on a program engine of a Konva animation library may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0243] The device for implementing a program based on a program engine of a Konva motion effect library provided in an embodiment of the present application can implement each process implemented in the above-mentioned method embodiments. To avoid repetition, they will not be described again here.
[0244] Embodiment 10
[0245] like Fig.10 As shown, an embodiment of the present application also provides an electronic device 1000, including a processor 1001, a memory 1002, and a program or instruction stored in the memory 1002 and executable on the processor 1001. When the program or instruction is executed by the processor 1001, each process of the device embodiment of the program implementation of the program engine based on the Konva animation library is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0246] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0247] Embodiment 11
[0248] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned device embodiment implemented by the program engine based on the Konva animation library are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0249] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0250] Embodiment 12
[0251] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned device embodiment implemented by a program engine based on the Konva animation library, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0252] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0253] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0254] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0255] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0256] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.
Claims
1. A program running method based on Konva motion effect library program engine, characterized in that: The method comprises: In response to the program running trigger operation, the program is initialized through the Konva animation library program engine; Load the image resources for comparison; Obtaining the level selection result of the user, and determining configuration parameters according to the level selection result; wherein the configuration parameters include a distinguishing coordinate range, an initial duration, and a comparison threshold; Display the comparison picture and start the countdown according to the initial duration; Use the Konva animation library to monitor the user's touch operations and obtain the user's touch position coordinates; Identify whether the touch position coordinates are within the distinguishing coordinate range, and if so, determine it as a target point, and mark the target point in the comparison picture; The number of target points and the remaining time are obtained, and when the number of target points reaches the comparison threshold and the remaining time is greater than 0, it is determined that the image comparison is successful.
2. The method for implementing a program based on a program engine of a Konva animation library according to claim 1, characterized in that: Load image resources for comparison, including: Create a canvas; Obtain image resources according to a preset address, set the attribute information of the image through the Konva animation library, and import the comparison image into the canvas according to the attribute information; wherein the attribute information includes the position and size of the image in the canvas, and the color and width of the border.
3. The method for implementing a program based on a program engine of a Konva motion effect library according to claim 2, characterized in that: Create a canvas, including: Get the user's screen size and resolution; The canvas size and display position are determined according to the screen size and resolution, and the canvas is established according to the canvas size and display position.
4. The method for implementing a program based on a program engine of a Konva motion effect library according to claim 2, characterized in that: After importing the comparison image into the canvas according to the attribute information, the method further includes: Rendering the comparison picture; The first picture and the second picture in the comparison picture are coordinately positioned in the canvas.
5. The method for implementing a program based on a program engine of a Konva animation library according to claim 1, characterized in that: Use the Konva animation library to monitor the user's touch operations and record the user's touch position coordinates, including: Monitor the user's touch operation through the Konva animation library, identify the user's touch position, and determine whether the touch position is in the first picture in the comparison picture; If the touch position is in the first picture, the coordinate point of the touch position in the first picture is recorded; if the touch position is not in the first picture, the coordinate point of the touch position in the second picture is recorded; or, Monitor the user's touch operation through the Konva animation library, identify the user's touch position, and determine whether the touch position is in the second picture in the comparison picture; If the touch position is in the second picture, the corresponding coordinate point of the touch position in the first picture is calculated based on the positional relationship between the second picture and the first picture, and the corresponding coordinate point is recorded as the user's touch position coordinate; if the user's touch position is in the first picture, the coordinates of the touch position are recorded.
6. The method for implementing a program based on a program engine of a Konva animation library according to claim 1, characterized in that: Marking the target point in the comparison picture includes: Determine the marking range in the first image according to the coordinates of the target point; Obtaining a corresponding marked range in the second picture for the marked range in the first picture; Mark the first picture and the second picture respectively according to the marking range and the corresponding marking range; or, Determine the marking range in the second image according to the coordinates of the target point; Obtaining a corresponding marked range in the first picture for the marked range in the second picture; The second picture and the first picture are marked respectively according to the marking range and the corresponding marking range.
7. The method for implementing a program based on a program engine of a Konva animation library according to claim 1, characterized in that: Identifying whether the touch position coordinates are within the distinguishing coordinate range, and determining the touch position coordinates as the target point if within the distinguishing coordinate range, includes: Identifying whether the touch position coordinates are within a distinguishing coordinate range; If it is within the distinguishing coordinate range, identifying whether the touch position is an existing target point; If the touch position is not an existing target point, the touch position is used as the target point.
8. A program running device based on Konva animation library program engine, characterized in that: The device comprises: A program initialization module, for initializing the program through the Konva animation library program engine in response to a program running trigger operation; Image resource loading module, used to load image resources for comparison; A configuration parameter determination module, used to obtain the level selection result of the user, and determine the configuration parameters according to the level selection result; wherein the configuration parameters include a distinguishing coordinate range, an initial duration, and a comparison threshold; A countdown start module, used to display the comparison picture and start the countdown according to the initial duration; The touch position coordinate acquisition module is used to monitor the user's touch operation through the Konva animation library and obtain the user's touch position coordinates; a target point determination module, used to identify whether the touch position coordinates are within the distinguishing coordinate range, and if so, determine it as a target point, and mark the target point in the comparison picture; The picture comparison success determination module is used to obtain the number of target points and the remaining time. When the number of target points reaches the comparison threshold and the remaining time is greater than 0, it is determined that the picture comparison is successful.
9. An electronic device, characterized in that: It includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor. When the program or instruction is executed by the processor, the steps of a program implementation method of a program engine based on the Konva animation library are implemented as described in any one of claims 1 to 7.
10. A readable storage medium, characterized in that: The readable storage medium stores programs or instructions, and when the programs or instructions are executed by the processor, the steps of a program implementation method of a program engine based on the Konva animation library as described in any one of claims 1-7 are implemented.
