CN112346719A - Framework construction method for realizing asynchronous speed animation interactive program in VBA - Google Patents

Framework construction method for realizing asynchronous speed animation interactive program in VBA Download PDF

Info

Publication number
CN112346719A
CN112346719A CN202011109903.5A CN202011109903A CN112346719A CN 112346719 A CN112346719 A CN 112346719A CN 202011109903 A CN202011109903 A CN 202011109903A CN 112346719 A CN112346719 A CN 112346719A
Authority
CN
China
Prior art keywords
loop
vba
animation
elements
framework
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011109903.5A
Other languages
Chinese (zh)
Inventor
郑自然
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Normal University
Original Assignee
Shandong Normal University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Normal University filed Critical Shandong Normal University
Priority to CN202011109903.5A priority Critical patent/CN112346719A/en
Publication of CN112346719A publication Critical patent/CN112346719A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Computing Systems (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The present disclosure provides a framework construction method for realizing an asynchronous speed animation interactive program in a VBA, which comprises the following steps: setting initial speed values of different elements according to preset requirements, and carrying out normalization processing on different speeds; defining corresponding control variables and time length variables for different speed elements; establishing a total loop, and nesting different speed element animation codes by using the loop according to the magnitude of the speed value; adding interactive control codes of all elements in the corresponding cycle to complete the construction of a program framework; the method can fill the corresponding event response function and the change code of the animation key frame in the frame according to different requirements, can be used for compiling game codes based on VBA, can be used for compiling animation programs of different data elements, and is simple to implement, easy to understand the algorithm and flexible to expand.

Description

Framework construction method for realizing asynchronous speed animation interactive program in VBA
Technical Field
The disclosure relates to the technical field of program framework design, in particular to a framework construction method for realizing an asynchronous speed animation interactive program in a VBA.
Background
The statements in this section merely provide background information related to the present disclosure and may not necessarily constitute prior art.
Excel is a common spreadsheet software. Due to its powerful computing, visualization, and data processing functions, the software is applied to various fields. VBA (visual Basic for applications) is a macro programming language embedded in Excel. Powerful applications can be constructed in Excel software (or other Office software) using this language. Further, various visualization or dynamic programs related to spreadsheets can be built based on the VBA. The animation technology implemented in Excel based on VBA can be applied to fields such as game design, game programming education, algorithm demonstration, dynamic data visualization and the like.
The inventors of the present disclosure have discovered that while VBA is a function that helps enable interactive animation, certain high-level functions are not available in VBA, and there is no direct speed setting interface function in VBA when using VBA to generate interactive animation, such as to enable different speeds of different elements in an interactive game.
Disclosure of Invention
In order to solve the defects of the prior art, the method for constructing the framework for realizing the asynchronous speed animation interactive program in the VBA is provided, corresponding event response functions and change codes of animation key frames can be filled in the framework according to different requirements, the method can be used for compiling game codes based on the VBA and animation programs of different data elements, the implementation is simple, the algorithm is easy to understand, and the flexibility is expanded.
In order to achieve the purpose, the following technical scheme is adopted in the disclosure:
the first aspect of the present disclosure provides a frame construction method for implementing an asynchronous speed animation interactive program in a VBA.
A framework construction method for realizing an asynchronous speed animation interactive program in a VBA comprises the following steps:
setting initial speed values of different elements according to preset requirements, and carrying out normalization processing on different speeds;
defining corresponding control variables and time length variables for different speed elements;
establishing a total loop, and nesting different speed element animation codes by using the loop according to the magnitude of the speed value;
and adding the interactive control codes of all elements in the corresponding loop to complete the construction of the program framework.
As some possible implementations, in the program framework, all animation element updates and user input information appear in the overall loop, where the code of different elements are combined in a nested loop.
As some possible implementation manners, in the nested loop, for one element, the initialization of the auxiliary variable is performed first, and the updating of the element is performed finally.
By way of further limitation, the time occupied by initialization of the auxiliary variables and the update code of the elements is less than a preset value, and the time occupied by any element is mainly the loop filling code.
By way of further limitation, in the loop for the current element, a loop setup for the next element is performed until the last element setup is completed.
As some implementations are possible, the interactive control code for all elements is added to all loops.
A second aspect of the present disclosure provides a framework system for implementing an asynchronous speed animation interaction procedure in a VBA.
A framework system for implementing an asynchronous speed animation interaction procedure in a VBA, comprising: a nested loop of code for the total loop and for different elements in the total loop;
updating of all animation elements and user input information appear in the overall loop, and codes of different elements in the overall loop are combined in a nested loop mode;
in the loop of the current element, a loop of the next element is set, and a loop of the last element is set in a loop of the previous element.
As some possible implementation manners, in the nested loop, for one element, the initialization of the auxiliary variable is performed first, and the updating of the element is performed finally.
As some implementations are possible, the interaction control code for all elements is set in all loops.
A third aspect of the present disclosure provides an electronic device including the framework system for implementing an asynchronous speed animation interactive program in a VBA according to the second aspect of the present disclosure.
Compared with the prior art, the beneficial effect of this disclosure is:
1. the method, the framework system or the electronic equipment can fill and write corresponding event response functions and the change codes of the animation key frames in the framework according to different requirements, and can be used for writing game codes based on VBA and writing animation programs of different data elements.
2. The method, the framework system or the electronic equipment disclosed by the disclosure are simple to implement, the algorithm is easy to understand, the expansion is flexible, people with a certain programming basis can expand the method, the framework system or the electronic equipment, and corresponding program contents can be realized according to requirements.
3. According to the method, the framework system or the electronic device, the interaction control codes of all elements are arranged in all loops, and the input of a user at any time point can be facilitated.
Advantages of additional aspects of the disclosure will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the disclosure.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure, are incorporated in and constitute a part of this disclosure, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure and not to limit the disclosure.
Fig. 1 is a schematic flowchart of a framework construction method for implementing an asynchronous speed animation interactive program in a VBA according to embodiment 1 of the present disclosure.
Fig. 2 is a schematic diagram of a framework algorithm provided in embodiment 1 of the present disclosure.
Fig. 3 is a block movement screenshot in the initial stage provided in embodiment 1 of the present disclosure.
Fig. 4 is a block movement screenshot after a key is pressed according to embodiment 1 of the present disclosure.
Detailed Description
The present disclosure is further described with reference to the following drawings and examples.
It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the disclosure. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs.
It is noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of example embodiments according to the present disclosure. As used herein, the singular is intended to include the plural unless the context clearly dictates otherwise, and it should be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of features, steps, operations, devices, components, and/or combinations thereof.
The embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict.
Example 1:
as shown in fig. 1, an embodiment 1 of the present disclosure provides a framework building method for implementing an asynchronous speed animation interactive program in a VBA, including the following steps:
step 1: setting initial speed values of different elements according to requirements; carrying out normalization processing on different speeds to enable the different speeds to be normalized to a ratio with the maximum speed as 1;
step 2: defining corresponding control variables and time length variables for different speed elements;
and step 3: an overall loop is established and different velocity element animation codes are nested using the loop according to the magnitude of the velocity values.
And 4, step 4: adding interactive control codes in corresponding loops;
and 5: and (6) testing.
Step 2 to step 4 are the most main parts of the program framework described in the present embodiment. Wherein the framework basic code is shown in figure 2. For ease of understanding, this is expressed herein using pseudo code based on a general high-level language, and the following specific cases are expressed using VBA code.
In this embodiment, for convenience, three elements are assumed: element 1, element 2, and element 3, the velocity of each element being velocity 1, velocity 2, and velocity 3. And speed 1 is specified to be slowest, speed 2 is specified to be second, and speed 3 is specified to be fastest.
In fig. 2, the framework algorithm is explained as follows:
total cycle of action animation 1. All animation element updates and user input information appear in this overall loop. The codes of different elements in the overall loop are combined in a nested loop mode.
Lines 3 through 17 cycle element 1. Where action 3 assists in the initialization of variables. Update of the 16 th behavior element. For example, for a linearly moving element, the animation code may be erased at the old location and redrawn at the new location.
The codes of lines 3 and 16 take almost no time, so the time of element one is the loop fill of line 4. In the cycle of element 1, the setting of element 2 is performed in the same manner.
The structure of the element 2 code is identical to one except for the specific variables. Lines 7 to 14 in the figure are the codes of element 2. The same can add element 3, etc.
Also note the interactive code for all elements of lines 5 and 9, i.e., accepting user input and performing updates of the relevant variables. Since the user may enter at any point in time, the code needs to be put in all loops.
The following description will be made using a specific example. Suppose that there are three blocks moving at different speeds. The speed of the blocks is slowest in the first row, the second row and the third row. In addition, to show user interaction, when the user presses A, B or C on the keyboard, the three blocks are color-changed separately.
Fig. 3 and 4 are screenshots of this example. Wherein FIG. 3 is a start run screenshot; FIG. 4 is a screenshot of three keys pressed over a period of time.
The complete code is as follows:
Figure BDA0002728257060000061
Figure BDA0002728257060000071
Figure BDA0002728257060000081
Figure BDA0002728257060000091
DoEvents in the code provide intermittent control for the VBA program, are not the main part of the code, and can be omitted.
Temporary variables in the code are all global variables and need to be declared globally. The keyboard scan function GetAsyncKeyState requires additional definition, but does not differ in any way from the general approach.
The movement of the blocks is realized by coloring different cells, and other codes can be known through comments.
The time interval is inversely related to the speed, so the slowest block uses the largest interval here, and the other is the same. Note that the speed of the three squares is doubled. The relationship of the distance of movement is also doubled as can be seen from the positions of the squares in fig. 3 and 4.
If animation is used only and interactive control is not needed, the input control function processInput can be deleted.
Example 2:
the embodiment 2 of the present disclosure provides a framework system for implementing an asynchronous speed animation interactive program in a VBA, including: a nested loop of code for the total loop and for different elements in the total loop;
updating of all animation elements and user input information appear in the overall loop, and codes of different elements in the overall loop are combined in a nested loop mode;
in the loop of the current element, a loop of the next element is set, and a loop of the last element is set in a loop of the previous element.
The details of the specific framework system are the same as those in embodiment 1, and are not described here.
Example 3:
the embodiment 3 of the present disclosure provides an electronic device, which includes the framework system for implementing an asynchronous speed animation interactive program in a VBA according to the embodiment 2 of the present disclosure.
As will be appreciated by one skilled in the art, embodiments of the present disclosure may be provided as a method, system, or computer program product. Accordingly, the present disclosure may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present disclosure is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the disclosure. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure, and various modifications and changes may be made to the present disclosure by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.

Claims (10)

1. A framework construction method for realizing an asynchronous speed animation interactive program in a VBA is characterized by comprising the following steps:
setting initial speed values of different elements according to preset requirements, and carrying out normalization processing on different speeds;
defining corresponding control variables and time length variables for different speed elements;
establishing a total loop, and nesting different speed element animation codes by using the loop according to the magnitude of the speed value;
and adding the interactive control codes of all elements in the corresponding loop to complete the construction of the program framework.
2. The framework building method for implementing an asynchronous speed animation interaction program in a VBA as in claim 1, wherein in the program framework, the updating of all animation elements and user input information occur in an overall loop in which the codes of different elements are combined in a nested loop.
3. The method of claim 1, wherein the initialization of auxiliary variables and the updating of elements are performed first in a nested loop for an element.
4. The framework building method for implementing an asynchronous speed animation interactive program in VBA as claimed in claim 3, wherein the initialization of auxiliary variables and the time occupied by the update code of an element are less than a preset value, and the time occupied by any element is mainly a loop filling code.
5. The framework building method for implementing an asynchronous speed animation interaction program in a VBA as claimed in claim 3, wherein in the loop of the current element, the loop setting of the next element is performed until the last element setting is completed.
6. The framework building method for implementing an asynchronous speed animation interaction program in a VBA as in claim 1, wherein interaction control code for all elements is added to all loops.
7. A framework system for implementing an asynchronous speed animation interaction procedure in a VBA, comprising: a nested loop of code for the total loop and for different elements in the total loop;
updating of all animation elements and user input information appear in the overall loop, and codes of different elements in the overall loop are combined in a nested loop mode;
in the loop of the current element, a loop of the next element is set, and a loop of the last element is set in a loop of the last element.
8. The framework system for implementing an asynchronous speed animation interaction procedure in a VBA as in claim 7, wherein for an element, initialization of auxiliary variables is performed first and updating of the element is performed last in a nested loop.
9. The framework system for implementing an asynchronous speed animation interaction procedure in a VBA as in claim 7, wherein interaction control code for all elements is set in all loops.
10. An electronic device comprising the framework system of any of claims 7-9 for implementing an asynchronous speed animation interaction procedure in a VBA.
CN202011109903.5A 2020-10-16 2020-10-16 Framework construction method for realizing asynchronous speed animation interactive program in VBA Pending CN112346719A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011109903.5A CN112346719A (en) 2020-10-16 2020-10-16 Framework construction method for realizing asynchronous speed animation interactive program in VBA

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011109903.5A CN112346719A (en) 2020-10-16 2020-10-16 Framework construction method for realizing asynchronous speed animation interactive program in VBA

Publications (1)

Publication Number Publication Date
CN112346719A true CN112346719A (en) 2021-02-09

Family

ID=74360974

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011109903.5A Pending CN112346719A (en) 2020-10-16 2020-10-16 Framework construction method for realizing asynchronous speed animation interactive program in VBA

Country Status (1)

Country Link
CN (1) CN112346719A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07244471A (en) * 1994-03-04 1995-09-19 Dainippon Printing Co Ltd Presentation device for multi-media information
CN106502976A (en) * 2016-11-03 2017-03-15 济南大学 A kind of method that solving job shop scheduling problem Gantt chart is generated based on Excel and VB
CN106842982A (en) * 2016-12-23 2017-06-13 广东技术师范学院 One kind is based on many software collaboration analogue systems of VBA

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07244471A (en) * 1994-03-04 1995-09-19 Dainippon Printing Co Ltd Presentation device for multi-media information
CN106502976A (en) * 2016-11-03 2017-03-15 济南大学 A kind of method that solving job shop scheduling problem Gantt chart is generated based on Excel and VB
CN106842982A (en) * 2016-12-23 2017-06-13 广东技术师范学院 One kind is based on many software collaboration analogue systems of VBA

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
DINAR MAFTUKH FAJAR等: "Simulation of Torricelli Effluent Flow by Using Visual Basic for Application (VBA) on Microsoft Excel", 2014 INTERNATIONAL CONFERENCE ON ADVANCES IN EDUCATION TECHNOLOGY, 31 January 2014 (2014-01-31), pages 158 - 161 *
张未未等: "PPT 自有动画实现任意时长倒计时器的方法", 信息技术, no. 9, 30 September 2016 (2016-09-30), pages 81 - 85 *

Similar Documents

Publication Publication Date Title
CN102339291B (en) Method and equipment for generating list
Dideban et al. Reduction of constraints for controller synthesis based on safe Petri nets
CN105190547A (en) Staged animation of charts for data updates
CN103955367A (en) Method and device for generating pages
Victoria et al. liteITD a MATLAB Graphical User Interface (GUI) program for topology design of continuum structures
CN104995622A (en) Compositor support for graphics functions
Shi et al. Mage: An agent-oriented programming environment
CN112102446A (en) Animation processing method and device and computer readable storage medium
Yi et al. Development of a design system for EPS cushioning package of a monitor using axiomatic design
CN106874562A (en) A kind of converting system and its method that framework model is converted to static calculation model
CN107092514A (en) A kind of content of pages methods of exhibiting and device
CN112346719A (en) Framework construction method for realizing asynchronous speed animation interactive program in VBA
CN104142824A (en) Code generator based on class library and realization method of code generator
Lee et al. Modelling with forces: grammar-based graphic statics for diverse architectural structures
CN106527908A (en) Realization method and apparatus for stretch springing animation in application interface
CN107665124A (en) Modularization JavaScript file processing method, equipment and server
CN112416197B (en) Excel and VBA-based program single-step demonstration device and method
Jackson Transcoding sexuality: Computational performativity and queer code practices
CN113064591A (en) WPF page dynamic generation method, system, equipment and medium
CN106157366A (en) Ultra-large scene based on BIM renders optimization method and system in mobile terminal
Karakiewicz Interventions in Complex Urban Systems: How to Enable Modeling to Account for Disruptive Innovation
US20210201113A1 (en) Parallel execution of gated activation unit operations
Nakabayashi et al. Design and implementation of an extensible learner-adaptive environment
JP2011165051A (en) Development support device, method and program
Carlsson Tysk et al. An evaluation of MobileCross-platform Developmentusing React Native and NativeAndroid

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination