CN107463367B - Transition animation realization method and device - Google Patents

Transition animation realization method and device Download PDF

Info

Publication number
CN107463367B
CN107463367B CN201710479103.4A CN201710479103A CN107463367B CN 107463367 B CN107463367 B CN 107463367B CN 201710479103 A CN201710479103 A CN 201710479103A CN 107463367 B CN107463367 B CN 107463367B
Authority
CN
China
Prior art keywords
animation
page
transition
transition animation
configuration
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.)
Active
Application number
CN201710479103.4A
Other languages
Chinese (zh)
Other versions
CN107463367A (en
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.)
Beijing Xingxuan Technology Co Ltd
Original Assignee
Beijing Xingxuan Technology Co Ltd
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 Beijing Xingxuan Technology Co Ltd filed Critical Beijing Xingxuan Technology Co Ltd
Priority to CN201710479103.4A priority Critical patent/CN107463367B/en
Publication of CN107463367A publication Critical patent/CN107463367A/en
Application granted granted Critical
Publication of CN107463367B publication Critical patent/CN107463367B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation

Abstract

The embodiment of the application provides a transition animation realization method and device. The transition animation implementation method comprises the following steps: when an instruction for switching from a first page to a second page is received, pressing a view controller corresponding to the second page into the stack top of the UI navigation controller; judging whether a view controller corresponding to the second page rewrites a transition animation configuration object creation method created in a parent view controller in advance; if so, creating a transition animation execution object by using the configuration attribute of the transition animation defined in the rewritten transition animation configuration object creation method; setting the transition animation execution object as a proxy object of the UI navigation controller; and when the current page is determined to be the first page, triggering the proxy object to generate the transition animation in the process of switching from the first page to the second page according to the configuration attribute of the transition animation. By adopting the method provided by the embodiment of the application, the transition animation can be decoupled from the service, and the time cost for realizing the transition animation is reduced.

Description

Transition animation realization method and device
Technical Field
The application relates to the technical field of internet, in particular to a transition animation implementation method and device.
Background
Currently, almost all intelligent terminals involve switching of user interfaces. And with the rapid development of software and hardware technologies, the switching effect of the user interface is more and more rich. For example, in the iOS operating system, several common transition animation effects are provided, such as horizontal push, dissolve, page flip, etc. However, these effects do not fully cover the transition requirements in everyday development, and therefore the ability to implement custom transition animations is needed.
In a Model-View-Controller (MVC) architecture, developers can customize transition animations through proxy functions in the architecture, so that a user interface has richer dynamic effects when changing. However, in this scheme for realizing the custom transition animation, the transition animation is highly coupled with the service itself, and the time cost for realizing one transition animation is high.
Disclosure of Invention
Various aspects of the present application provide a transition animation implementation method and apparatus, which can decouple a transition animation from a service itself, and reduce the time cost for implementing the transition animation.
The embodiment of the application provides a transition animation implementation method, which comprises the following steps:
when an instruction for switching from a first page to a second page is received, pressing a view controller corresponding to the second page into the stack top of a UI navigation controller;
judging whether a view controller corresponding to the second page rewrites a transition animation configuration object creation method created in a parent view controller in advance;
if so, creating a transition animation execution object by using the configuration attribute of the transition animation defined in the rewritten transition animation configuration object creation method;
setting the transition animation execution object as a proxy object of the UI navigation controller;
and when the current page is determined to be the first page, triggering the proxy object to generate a transition animation in the process of switching from the first page to the second page according to the configuration attribute of the transition animation.
In an alternative embodiment, the transition animation configuration attributes include: the execution duration of the whole animation, an animation element set corresponding to the whole animation and the animation attribute of each animation element in the animation element set;
triggering the proxy object to generate the transition animation in the process of switching from the first page to the second page according to the configuration attribute of the transition animation, wherein the process comprises the following steps:
and sequentially moving each animation element according to the animation attribute of each animation element in the execution duration of the whole scene of animation to generate the transition animation in the process of switching from the first page to the second page.
In an optional embodiment, within the execution duration of the whole scene animation, sequentially acting each animation element according to the animation attribute of each animation element to generate a transition scene during switching from the first page to the second page, including:
creating a timer according to the execution duration of the whole animation;
periodically detecting whether animation elements in the animation element set need to execute animation according to the timing period of the timer;
when detecting that animation elements need to execute the animation, acting the animation elements needing to execute the animation according to the animation attributes of the animation elements needing to execute the animation;
and releasing the memory after all animation elements in the animation element set execute the animation.
In an alternative embodiment, the method further comprises, before the animation element requiring the execution of the animation is acted, according to the animation property of the animation element requiring the execution of the animation:
and intercepting a corresponding image from the second page according to the screen capture range in the animation attribute of the animation element which needs to execute the animation, wherein the corresponding image is taken as the animation element which needs to execute the animation.
In an optional embodiment, the method further comprises:
adding the transition animation configuration object creating method in the parent view controller in advance, and defining a method for returning the transition animation configuration object creating method;
and defining a configuration class of the transition animation in the transition animation configuration object creation method, wherein the configuration class of the transition animation comprises a plurality of animation items, and each animation item is used for defining the configuration attribute of one transition animation.
In an optional embodiment, before determining that the current page is the first page, the method further comprises:
and binding the transition animation execution object to a view controller corresponding to the second page by using an associated object in a runtime technology.
In an optional embodiment, the method further comprises:
when an instruction for switching from the second page to the first page is received, popping up a view controller corresponding to the second page at the stack top of the UI navigation controller;
acquiring the transition animation execution object bound by the view controller corresponding to the second page;
setting the transition animation execution object as a proxy object of the UI navigation controller;
and when the current page is determined to be the second page, triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the configuration attribute of the transition animation.
In an optional embodiment, before setting the transition animation execution object as a proxy object for the UI navigation controller, the method further comprises:
modifying the transition animation configuration attribute;
triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the configuration attribute of the transition animation, wherein the process comprises the following steps:
and triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the modified transition animation configuration attribute.
The embodiment of the present application further provides a transition animation implementation apparatus, including:
the stack pushing module is used for pushing the view controller corresponding to the second page into the stack top of the UI navigation controller when receiving an instruction for switching from the first page to the second page;
the judging module is used for judging whether the view controller corresponding to the second page rewrites a transition animation configuration object creation method which is created in the parent view controller in advance;
the creation module is used for creating a transition animation execution object by utilizing the configuration attribute of the transition animation defined in the rewritten transition animation configuration object creation method when the judgment result of the judgment module is yes;
the setting module is used for setting the transition animation execution object as a proxy object of the UI navigation controller;
and the generation module is used for triggering the proxy object to generate the transition animation in the process of switching from the first page to the second page according to the configuration attribute of the transition animation when the current page is determined to be the first page.
In an alternative embodiment, the transition animation configuration attributes include: the execution duration of the whole animation, an animation element set corresponding to the whole animation and the animation attribute of each animation element in the animation element set;
the generation module is specifically configured to: and sequentially moving each animation element according to the animation attribute of each animation element in the execution duration of the whole scene of animation to generate the transition animation in the process of switching from the first page to the second page.
In an optional embodiment, the generating module is specifically configured to: creating a timer according to the execution duration of the whole animation; periodically detecting whether animation elements in the animation element set need to execute animation according to the timing period of the timer; when detecting that animation elements need to execute the animation, acting the animation elements needing to execute the animation according to the animation attributes of the animation elements needing to execute the animation; and releasing the memory after all animation elements in the animation element set execute the animation.
In an optional embodiment, the generating module is further configured to: and intercepting a corresponding image from the second page according to the screen capture range in the animation attribute of the animation element which needs to execute the animation, wherein the corresponding image is taken as the animation element which needs to execute the animation.
In an alternative embodiment, the apparatus further comprises: the adding module is used for adding the transition animation configuration object creating method in the parent view controller in advance and defining a method for returning the transition animation configuration object creating method; the configuration class of the transition animation is defined in the method for creating the configuration object of the transition animation, the configuration class of the transition animation comprises a plurality of animation items, and each animation item is used for defining the configuration attribute of one transition animation.
In an alternative embodiment, the apparatus further comprises: and the binding module is used for binding the transition animation execution object to the view controller corresponding to the second page by using the associated object in the runtime technology.
In an alternative embodiment, the apparatus further comprises:
the pop module is used for popping a view controller corresponding to the second page out of the stack top of the UI navigation controller when an instruction for switching from the second page to the first page is received;
the obtaining module is used for obtaining the transition animation execution object bound by the view controller corresponding to the second page;
the setup module is further configured to: setting the transition animation execution object as a proxy object of the UI navigation controller;
the generation module is further to: and when the current page is determined to be the second page, triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the configuration attribute of the transition animation.
In an alternative embodiment, the apparatus further comprises:
the modification module is used for modifying the configuration attribute of the transition animation before the setting module sets the transition animation execution object as the proxy object of the UI navigation controller;
the generation module is specifically configured to: and triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the modified transition animation configuration attribute.
An embodiment of the present application further provides an electronic device, including: one or more memories and one or more processors; the one or more memories are configured to store one or more computer instructions, wherein the one or more computer instructions, when executed by the one or more processors, enable implementation of the steps in the transition animation implementation method described above.
The embodiment of the present application further provides a computer-readable storage medium storing a computer program, where the computer program, when executed by a computer, can implement the steps in the transition animation implementation method.
In the embodiment of the application, a transition animation configuration object creation method is created in a parent view controller in advance, a child view controller is allowed to inherit and rewrite a transition animation configuration object creation method of a parent, a transition animation configuration attribute is defined in the rewritten transition animation configuration object creation method, a transition animation execution object is created based on the transition animation configuration attribute, further, the proxy function of a UI navigation controller is combined, the transition animation execution object is set as a proxy object of the UI navigation controller, the proxy object is triggered to realize transition animation according to the transition animation configuration attribute, the transition animation can be decoupled from a service, the efficiency of realizing the transition animation is improved, and the time cost of realizing the transition animation is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic diagram of a correspondence relationship between two data structures according to an embodiment of the present application;
FIG. 2 is a diagram illustrating a property list of an animatographic item defined transition animation according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a transition animation implementation method according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating a transition animation implementation method according to another embodiment of the present application;
FIG. 5 is a schematic structural diagram of a transition animation implementation apparatus according to another embodiment of the present application;
fig. 6 is a schematic structural diagram of a transition animation implementation apparatus according to another embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the existing MVC architecture, a User Interface (User Interface, UI) navigation controller (uinnavigation controller) can be used as a UI stack control view controller (ViewController) level, and besides, developers are allowed to customize transition animations through an agent function of the User, but in the scheme for realizing the customized transition animations, the transition animations are highly coupled with services, so that the time cost for realizing one transition animation is high.
Aiming at the problems existing when the conventional transition agent framework provided based on the UINavigationController realizes the user-defined transition animation, the embodiment of the application provides a solution, and the main principle is as follows: the method comprises the steps of creating a transition animation configuration object creating method in a parent view controller in advance, allowing a child view controller to inherit and rewrite a transition animation configuration object creating method of a parent, defining a transition animation configuration attribute in the rewritten transition animation configuration object creating method, creating a transition animation execution object based on the transition animation configuration attribute, further combining the proxy function of a UI navigation controller, and triggering the proxy object to realize transition animation according to the transition animation configuration attribute by setting the transition animation execution object as the proxy object of the UI navigation controller. In the embodiment of the application, the transition animation configuration object creation method allowing the child view controller to rewrite the parent class is used for defining the configuration attribute of the transition animation, and the transition animation can be decoupled from the service itself without realizing a transition animation (animation transition) proxy protocol of the UI navigation controller in the view controller, so that the efficiency of realizing the transition animation is improved, and the time cost for realizing the transition animation is reduced. The rewriting means that a method of a child class overrides a method of a parent class, and requires that the names and parameters of the methods are the same.
Before transition animation is realized, a transition animation configuration object creation method needs to be created in a parent view controller in advance, transition animation configuration attributes can be defined in the transition animation configuration object creation method, and the transition animation configuration attributes mainly refer to attributes related to realization of transition animation. By way of example, these attributes may include, but are not limited to: the transition animation requires an animation element, an initial position of the animation element, an end position of the animation element, an initial angle (alpha) of the animation element, an end angle of the animation element, an animation scaling, an animation start time, an animation duration, whether the animation element is hidden before the animation, whether the animation element is hidden after the animation, and the like.
Alternatively, a transition animation configuration object creation method may be added in the parent class view controller and an implementation of the corresponding transition animation configuration object creation method defined in the child class view controller. For example, a transition animation configuration object creation method may be implemented as a category (category) method in a parent view controller, while defining the implementation of the corresponding category method in a child view controller.
Further optionally, in order to abstract animation elements and simplify implementation logic of transition animations, in the embodiment of the present application, two data structures are defined, respectively: an animation item (animalatortitem) and an animation configuration class (animalotorconfiguration). An animatoconfiguration includes animatorritems, each of which can define one or more configuration properties of a transition animation. Alternatively, an animatoltem may define the configuration properties of a transition animation through a configuration list.
Further, in the UI navigation controller, a stack is used to manage the view controller, the view controller that is first stacked is at the bottom of the stack, the view controller that is last stacked is at the top of the stack, and the page corresponding to the view controller at the top of the stack is the page that is currently displayed to the outside by the UI navigation controller, that is, the page that the user sees. The push and the pop are methods for operating the stack, in the UI navigation controller, the push can press a view controller to the top of the stack, and the pop can pop the view controller at the top of the stack; for the user, a page can be opened through push and pop operations, or jump between pages is realized.
Combining the push and pop methods described above, animalatoritem can be divided into push-time item (abbreviated as push-item) and pop-time item (abbreviated as pop-item). The relationship between the two data structures is shown in fig. 1. Accordingly, each animaltoreitem defines a list of properties for a transition animation as shown in FIG. 2, but the animation properties that an animaltoreitem can define are not limited to the properties shown in FIG. 2.
In the embodiment of the present application, the parent class view controller added with the above-described transition animation configuration object creation method allows the child class view controller to inherit and rewrite the transition animation configuration object creation method in the parent class. Based on this, for each subclass view controller which needs to realize the transition animation, only the creation method of the transition animation configuration object in the parent view controller needs to be rewritten, the transition animation proxy protocol of the UI navigation controller does not need to be written in the subclass view controller, and the implementation logic of the transition animation provided by the embodiment of the application is further combined, so that the decoupling of the transition animation and the service can be realized, the efficiency of realizing the transition animation is improved, and the time cost for realizing the transition animation is reduced.
Based on the transition animation configuration object creation method created in the parent view controller, the logic of implementing transition animation based on the transition animation configuration object creation method of rewriting parent will be described in detail below with reference to the accompanying drawings.
Fig. 3 is a schematic flow chart of a transition animation implementation method according to an embodiment of the present application. As shown in fig. 3, the method includes:
301. and when an instruction for switching from the first page to the second page is received, pressing a view controller corresponding to the second page to the top of the stack of the UI navigation controller.
302. Judging whether a view controller corresponding to the second page rewrites a transition animation configuration object creation method created in a parent view controller in advance; if yes, go to step 303; if the judgment result is negative, the realization process of the existing transition animation can be entered.
303. And creating a transition animation execution object by using the configuration attribute of the transition animation defined in the rewritten transition animation configuration object creation method.
304. And setting the transition animation execution object as a proxy object of the UI navigation controller.
305. And when the current page is determined to be the first page, triggering the proxy object to generate the transition animation in the process of switching from the first page to the second page according to the configuration attribute of the transition animation.
In any application scenario with a page switching requirement, the transition animation implementation method provided by the embodiment can be used for implementing transition animation in the switching process of two pages, so that the transition animation has richer dynamic effect when the pages are changed, and the user experience is improved.
For example, when a user needs to switch a page, a page switching operation may be triggered by a switching manner supported by the page. For example, if the current page supports a swipe operation, the user may trigger a switch between pages through the swipe operation. For another example, if the current page is provided with a switch button, for example, the current page may be a tab corresponding to a different page, the user may trigger switching between pages by clicking the switch button.
From the perspective of equipment, the method can capture page switching operation triggered by a user, determine that the user needs to switch from a current page to another page, further generate a page switching instruction, and trigger transition animation to realize a flow according to the page switching instruction. For convenience of description, in the present embodiment, it is assumed that the user needs to switch from the first page to the second page. The first page and the second page may be pages in any application scenario, for example, two pages in any APP, two pages in a browser, and the like. Based on this, when an instruction to switch from the first page to the second page is received, the transition animation implementation flow is started.
In this embodiment, the transition animation implementation flow is as follows:
and when an instruction for switching from the first page to the second page is received, pressing a view controller corresponding to the second page to the top of the stack of the UI navigation controller. And a push method in the UI navigation controller can be called, and the view controller corresponding to the second page is pressed to the stack top.
Then, whether the view controller corresponding to the second page rewrites the transition animation configuration object creation method created in the parent view controller in advance is judged. This is different from the existing transition animation implementation flow which does not include the judgment logic. The view controller corresponding to the second page here corresponds to the sub-view controller that needs to implement the transition animation.
In an alternative embodiment, the transition animation configuration object creation method uses two data structures shown in FIG. 1. Based on the method, whether the animation configuration object returns after the view controller corresponding to the second page is executed can be judged, and if the animation configuration object returns after the view controller corresponding to the second page is executed, the transition animation configuration object creation method of the parent class is determined to be rewritten by the view controller corresponding to the second page; and if no animation configuration object returns after the view controller corresponding to the second page is executed, determining that the view controller corresponding to the second page does not rewrite the transition animation configuration object creation method of the parent class.
If the view controller corresponding to the second page is judged not to rewrite the transition animation configuration object creation method of the parent class, which means that the transition animation needs to be realized according to the realization flow of the existing transition animation, the realization flow of the existing transition animation can be entered. The existing transition animation implementation flow refers to a process of implementing a custom transition animation based on a transition animation agent protocol provided by a UINavigationController, and specifically includes: before executing the implementation process of the existing transition animation, implementing a transition animation agent protocol provided by a UI navigation controller in a view controller corresponding to a second page in advance, and implementing a transitionDuration method, wherein the transitionDuration method is used for configuring transition time; after the existing transition animation realization process is entered, when the transition time is reached, parameters such as a view container, an animation state before transition, an animation state after transition and the like are obtained from a first page and a second page, and animation transformation realized in a view controller corresponding to the second page in advance is called to realize the transition animation. The time cost for realizing animatedtransition in the view controller corresponding to the second page is high, and the process for realizing the transition animation is related to the first page and the second page and is tightly combined with the service, so that the realization logic of the transition animation cannot be well concerned.
If the view controller corresponding to the second page is judged to rewrite the transition animation configuration object creation method of the parent class, the configuration attribute of the transition animation is defined in the rewritten transition animation configuration object creation method, and the configuration attribute of the transition animation is the attribute of the transition animation required in the process of switching from the first page to the second page. Based on this, a transition animation execution object (animation) can be created using the transition animation configuration attributes defined in the rewritten transition animation configuration object creation method. The process of creating a transition animation execution object here is essentially a process of newly creating a transition animation execution object, and initializing the newly created transition animation execution object using the transition animation configuration properties. The transition animation configuration attributes are used as attributes of transition animation execution objects, and animation processing is carried out according to the transition animation configuration attributes after the transition animation execution objects are created.
Further, when the transition animation is implemented, an animation agent provided by the UI navigation controller needs to be relied upon, and then the created transition animation execution object is set as a proxy object (delete) of the UI navigation controller, so as to facilitate animation processing by the proxy object. At this time, the proxy object will perform animation processing instead of the default transition animation.
Further, the transition animation configuration attribute is an attribute of a transition animation required when switching from the first page to the second page, and then whether the current page is the first page is further determined. For example, the identifier of the current page may be obtained, and the identifier of the current page may be compared with the identifier of the first page; if the two are the same, the current page can be determined to be the first page; if the two are different, the current page is not the first page. And when the current page is determined to be the first page, triggering the proxy object of the UI navigation controller to generate the transition animation in the process of switching from the first page to the second page according to the configuration attribute of the transition animation.
Optionally, if the current page is not the first page, which indicates that an error may occur in the middle, the current operation may be selected to be ended. Further optionally, an error prompt message may also be output.
In an alternative embodiment, the transition animation configuration attributes defined by the rewritten transition animation configuration object creation method may include: the execution duration of the whole animation, the animation element set corresponding to the whole animation and the animation attribute of each animation element in the animation element set. The animation properties of each animation element may be, but are not limited to: the attributes in the attribute list shown in fig. 2.
Based on the transition animation configuration attribute, the process of generating the transition animation in the process of switching from the first page to the second page according to the transition animation configuration attribute may include: and sequentially moving each animation element according to the animation attribute of each animation element in the execution duration of the whole scene of animation to generate the transition animation in the process of switching from the first page to the second page.
Further optionally, the process of generating the transition animation may be divided into three stages, respectively: an element preprocessing stage, an element animation stage and an end emptying stage.
Based on the above, a process of generating transition animations includes:
element pretreatment stage: creating a timer according to the execution duration of the whole scene of the animation, wherein the timing duration of the timer is equal to the execution duration of the whole scene of the animation; the timer, on one hand, will time for the execution duration of the whole animation, on the other hand, will periodically time according to a set timing interval, which is much smaller than the execution duration of the whole animation, for example, the timing interval may be 0.005 s; each time the timer expires for a timed interval, it is detected whether any animation element in the set of animation elements needs to perform an animation. The method comprises the following steps of detecting whether an animation element needs to execute the animation or not, wherein the step of detecting whether the timing time of a timer for the execution duration of the whole animation is greater than the starting execution time of the animation element or not is mainly judged; if the timing time of the timer aiming at the execution duration of the whole animation is judged to be greater than or equal to the starting execution time of the animation element, determining that the animation element needs to execute the animation; conversely, determining that the animation element does not require animation.
Element animation phase: and when detecting that the animation element needs to execute the animation, acting the animation element needing to execute the animation according to the animation attribute of the animation element needing to execute the animation.
Optionally, if an animation element is defined in the animation attribute of the animation element needing to execute the animation, directly acting the animation element; if the animation element is not defined in the animation attribute of the animation element needing to execute the animation, but a screen capture range is defined, the corresponding image can be captured from the second page according to the screen capture range in the animation attribute of the animation element needing to execute the animation, and the corresponding image is used as the animation element needing to execute the animation.
Furthermore, the animation element which needs to execute the animation can be controlled to perform corresponding actions according to attributes such as the initial position of the animation element, the duration of the animation element, the initial angle of the animation, the end angle of the animation element and the like which are defined in the animation attributes of the animation element which needs to execute the animation. When all animation elements in the animation element set realize corresponding actions according to the animation attributes corresponding to the animation elements, the transition animation is realized.
And (4) finishing the emptying stage: and after all the animation elements in the animation element set realize corresponding actions according to the animation attributes corresponding to the animation elements, emptying all the animation elements in the animation element set so as to release the memory.
As can be seen from the above analysis, in this embodiment, the view controller that needs to implement the transition animation can obtain the configuration attribute of the transition animation only by rewriting the creation method of the transition animation configuration object of the parent class, and only by setting the transition animation execution object as the proxy object of the UI navigation controller, it is not necessary to implement the animation proxy of the UI navigation controller in the view controller that needs to implement the transition animation, and the animation proxy can be decoupled from the service, so that the efficiency of implementing the transition animation is improved, and the time cost for implementing the transition animation is reduced.
In the above embodiment or the following embodiments, after the transition animation execution object is set as the proxy object of the UI navigation controller, the transition animation execution object may be bound to the view controller corresponding to the second page using an associated object in a runtime (runtime) technology of OC (Objective-C). The transition animation execution object is bound to the view controller corresponding to the second page during running through the associated object, so that the life cycle of the transition animation execution object and the life cycle of the view controller corresponding to the second page are bound together, the life cycle of the transition animation execution object does not need to be concerned independently, the transition animation execution object can be released along with the view controller corresponding to the second page when the view controller corresponding to the second page releases the memory, the problem that the transition animation execution object occupies the memory all the time can be avoided, and the utilization rate of the memory is improved.
In practical applications, after the user switches from the first page to the second page, in many cases, it may be necessary to switch back from the second page to the first page. For example, the user switches from the home page of a shopping category APP to the user detail page to view the coupon information, and then returns to the home page to start shopping. The page switching effect can also be improved by the transition animation in the process of switching from the second page back to the first page. In theory, switching from the second page to the first page is the reverse of switching from the first page to the second page, and its transition animations may be the same or similar. Therefore, when the transition animation is switched from the first page to the second page and then from the second page to the first page, the transition animation can be realized directly based on the transition animation execution object which is already created in the process of switching from the first page to the second page, so that the efficiency of realizing the transition animation is improved, and the resources are saved. Based on this, another embodiment of the present application provides a transition animation implementation method, as shown in fig. 4, the method includes:
401. and when an instruction of switching from the second page to the first page is received, popping the view controller corresponding to the second page out of the stack top of the UI navigation controller.
402. And acquiring a transition animation execution object bound by the view controller corresponding to the second page, wherein the transition animation execution object is created in the transition animation implementation process of switching from the first page to the second page and is bound to the view controller corresponding to the second page.
403. And setting the transition animation execution object as a proxy object of the UI navigation controller.
404. When the current page is determined to be a second page, triggering the proxy object to generate a transition animation in the process of switching from the second page to the first page according to the configuration attribute of the transition animation; and the transition animation configuration attribute is defined by a transition animation configuration object creation method of a parent view controller rewritten by a view controller corresponding to the second page in the transition animation implementation process of switching from the first page to the second page.
In this embodiment, when the user needs to switch from the second page back to the second page, the page switching operation may be triggered by a switching manner supported by the page. For example, if the current page supports a swipe operation, the user may trigger a switch between pages through the swipe operation. For another example, if the current page is provided with a switch button, for example, the current page may be a tab corresponding to a different page, the user may trigger switching between pages by clicking the switch button.
From the perspective of the device, a page switching operation triggered by the user can be captured, and when the user is determined to need to switch from the second page to the first page, a page switching instruction can be generated. Based on the above, when an instruction for switching from the second page to the first page is received, the transition animation realization process is started.
In this embodiment, the transition animation implementation flow is as follows:
upon receiving an instruction to switch from the second page to the first page, it may be recognized that the view controller corresponding to the second page is present at the top of the stack of the UI navigation controller, and the first page belongs to Item at pop, and then the view controller corresponding to the second page may be popped out of the top of the stack of the UI navigation controller. And the pop method of the UI navigation controller can be called, and the view controller corresponding to the second page is popped out of the stack top of the UI navigation controller.
In addition, because the transition animation in the process of switching from the first page to the second page is realized, in the process of realizing the transition animation, the configuration property of the transition animation and the execution object of the transition animation are obtained, and the execution object of the transition animation is bound into the view controller corresponding to the second page. Based on the method, the transition animation execution object bound by the view controller corresponding to the second page can be directly obtained, the transition animation execution object does not need to be created again, and the efficiency of realizing the transition animation is improved.
Further, when the transition animation is implemented, an animation agent provided by the UI navigation controller needs to be relied on, and then the acquired transition animation execution object is set as a proxy object of the UI navigation controller, so that animation processing is facilitated through the proxy object.
Further, since the first page needs to be returned from the second page, it needs to be further determined whether the current page is the second page. For example, the identifier of the current page may be obtained, and the identifier of the current page may be compared with the identifier of the second page; if the two are the same, the current page can be determined to be the second page; if the two are different, the current page is not the second page. And when the current page is determined to be the second page, triggering the proxy object of the UI navigation controller to generate the transition animation in the process of switching from the second page to the first page according to the corresponding transition animation configuration attribute.
Optionally, if the current page is not the second page, which indicates that an error may occur in the middle, the current operation may be selected to be ended. Further optionally, an error prompt message may also be output.
Further optionally, the transition animation in the process of switching from the second page to the first page may be the same as or different from the transition animation in the process of switching from the first page to the second page. If the attribute is configured by directly using the transition animation in the process of switching from the first page to the second page in the process of switching from the second page to the first page, the transition animation same as the transition animation in the process of switching from the first page to the second page can be realized. Modifying the configuration attribute of the transition animation before the agent object triggering the UI navigation controller generates the transition animation in the process of switching from the second page to the first page according to the configuration attribute of the transition animation; then, the trigger proxy object generates the transition animation in the process of switching from the second page to the first page according to the modified configuration attribute of the transition animation, so that the transition animation different from the transition animation in the process of switching from the first page to the second page can be realized.
For example, the starting positions of the two transition animations may be different, the rotation angles may be different, the transparency may be different, etc., to further enrich the animation effect when the page changes.
In summary, by adopting the method provided by the embodiment of the application, developers can customize complex and colorful transition animations, and only need to create a transition animation configuration object creation method in a parent view controller in advance, for a child view controller needing transition animations, only need to directly inherit and rewrite the transition animation configuration object creation method of the parent, and do not need to realize animation agents provided by a UI navigation controller in the child view controller needing transition animations, so that transition animations can be decoupled from services, the efficiency of realizing transition animations is improved, and the time cost for realizing transition animations is reduced.
It should be noted that the execution subjects of the steps of the methods provided in the above embodiments may be the same device, or different devices may be used as the execution subjects of the methods. For example, the execution subjects of steps 301 to 305 may be device a; for another example, the execution subject of steps 301 and 302 may be device a, and the execution subject of steps 303 to 305 may be device B; and so on.
Fig. 5 is a schematic structural diagram of a transition animation implementation apparatus according to another embodiment of the present application. As shown in fig. 5, the apparatus includes: a push module 51, a judgment module 52, a creation module 53, a setting module 54 and a generation module 55.
And the stack pushing module 51 is configured to, when receiving an instruction to switch from a first page to a second page, push a view controller corresponding to the second page to the top of the stack of the UI navigation controller.
And the judging module 52 is configured to judge whether the view controller corresponding to the second page pushed to the top of the stack by the pushing module 51 overwrites the transition animation configuration object creation method created in the parent view controller in advance.
And a creating module 53, configured to create a transition animation execution object by using the transition animation configuration attribute defined in the rewritten transition animation configuration object creating method when the determination result of the determining module 52 is yes.
A setting module 54 for setting the transition animation execution object created by the creation module 53 as a proxy object of the UI navigation controller.
And the generating module 55 is configured to, when it is determined that the current page is the first page, trigger the proxy object set by the setting module 54 to generate a transition animation in a process of switching from the first page to the second page according to the transition animation configuration attribute.
In an alternative embodiment, the transition animation configuration attributes include: the execution duration of the whole animation, the animation element set corresponding to the whole animation and the animation attribute of each animation element in the animation element set. Based on this, the generating module 55 is specifically configured to: and sequentially moving each animation element according to the animation attribute of each animation element in the execution duration of the whole scene of animation to generate the transition animation in the process of switching from the first page to the second page.
Further, the generating module 55 is specifically configured to: creating a timer according to the execution duration of the whole animation; periodically detecting whether animation elements in the animation element set need to execute animation according to the timing period of the timer; when detecting that animation elements need to execute the animation, acting the animation elements needing to execute the animation according to the animation attributes of the animation elements needing to execute the animation; and releasing the memory after all animation elements in the animation element set execute the animation.
Further, if an animation element is defined in the animation attribute of the animation element that needs to be executed, the generation module 55 may directly act on the animation element. If the animation element is not defined in the animation attribute of the animation element requiring animation execution but a screen capture range is defined, the generating module 55 is further configured to capture a corresponding image from the second page according to the screen capture range in the animation attribute of the animation element requiring animation execution, as the animation element requiring animation execution.
In an alternative embodiment, as shown in fig. 6, the apparatus further comprises: and the adding module 61 is used for adding a transition animation configuration object creating method in the parent view controller in advance and defining a method for returning the transition animation configuration object creating method. The method comprises the steps of defining a configuration class of the transition animation in a transition animation configuration object creating method, wherein the configuration class of the transition animation comprises a plurality of animation items, and each animation item is used for defining the configuration attribute of one transition animation.
In an alternative embodiment, as shown in fig. 6, the apparatus further comprises: and the binding module 62 is configured to bind the transition animation execution object to the view controller corresponding to the second page by using the associated object in the runtime technology before the generation module 55 triggers the proxy object to generate the transition animation in the process of switching from the first page to the second page according to the transition animation configuration property. Therefore, the life cycle of the transition animation execution object does not need to be concerned independently, the transition animation execution object can be released in sequence when the view controller corresponding to the second page releases the memory, the problem that the transition animation execution object occupies the memory all the time can be avoided, and the utilization rate of the memory is improved.
In an alternative embodiment, as shown in fig. 6, the apparatus further comprises: a pop module 63 and a fetch module 64.
And the pop module 63 is configured to pop the view controller corresponding to the second page out of the stack top of the UI navigation controller when receiving an instruction to switch from the second page to the first page. And an obtaining module 64, configured to obtain the transition animation execution object bound by the view controller corresponding to the second page. Accordingly, the setup module 54 is further configured to: and setting the transition animation execution object as a proxy object of the UI navigation controller. The generating module 55 is further configured to: and when the current page is determined to be the second page, triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the configuration attribute of the transition animation.
Further, as shown in fig. 6, the apparatus further includes: a modification module 65.
A modification module 65 for modifying the transition animation configuration properties before the setting module 54 sets the transition animation execution object as the proxy object for the UI navigation controller. Accordingly, the generating module 55 is specifically configured to: and the triggering proxy object generates the transition animation in the process of switching from the second page to the first page according to the modified configuration attribute of the transition animation. Therefore, different transition animations can be realized when the first page and the second page are switched with each other, and the animation effect when the pages are changed is further enriched.
The transition animation implementation device provided in this embodiment may be used to execute the flow of the special scene animation implementation method provided in the above method embodiment, and the working principle thereof is not described again.
By adopting the transition animation realization device provided by the embodiment, developers can customize complex and colorful transition animations, and only a transition animation configuration object creation method needs to be created in the parent view controller in advance, for the child view controller needing to realize the transition animation, only the transition animation configuration object creation method of the parent needs to be directly inherited and rewritten, and the animation agent provided by the UI navigation controller does not need to be realized in the child view controller needing to realize the transition animation, so that the transition animation can be decoupled from the service, the efficiency of realizing the transition animation is improved, and the time cost for realizing the transition animation is reduced.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention 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, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. 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.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application 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, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
The embodiment of the application discloses A1, a transition animation implementation method, including:
when an instruction for switching from a first page to a second page is received, pressing a view controller corresponding to the second page into the stack top of a UI navigation controller;
judging whether a view controller corresponding to the second page rewrites a transition animation configuration object creation method created in a parent view controller in advance;
if so, creating a transition animation execution object by using the configuration attribute of the transition animation defined in the rewritten transition animation configuration object creation method;
setting the transition animation execution object as a proxy object of the UI navigation controller;
and when the current page is determined to be the first page, triggering the proxy object to generate a transition animation in the process of switching from the first page to the second page according to the configuration attribute of the transition animation.
A2, the method as in A1, wherein the transition animation configuration attributes comprise: the execution duration of the whole animation, an animation element set corresponding to the whole animation and the animation attribute of each animation element in the animation element set;
triggering the proxy object to generate the transition animation in the process of switching from the first page to the second page according to the configuration attribute of the transition animation, wherein the process comprises the following steps:
and sequentially moving each animation element according to the animation attribute of each animation element in the execution duration of the whole scene of animation to generate the transition animation in the process of switching from the first page to the second page.
A3, the method according to A2, wherein the step of sequentially acting each animation element according to the animation attribute of each animation element within the execution duration of the whole scene of the animation to generate the transition scene during the switching from the first page to the second page comprises the following steps:
creating a timer according to the execution duration of the whole animation;
periodically detecting whether animation elements in the animation element set need to execute animation according to the timing period of the timer;
when detecting that animation elements need to execute the animation, acting the animation elements needing to execute the animation according to the animation attributes of the animation elements needing to execute the animation;
and releasing the memory after all animation elements in the animation element set execute the animation.
A4, the method as in A3, wherein before the animation element requiring animation is acted according to the animation property of the animation element requiring animation, the method further comprises:
and intercepting a corresponding image from the second page according to the screen capture range in the animation attribute of the animation element which needs to execute the animation, wherein the corresponding image is taken as the animation element which needs to execute the animation.
A5, the method of a1, further comprising:
adding the transition animation configuration object creating method in the parent view controller in advance, and defining a method for returning the transition animation configuration object creating method;
and defining a configuration class of the transition animation in the transition animation configuration object creation method, wherein the configuration class of the transition animation comprises a plurality of animation items, and each animation item is used for defining the configuration attribute of one transition animation.
A6, the method of any one of A1-A5, wherein before determining that the current page is the first page, the method further comprises:
and binding the transition animation execution object to a view controller corresponding to the second page by using an associated object in a runtime technology.
A7, the method of a6, further comprising:
when an instruction for switching from the second page to the first page is received, popping up a view controller corresponding to the second page at the stack top of the UI navigation controller;
acquiring the transition animation execution object bound by the view controller corresponding to the second page;
setting the transition animation execution object as a proxy object of the UI navigation controller;
and when the current page is determined to be the second page, triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the configuration attribute of the transition animation.
A8, in the method of A7, before setting the transition animation execution object as a proxy object for the UI navigation controller, the method further comprising:
modifying the transition animation configuration attribute;
triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the configuration attribute of the transition animation, wherein the process comprises the following steps:
and triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the modified transition animation configuration attribute.
The embodiment of the application discloses B9, a transition animation realizing device includes:
the stack pushing module is used for pushing the view controller corresponding to the second page into the stack top of the UI navigation controller when receiving an instruction for switching from the first page to the second page;
the judging module is used for judging whether the view controller corresponding to the second page rewrites a transition animation configuration object creation method which is created in the parent view controller in advance;
the creation module is used for creating a transition animation execution object by utilizing the transition animation configuration attribute defined in the rewritten transition animation configuration object creation method when the judgment result of the judgment module is yes;
the setting module is used for setting the transition animation execution object as a proxy object of the UI navigation controller;
and the generation module is used for triggering the proxy object to generate the transition animation in the process of switching from the first page to the second page according to the configuration attribute of the transition animation when the current page is determined to be the first page.
B10, the apparatus as in B9, the transition animation configuration attributes comprising: the execution duration of the whole animation, an animation element set corresponding to the whole animation and the animation attribute of each animation element in the animation element set;
the generation module is specifically configured to: and sequentially moving each animation element according to the animation attribute of each animation element in the execution duration of the whole scene of animation to generate the transition animation in the process of switching from the first page to the second page.
B11, the apparatus of B10, wherein the generating module is specifically configured to:
creating a timer according to the execution duration of the whole animation;
periodically detecting whether animation elements in the animation element set need to execute animation according to the timing period of the timer;
when detecting that animation elements need to execute the animation, acting the animation elements needing to execute the animation according to the animation attributes of the animation elements needing to execute the animation;
and releasing the memory after all animation elements in the animation element set execute the animation.
B12, the apparatus as described in B11, the generating module further configured to:
and intercepting a corresponding image from the second page according to the screen capture range in the animation attribute of the animation element which needs to execute the animation, wherein the corresponding image is taken as the animation element which needs to execute the animation.
B13, the apparatus of B9, further comprising:
the adding module is used for adding the transition animation configuration object creating method in the parent view controller in advance and defining a method for returning the transition animation configuration object creating method;
and defining a configuration class of the transition animation in the transition animation configuration object creation method, wherein the configuration class of the transition animation comprises a plurality of animation items, and each animation item is used for defining the configuration attribute of one transition animation.
The device of any one of B14, B9-B13, further comprising:
and the binding module is used for binding the transition animation execution object to the view controller corresponding to the second page by using the associated object in the runtime technology.
B15, the apparatus of B14, further comprising:
the pop module is used for popping a view controller corresponding to the second page out of the stack top of the UI navigation controller when an instruction for switching from the second page to the first page is received;
the obtaining module is used for obtaining the transition animation execution object bound by the view controller corresponding to the second page;
the setup module is further configured to: setting the transition animation execution object as a proxy object of the UI navigation controller;
the generation module is further to: and when the current page is determined to be the second page, triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the configuration attribute of the transition animation.
B16, the apparatus of B15, further comprising:
the modification module is used for modifying the configuration attribute of the transition animation before the setting module sets the transition animation execution object as the proxy object of the UI navigation controller;
the generation module is specifically configured to: and triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the modified transition animation configuration attribute.
The embodiment of the application further discloses C17, an electronic device, including: one or more memories and one or more processors; the one or more memories are for storing one or more computer instructions which, when executed by the one or more processors, are capable of performing the steps of the method of any one of A1-A8.
The embodiment of the application also discloses D18 and a computer readable storage medium storing a computer program, wherein the computer program can realize the steps in the method of any one of A1-A8 when being executed by a computer.

Claims (16)

1. A transition animation implementation method is characterized by comprising the following steps:
when an instruction for switching from a first page to a second page is received, pressing a view controller corresponding to the second page into the stack top of a UI navigation controller;
judging whether a view controller corresponding to the second page rewrites a transition animation configuration object creation method created in a parent view controller in advance; wherein, the transition animation configuration object creation method adopts two data structures of animation configuration and animation item; whether an animation configuration object returns after the view controller corresponding to the second page is executed can be judged based on the two data structures; if an animation configuration object returns after the controller corresponding to the second page is executed, determining that the view controller corresponding to the second page rewrites the transition animation configuration object creation method created in the parent view controller in advance;
if so, creating a transition animation execution object by using the configuration attribute of the transition animation defined in the rewritten transition animation configuration object creation method;
setting the transition animation execution object as a proxy object of the UI navigation controller;
when the current page is determined to be the first page, triggering the proxy object to generate a transition animation in the process of switching from the first page to the second page according to the configuration attribute of the transition animation;
before determining that the current page is the first page, the transition animation implementation method further includes:
and binding the transition animation execution object to a view controller corresponding to the second page by using an associated object in a runtime technology.
2. The transition animation implementation method of claim 1, wherein the transition animation configuration attributes comprise: the execution duration of the whole animation, an animation element set corresponding to the whole animation and the animation attribute of each animation element in the animation element set;
triggering the proxy object to generate the transition animation in the process of switching from the first page to the second page according to the configuration attribute of the transition animation, wherein the process comprises the following steps:
and sequentially moving each animation element according to the animation attribute of each animation element in the execution duration of the whole scene of animation to generate the transition animation in the process of switching from the first page to the second page.
3. The method for implementing transition animation according to claim 2, wherein, within the execution duration of the whole transition animation, sequentially acting each animation element according to the animation attribute of each animation element to generate the transition animation in the process of switching from the first page to the second page comprises:
creating a timer according to the execution duration of the whole animation;
periodically detecting whether animation elements in the animation element set need to execute animation according to the timing period of the timer;
when detecting that animation elements need to execute the animation, acting the animation elements needing to execute the animation according to the animation attributes of the animation elements needing to execute the animation;
and releasing the memory after all animation elements in the animation element set execute the animation.
4. The transition animation realization method of claim 3, wherein, according to the animation property of the animation element of the animation to be executed, before the animation element of the animation to be executed is acted, the transition animation realization method further comprises:
and intercepting a corresponding image from the second page according to the screen capture range in the animation attribute of the animation element which needs to execute the animation, wherein the corresponding image is taken as the animation element which needs to execute the animation.
5. The transition animation implementation method of claim 1, further comprising:
adding the transition animation configuration object creating method in the parent view controller in advance, and defining a method for returning the transition animation configuration object creating method;
and defining a configuration class of the transition animation in the transition animation configuration object creation method, wherein the configuration class of the transition animation comprises a plurality of animation items, and each animation item is used for defining the configuration attribute of one transition animation.
6. The transition animation implementation method of claim 1, further comprising:
when an instruction for switching from the second page to the first page is received, popping up a view controller corresponding to the second page at the stack top of the UI navigation controller;
acquiring the transition animation execution object bound by the view controller corresponding to the second page;
setting the transition animation execution object as a proxy object of the UI navigation controller;
and when the current page is determined to be the second page, triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the configuration attribute of the transition animation.
7. The transition animation implementation method of claim 6, wherein prior to setting the transition animation execution object as a proxy object for the UI navigation controller, the transition animation implementation method further comprises:
modifying the transition animation configuration attribute;
triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the configuration attribute of the transition animation, wherein the process comprises the following steps:
and triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the modified transition animation configuration attribute.
8. A transition animation realization device, comprising:
the stack pushing module is used for pushing the view controller corresponding to the second page into the stack top of the UI navigation controller when receiving an instruction for switching from the first page to the second page;
the judging module is used for judging whether the view controller corresponding to the second page rewrites a transition animation configuration object creation method which is created in the parent view controller in advance; the method for creating the transition animation configuration object adopts two data structures of animation configuration and animation; whether an animation configuration object returns after the view controller corresponding to the second page is executed can be judged based on the two data structures; if an animation configuration object returns after the controller corresponding to the second page is executed, determining that the view controller corresponding to the second page rewrites the transition animation configuration object creation method created in the parent view controller in advance;
the creation module is used for creating a transition animation execution object by utilizing the configuration attribute of the transition animation defined in the rewritten transition animation configuration object creation method when the judgment result of the judgment module is yes;
the setting module is used for setting the transition animation execution object as a proxy object of the UI navigation controller;
the generation module is used for triggering the proxy object to generate the transition animation in the process of switching from the first page to the second page according to the configuration attribute of the transition animation when the current page is determined to be the first page;
before generating the module, the apparatus further comprises: and the binding module is used for binding the transition animation execution object to the view controller corresponding to the second page by using the associated object in the runtime technology.
9. The apparatus of claim 8, wherein the transition animation configuration properties comprise: the execution duration of the whole animation, an animation element set corresponding to the whole animation and the animation attribute of each animation element in the animation element set;
the generation module is specifically configured to: and sequentially moving each animation element according to the animation attribute of each animation element in the execution duration of the whole scene of animation to generate the transition animation in the process of switching from the first page to the second page.
10. The apparatus of claim 9, wherein the generation module is specifically configured to:
creating a timer according to the execution duration of the whole animation;
periodically detecting whether animation elements in the animation element set need to execute animation according to the timing period of the timer;
when detecting that animation elements need to execute the animation, acting the animation elements needing to execute the animation according to the animation attributes of the animation elements needing to execute the animation;
and releasing the memory after all animation elements in the animation element set execute the animation.
11. The apparatus of claim 10, wherein the generating module is further configured to:
and intercepting a corresponding image from the second page according to the screen capture range in the animation attribute of the animation element which needs to execute the animation, wherein the corresponding image is taken as the animation element which needs to execute the animation.
12. The apparatus of claim 11, further comprising:
the adding module is used for adding the transition animation configuration object creating method in the parent view controller in advance and defining a method for returning the transition animation configuration object creating method;
and defining a configuration class of the transition animation in the transition animation configuration object creation method, wherein the configuration class of the transition animation comprises a plurality of animation items, and each animation item is used for defining the configuration attribute of one transition animation.
13. The apparatus of claim 8, further comprising:
the pop module is used for popping a view controller corresponding to the second page out of the stack top of the UI navigation controller when an instruction for switching from the second page to the first page is received;
the obtaining module is used for obtaining the transition animation execution object bound by the view controller corresponding to the second page;
the setup module is further configured to: setting the transition animation execution object as a proxy object of the UI navigation controller;
the generation module is further to: and when the current page is determined to be the second page, triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the configuration attribute of the transition animation.
14. The apparatus of claim 13, further comprising:
the modification module is used for modifying the configuration attribute of the transition animation before the setting module sets the transition animation execution object as the proxy object of the UI navigation controller;
the generation module is specifically configured to: and triggering the proxy object to generate the transition animation in the process of switching from the second page to the first page according to the modified transition animation configuration attribute.
15. An electronic device, comprising: one or more memories and one or more processors; the one or more memories are configured to store one or more computer instructions that, when executed by the one or more processors, are capable of performing the steps of the transition animation implementation method of any of claims 1-7.
16. A computer-readable storage medium storing a computer program, wherein the computer program is capable of implementing the steps of the transition animation implementation method according to any one of claims 1 to 7 when executed by a computer.
CN201710479103.4A 2017-06-22 2017-06-22 Transition animation realization method and device Active CN107463367B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710479103.4A CN107463367B (en) 2017-06-22 2017-06-22 Transition animation realization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710479103.4A CN107463367B (en) 2017-06-22 2017-06-22 Transition animation realization method and device

Publications (2)

Publication Number Publication Date
CN107463367A CN107463367A (en) 2017-12-12
CN107463367B true CN107463367B (en) 2021-05-18

Family

ID=60546520

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710479103.4A Active CN107463367B (en) 2017-06-22 2017-06-22 Transition animation realization method and device

Country Status (1)

Country Link
CN (1) CN107463367B (en)

Families Citing this family (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108491230A (en) * 2018-01-24 2018-09-04 阿里巴巴集团控股有限公司 Cartoon display method and device, client
CN108074273A (en) * 2018-01-31 2018-05-25 成都睿码科技有限责任公司 A kind of animation interactive mode for promoting user experience
CN108984245B (en) * 2018-06-20 2021-08-31 武汉斑马快跑科技有限公司 Page switching method and system based on single-view controller
CN108920247B (en) * 2018-07-20 2022-04-29 腾讯科技(深圳)有限公司 Page switching processing method, device and terminal, storage medium and program product
CN109086105B (en) * 2018-08-14 2022-12-06 北京奇艺世纪科技有限公司 Page layout conversion method and device and electronic equipment
CN110941464B (en) * 2018-09-21 2024-04-16 阿里巴巴集团控股有限公司 Light exposure method, device, system and storage medium
CN110968373A (en) * 2018-09-29 2020-04-07 北京国双科技有限公司 Page switching implementation method and device, storage medium and processor
CN109739591B (en) * 2018-11-09 2022-09-20 深圳壹账通智能科技有限公司 Transition animation making method, device and equipment
CN111324400A (en) * 2018-12-17 2020-06-23 中兴通讯股份有限公司 Display method, device, terminal and storage medium
CN111459581B (en) * 2019-01-22 2024-04-16 阿里巴巴集团控股有限公司 Page switching method, device, electronic equipment and computer readable medium
CN111694624B (en) * 2019-03-13 2021-12-10 北京字节跳动网络技术有限公司 Rollback display processing method, apparatus, device and medium
CN110162343B (en) * 2019-04-10 2023-04-07 北京梧桐车联科技有限责任公司 Application starting method and device, electronic equipment and storage medium
CN110148214B (en) * 2019-05-21 2022-12-13 腾讯云计算(北京)有限责任公司 Multi-scene data visualization method and device
CN110209452B (en) * 2019-05-29 2022-10-14 维沃移动通信有限公司 Page display method of mobile terminal and mobile terminal
CN110276031A (en) * 2019-06-24 2019-09-24 北京向上一心科技有限公司 Animated show method, system, equipment and the computer readable storage medium of page assembly
CN111127601A (en) * 2019-12-25 2020-05-08 北京金山猎豹科技有限公司 Animation switching method and device, electronic equipment and storage medium
CN111443977A (en) * 2020-04-14 2020-07-24 重庆赋比兴科技有限公司 Self-defined transition method based on iOS
CN111901370A (en) * 2020-05-29 2020-11-06 大数金科网络技术有限公司 Method for customizing iOS navigation bar style based on protocol
CN112286410B (en) * 2020-09-25 2022-09-09 长沙市到家悠享网络科技有限公司 Data processing method and device, electronic equipment and computer readable medium
CN112989249A (en) * 2021-02-19 2021-06-18 北京皮尔布莱尼软件有限公司 Page display method, computing device and storage medium
CN114416234B (en) * 2021-12-28 2023-09-12 网易(杭州)网络有限公司 Page switching method and device, computer equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007087444A2 (en) * 2006-01-25 2007-08-02 Pixar Methods and apparatus for accelerated animation using point multiplication and soft caching
CN101236558A (en) * 2008-02-29 2008-08-06 腾讯科技(深圳)有限公司 Method and device for simulating IM client end interface based on web page
CN102736912A (en) * 2010-12-13 2012-10-17 微软公司 Coordination of animations across multiple applications or processes
EP2538325A1 (en) * 2007-01-07 2012-12-26 Apple Inc. Animations
CN104423785A (en) * 2013-09-05 2015-03-18 腾讯科技(深圳)有限公司 View switching method and terminal
CN104463932A (en) * 2013-09-22 2015-03-25 北大方正集团有限公司 Animation effect achieving method and device
CN105893095A (en) * 2016-04-13 2016-08-24 海尔优家智能科技(北京)有限公司 Webpage loading method and device
CN106156066A (en) * 2015-03-30 2016-11-23 阿里巴巴集团控股有限公司 A kind of page switching method, device and client

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007072113A1 (en) * 2005-12-21 2007-06-28 Interagens S.R.L. Method for controlling animations in real time
WO2007130691A2 (en) * 2006-05-07 2007-11-15 Sony Computer Entertainment Inc. Method for providing affective characteristics to computer generated avatar during gameplay
US7872652B2 (en) * 2007-01-07 2011-01-18 Apple Inc. Application programming interfaces for synchronization
KR101669967B1 (en) * 2010-08-23 2016-10-27 엘지전자 주식회사 Mobile terminal and method for controlling the same
US8418134B2 (en) * 2010-09-30 2013-04-09 Oracle International Corporation Method for efficiently managing property types and constraints in a prototype based dynamic programming language
CN104216773B (en) * 2013-06-05 2018-10-16 腾讯科技(深圳)有限公司 View switching method and apparatus
CN104933142B (en) * 2015-06-18 2018-05-04 北京奇虎科技有限公司 Animated show method and apparatus
CN106843953B (en) * 2017-01-16 2019-12-17 百融(北京)金融信息服务股份有限公司 iOS system based application program transverse switching system and method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007087444A2 (en) * 2006-01-25 2007-08-02 Pixar Methods and apparatus for accelerated animation using point multiplication and soft caching
EP2538325A1 (en) * 2007-01-07 2012-12-26 Apple Inc. Animations
CN101236558A (en) * 2008-02-29 2008-08-06 腾讯科技(深圳)有限公司 Method and device for simulating IM client end interface based on web page
CN102736912A (en) * 2010-12-13 2012-10-17 微软公司 Coordination of animations across multiple applications or processes
CN104423785A (en) * 2013-09-05 2015-03-18 腾讯科技(深圳)有限公司 View switching method and terminal
CN104463932A (en) * 2013-09-22 2015-03-25 北大方正集团有限公司 Animation effect achieving method and device
CN106156066A (en) * 2015-03-30 2016-11-23 阿里巴巴集团控股有限公司 A kind of page switching method, device and client
CN105893095A (en) * 2016-04-13 2016-08-24 海尔优家智能科技(北京)有限公司 Webpage loading method and device

Also Published As

Publication number Publication date
CN107463367A (en) 2017-12-12

Similar Documents

Publication Publication Date Title
CN107463367B (en) Transition animation realization method and device
JP6560741B2 (en) Method and apparatus for managing background applications
WO2018127063A1 (en) Application data processing method and apparatus, and storage medium
CN110941500B (en) Interface display method and device
Sheikh et al. Smartphone: Android Vs IOS
CN107656759B (en) Rendering method and device for user interface
CN110580153B (en) Application program development method and device
CN111835864B (en) Method and system for starting application
CN109947643B (en) A/B test-based experimental scheme configuration method, device and equipment
CN110496395B (en) Component operation method, system and equipment for illusion engine
CN101957756A (en) System and method for rapidly generating intelligent mobile terminal program
Francese et al. Supporting the development of multi-platform mobile applications
US20230336680A1 (en) Simulated photographing special effect generation method and apparatus, device, and medium
JP2019509567A (en) Resource loading method, service function implementing method and apparatus for application (APP)
CN112306486B (en) Interface generation method and device, server and storage medium
CN103677979A (en) Interactive method and device for application software and plugin
CN109240678A (en) code generating method and device
CN112235132A (en) Method, device, medium and server for dynamically configuring service
CN104142824A (en) Code generator based on class library and realization method of code generator
CN110721474A (en) Method and device for editing game skills
CN110968373A (en) Page switching implementation method and device, storage medium and processor
CN111124386B (en) Animation event processing method, device, equipment and storage medium based on Unity
CN112099782B (en) Game development method, device, equipment and storage medium
CN110837367B (en) User interface processing method and device and electronic equipment
CN111708519B (en) Service component processing method, device, equipment and storage medium

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
CB02 Change of applicant information

Address after: 100096 building N3, Jinyu Zhizao workshop, 27 Jiancai Chengzhong Road, Haidian District, Beijing

Applicant after: Beijing Xingxuan Technology Co.,Ltd.

Address before: Room 202, 2 floors, 1-3 floors, No. 11 Shangdi Information Road, Haidian District, Beijing 100085

Applicant before: Beijing Xiaodu Information Technology Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant