CN109117137B - Advertisement animation execution method, device, terminal and readable medium - Google Patents

Advertisement animation execution method, device, terminal and readable medium Download PDF

Info

Publication number
CN109117137B
CN109117137B CN201810890206.4A CN201810890206A CN109117137B CN 109117137 B CN109117137 B CN 109117137B CN 201810890206 A CN201810890206 A CN 201810890206A CN 109117137 B CN109117137 B CN 109117137B
Authority
CN
China
Prior art keywords
image view
animation
layout
parent layout
parent
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
CN201810890206.4A
Other languages
Chinese (zh)
Other versions
CN109117137A (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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810890206.4A priority Critical patent/CN109117137B/en
Publication of CN109117137A publication Critical patent/CN109117137A/en
Application granted granted Critical
Publication of CN109117137B publication Critical patent/CN109117137B/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
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0241Advertisements
    • G06Q30/0276Advertisement creation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0241Advertisements
    • G06Q30/0277Online advertisement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/02Marketing; Price estimation or determination; Fundraising
    • G06Q30/0207Discounts or incentives, e.g. coupons or rebates
    • G06Q30/0212Chance discounts or incentives

Abstract

The embodiment of the invention discloses an advertisement animation execution method, an advertisement animation execution device, a terminal and a readable medium, wherein the method comprises the following steps: starting the displacement animation of the first image view according to the received starting instruction; when the first image view is monitored to be completely translated to the parent layout, the second image view is arranged at the top layer of the parent layout, and a pause timer is constructed; before the pause timer is overtime, moving the first image view out of the parent layout; when the pause timer is overtime, starting the displacement animation of the second image view to enable the second image view to be horizontally moved to the outside of the parent layout; the sizes of the first image view and the second image view are the same as the size of the parent layout, and the preset pictures of the first image view and the second image view are the same. The advertisement animation executing method, the device, the terminal and the readable medium provided by the embodiment of the invention realize the animation effect that the advertisement animation rolls from the outside of the father layout to the inside of the father layout and then rolls to the outside of the father layout after staying in the father layout for a period of time.

Description

Advertisement animation execution method, device, terminal and readable medium
Technical Field
The embodiment of the invention relates to computer technology, in particular to an advertisement animation execution method, an advertisement animation execution device, a terminal and a readable medium.
Background
The advertisement animation in the invention refers to an animation process that advertisement characters, advertisement pictures or advertisement graphic symbols and the like are rolled from the outside of a father layout to the inside of the father layout in a translation mode and then are rolled from the inside of the father layout to the outside of the father layout, and the advertisement animation can be applied to scenes for displaying information of winning users in lottery rebate activities. The existing process that the advertisement animation rolls from the outside of the father layout to the inside of the father layout and then rolls from the inside of the father layout to the outside of the father layout is a complete flow, and the animation effect is not separable. Therefore, the conventional advertisement animation cannot realize the animation effect of scrolling from the outside of the parent layout to the inside of the parent layout, staying in the parent layout for a period of time, and then scrolling from the inside of the parent layout to the outside of the parent layout.
Disclosure of Invention
In view of this, embodiments of the present invention provide an advertisement animation executing method, an apparatus, a terminal, and a readable medium, which implement an animation effect that an advertisement animation scrolls from outside a parent layout to inside the parent layout, stays in the parent layout for a period of time, and then scrolls from inside the parent layout to outside the parent layout.
In a first aspect, an embodiment of the present invention provides an advertisement animation executing method, including:
receiving a starting instruction, and starting the displacement animation of the first image view according to the starting instruction;
when the animation monitor of the first image view monitors that the first image view is completely leveled to the parent layout of the first image view, the second image view is arranged at the top layer of the parent layout, and a pause timer is constructed;
moving a first image view from within the parent layout to outside the parent layout before the pause timer times out;
when the pause timer is over, starting the displacement animation of the second image view, wherein the animation effect of the displacement animation of the second image view is that the second image view is translated from the inner side of the father layout to the outer side of the father layout;
the size of the first image view and the size of the second image view are the same as the size of the parent layout, and the preset picture of the first image view is the same as the preset picture of the second image view.
Optionally, before the receiving the start instruction, the method includes:
defining size information of a parent layout of a first image view, and calling a size setting method to set the size of the parent layout to be equal to the size information, wherein the size information is a static global variable;
calling a view object construction method to construct a first image view and a second image view, and setting the size of the first image view and the size of the second image view to be equal to the parent layout size;
and calling a picture setting method to set the preset picture in the first image view and the second image view.
Optionally, before the receiving the start instruction, the method includes:
and calling a displacement animation construction method to construct the displacement animation of the first image view and the displacement animation of the second image view, and respectively setting the displacement path and the animation execution period of the displacement animation of the first image view and the displacement animation of the second image view.
Optionally, before the receiving the start instruction, the method includes: a listener addition method is invoked to add an animation listener to the first image view.
Optionally, the setting the second image view on the top layer of the parent layout includes: and calling an image view setting method to set a second image view on the top layer of the parent layout.
Optionally, the constructing the pause timer includes:
and calling a timer construction method in the sub-thread to construct a pause timer, and setting the timing period of the pause timer.
Optionally, when the pause timer times out, starting a displacement animation of the second image view, including:
when the pause timer is overtime, defining a Handler object in the sub-thread, and calling a message sending function of the Handler object to send an empty message to the main thread;
and when the main thread receives the empty message, starting the displacement animation of the second image view according to the empty message.
In a second aspect, an embodiment of the present invention provides an advertisement animation executing apparatus, including:
the first moving picture starting module is used for receiving a starting instruction and starting the displacement animation of the first image view according to the starting instruction;
a parent layout top layer setting module, configured to set a second image view on a parent layout top layer and construct a pause timer when an animation listener of a first image view monitors that the first image view has been completely leveled to a parent layout of the first image view;
a first moving picture moving-out module, configured to move the first image view from the parent layout to the outside of the parent layout before the timeout of the pause timer;
a second bit moving picture starting module, configured to start a displacement animation of a second image view when a pause timer expires, where an animation effect of the displacement animation of the second image view is that the second image view is translated from within the parent layout to outside the parent layout;
the size of the first image view and the size of the second image view are the same as the size of the parent layout, and the preset picture of the first image view is the same as the preset picture of the second image view.
In a third aspect, an embodiment of the present invention provides a terminal, including:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method for advertisement animation execution as described in any of the embodiments of the invention.
In a fourth aspect, an embodiment of the present invention provides a readable medium, on which a computer program is stored, where the computer program, when executed by a processor, implements an advertisement animation execution method according to any embodiment of the present invention.
According to the advertisement animation execution method, the device, the terminal and the readable medium provided by the embodiment of the invention, when the first image view is completely leveled and moved to the father layout, the second image view consistent with the preset picture of the first image view is arranged on the top layer of the father layout, and the pause timer is constructed, namely when the first image view is completely leveled and moved to the father layout, the covering layer consistent with the preset picture of the first image view is arranged on the father layout, and the covering layer is paused for a period of time, so that the effect that the advertisement animation is visually rolled from the outside of the father layout to the inside of the father layout and stays for a period of time in the father layout is realized; the second image view moves the first image view outside the parent layout during the dwell period of the parent layout, thereby ensuring that the first image view is not visually visible when the second image view scrolls outside the parent layout after the timer expires. Therefore, the effect that the advertisement animation rolls from the outside of the father layout to the inside of the father layout and then rolls to the outside of the father layout after staying in the father layout for a period of time is achieved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief description will be given below of the drawings required for the embodiments or the technical solutions in the prior art, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flowchart of a method for executing an advertisement animation according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of an advertisement animation execution device according to a third embodiment of the present invention;
fig. 3 is a schematic structural diagram of a terminal according to a fourth embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described through embodiments with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. 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 invention.
Example one
Fig. 1 is a flowchart of an advertisement animation execution method according to an embodiment of the present invention, where the embodiment is applicable to a case of executing an advertisement animation, and the method may be implemented by a terminal, and may be specifically implemented by software and/or hardware in the terminal.
Referring to fig. 1, the advertisement animation executing method includes the steps of:
and S110, receiving a starting instruction, and starting the displacement animation of the first image view according to the starting instruction.
The advertisement animation can be executed in a page window of a client APP, and can also be executed in a page window of a webpage edition; the opening instruction may be automatically generated when the page where the advertisement animation is located is opened, may be generated when the cursor slides over the advertisement animation window, and may also be generated when the cursor clicks the advertisement animation window or clicks the button control, and the opening instruction generation method is not limited to the above method.
After the terminal receives the opening instruction, the predefined displacement animation of the first image view can be opened, so that the first image view can move from the set window to the window; a window may be understood as a parent layout of a first image view arranged on a display screen, i.e. a container accommodating a displaced animation of the first image view, wherein the parent layout of the first image view is pre-arranged.
And S120, when the animation monitor of the first image view monitors that the first image view is completely leveled to the parent layout of the first image view, setting the second image view on the top layer of the parent layout, and constructing a pause timer.
The animation listener of the first image view may determine whether the first image view has been completely panned to the parent layout of the first image view by monitoring the execution time or progress of the first image view. For example, when the first image view size is equal to the parent layout size, if the first image view is translated from inside to outside of the parent layout from inside of the parent layout without interruption after being translated from bottom to top, and the execution period is 2000ms, the animation listener of the first image view may determine whether the first image view is completely translated to the parent layout of the first image view by monitoring whether the execution time of the first image view is 1000ms or whether the execution progress is 50%.
When the first image view is completely leveled and moved into the parent layout, the second image view is arranged on the top layer of the parent layout, so that the second image view covers the first image view, and the first image view is replaced by the second image view after being translated into the parent layout; the second image view is paused in the parent layout period, and the first image view animation can move to the outside of the parent layout without stopping; and when the pause time of the second image view meets the preset time, moving the second image view to the outside of the parent layout. The method and the device realize the animation effect that the advertisement animation is translated into the father layout and is translated out of the father layout after the father layout is paused for a period of time.
Optionally, the setting the second image view on the top layer of the parent layout includes: and calling an image view setting method to set the second image view on the top layer of the parent layout.
The image view setting method may specifically be:
parentView.addView(mImageView);
wherein mImageView is the name of the image view and can represent a second image view, wherein the second image view name is not limited to mImageView; wherein the second image view can be set in the parent layout parentView by the addView method. The second image view is arranged on the top layer of the parent layout, so that the second image view covers the first image view, and the first image view is replaced by the second image view after being translated into the parent layout.
Optionally, constructing a pause timer includes:
and calling a timer construction method in the sub-thread to construct a pause timer, and setting the timing period of the pause timer.
Specifically, a timeout Timer may be constructed by using a Timer mTimer ═ new Timer () function; wherein mTimer is a pause timer name, which may represent a pause timer, and the pause timer name is not limited to mTimer; wherein, a Timer type pause Timer can be newly established through the new function. Wherein, the timing period of the pause timer can be specifically set by using a function of mtimer.schedule (task, 1000); wherein, the unit of 1000 is ms, which represents the timing period of the pause timer, and research personnel can change the value of the timing period according to specific requirements; after the pause timer is over, a task may be executed, which may be, for example, a displacement animation task corresponding to the second image view.
By constructing the pause timer, the second image view can be temporarily arranged on the top layer of the parent layout for a period of time, and the displacement animation corresponding to the second image view is started after the pause timer is overtime, so that the effect that the advertisement animation is translated to the outside of the parent layout after being temporarily arranged in the parent layout for a period of time is realized.
And S130, before the pause timer is overtime, moving the first image view from the inside of the parent layout to the outside of the parent layout.
The first image view is moved from the parent layout to the outside of the parent layout, specifically, the first image view may be moved from the parent layout in a manner of continuing the previous displacement animation, or may be returned to the start position by a filbeform ═ true method after the displacement animation is finished when the first image view is completely moved to the parent layout, and the specific manner is not limited.
By moving the first image view outside the parent layout during the time that the second image view is paused in the parent layout, it may be ensured that the first image view is no longer within the visible range of the parent layout when the second image view pause time meets a preset time to move outside the parent layout. Therefore, the replacement of the first image view by the second image view is realized, and the animation effect that the advertisement animation is translated into the parent layout and is translated out of the parent layout after the parent layout is suspended for a period of time is realized.
S140, when the pause timer is overtime, starting the displacement animation of the second image view, wherein the animation effect of the displacement animation of the second image view is that the second image view is translated from the inner layout of the father layout to the outer layout of the father layout;
the size of the first image view and the size of the second image view are the same as the size of the parent layout, and the preset picture of the first image view is the same as the preset picture of the second image view.
When the pause timer is overtime, a task of starting the displacement animation of the second image view can be executed; the task object may be a Runnable type object, which indicates the task object after the timer expires, and the specific definition method of the task object may be:
Figure BDA0001756739610000081
the task is a task name which can represent a task for starting the displacement animation of the second image view, wherein the task name is not limited to the task; and a task object of a Runable type can be newly established through a new method, and the task object is used for starting the displacement animation of the second image view when the timer is overtime. And when the pause time of the second image view meets the preset time, moving the second image view out of the father layout, thereby realizing the animation effect that the advertisement animation is translated into the father layout and is translated out of the father layout after the father layout is paused for a period of time.
Optionally, when the pause timer times out, starting a displacement animation of the second image view, including:
when the pause timer is overtime, defining a Handler object in the sub-thread, and calling a message sending function of the Handler object to send an empty message to the main thread; and when the main thread receives the empty message, starting the displacement animation of the second image view according to the empty message.
Specifically, an object mHandler of the Handler type can be defined by a Handler mHandler ═ new Handler () function; the method for calling the message sending function of the Handler object to send the empty message to the main thread specifically can be a sendmsgtarget function; the main thread receives the null message and then processes the null message, and the processing speed is higher because a message body does not need to be processed; the main thread receives the empty message, that is, receives a message for starting the animation, and performs a displacement animation starting operation of the second image view, specifically, starting the animation by calling mtranslateanimation.
Wherein by setting the second image view equal to the parent layout size, the first image view can be moved outside the parent layout without being perceived by the user during the time that the second image view is paused in the parent layout; and the first image view size is equal to the second image view size, and the preset picture of the first image view is the same as the preset picture of the first image view, so that the first image view and the second image view are completely consistent visually. Therefore, the first image view is replaced by the second image view after being translated into the parent layout; the second image view is paused in the parent layout period, and the first image view animation can move to the outside of the parent layout without stopping; and when the pause time of the second image view meets the preset time, moving the second image view to the outside of the parent layout. The method and the device realize the animation effect that the advertisement animation is translated into the father layout and is translated out of the father layout after the father layout is paused for a period of time.
In the advertisement animation execution method provided by this embodiment, when the first image view is completely leveled and moved to the parent layout, the second image view consistent with the preset picture of the first image view is set on the top layer of the parent layout, and the pause timer is constructed, which is equivalent to that when the first image view is completely leveled and moved to the parent layout, the covering layer consistent with the preset picture of the first image view is set on the parent layout, and the covering layer is paused for a period of time, so that the effect that the advertisement animation is visually scrolled from the outside of the parent layout to the inside of the parent layout and stays for a period of time in the parent layout is achieved; the second image view moves the first image view outside the parent layout during the dwell period of the parent layout, thereby ensuring that the first image view is not visually visible when the second image view scrolls outside the parent layout after the timer expires. Therefore, the effect that the advertisement animation rolls from the outside of the father layout to the inside of the father layout and then rolls to the outside of the father layout after staying in the father layout for a period of time is achieved.
Example two
In this embodiment, on the basis of the first embodiment, the preliminary preparation step before the start instruction is received in the advertisement animation execution method is explained in detail. The same or corresponding terms as those of the above-described embodiments are explained, and the description of the present embodiment is omitted.
Optionally, before receiving the start instruction, the method includes:
defining size information of a father layout of a first image view, calling a size setting method to set the size of the father layout to be equal to the size information, wherein the size information is a static global variable; calling a view object construction method to construct a first image view and a second image view, and setting the size of the first image view and the size of the second image view to be equal to the parent layout size; and calling a picture setting method to set the preset picture in the first image view and the second image view.
The dimension information of the parent layout of the first image view can be stored in a dimension. The size information of the parent layout may include information such as height, width, and margin from the page of the parent layout. The method comprises the steps that after a getResources function of a system is called to obtain dimension resource file dimensions.xml, a getDimension function is called to obtain information such as height, width and margin to a page of a father layout in a dimension resource file, and the information is defined as a static global variable parameter; specifically, the HEIGHT method for defining the parent layout may be static int VIEW _ HEIGHT. Wherein the size of the parent layout can be set equal to the size information by the setlayout params function. The size information is static global variable information, so that the same information can be obtained when any function calls the size information, and updating and maintenance of the size information are facilitated.
The view construction method may specifically be:
ImageView mImageView=new ImageView();
wherein mImageView is the name of an image view, and may represent a first image view or a second image view, wherein the first image view and the second image view are different in name and are not limited to mImageView; an image view of the ImageView type can be newly established by a new method.
The setting of the size of the first image view and the size of the second image view to be equal to the parent layout size may specifically be:
firstly, acquiring a parent layout size through a getLayoutParams function, and storing the parent layout size in a reference group; the first image view and the second image view may then be sized according to the parent layout size within the parameter set by the setLayoutParams function.
The method for obtaining the parent layout size may specifically be:
ViewGroup.LayoutParams params=parentView.getLayoutParams();
wherein params is a parameter group name, representing a parameter group of type layout params, and the parameter group name is not limited to params; the parentView is a parent layout name, represents a parent layout of the first image view and the second image view, and is not limited to the parentView; wherein the parent layout size can be obtained by the getlayout params function.
The setting of the sizes of the first image view and the second image view may specifically be:
mImageView.setLayoutParams(params);
wherein mImageView is the name of an image view, and may represent a first image view or a second image view, wherein the first image view and the second image view are different in name and are not limited to mImageView; wherein the size of the image view can be set by the setLayoutParams method.
The method for setting the picture is called to set the preset picture in the first image view and the second image view, and the specific method can be as follows:
mImageView.setBackground(xxx);
the xxx is a preset picture identifier, and can be an identifier which only points to a picture, such as a picture name or a picture address, and the like, wherein the same preset picture needs to be set in the first image view and the second image view, so as to ensure that the first image view and the second image view are completely identical visually; wherein mImageView is the name of an image view, and may represent a first image view or a second image view, wherein the first image view and the second image view are different in name and are not limited to mImageView; wherein, a preset picture can be added in the image view by the setBackward method.
By setting the second image view equal to the parent layout size, the first image view may be moved outside of the parent layout without being perceived by the user during the time that the second image view is paused in the parent layout; and the first image view size is equal to the second image view size, and the preset picture of the first image view is the same as the preset picture of the first image view, so that the first image view and the second image view are completely consistent visually. Therefore, the first image view is replaced by the second image view after being translated into the parent layout; the second image view is paused in the parent layout period, and the first image view animation can move to the outside of the parent layout without stopping; and when the pause time of the second image view meets the preset time, moving the second image view to the outside of the parent layout. The method and the device realize the animation effect that the advertisement animation is translated into the father layout and is translated out of the father layout after the father layout is paused for a period of time.
Optionally, before receiving the start instruction, the method further includes:
and calling a displacement animation construction method to construct the displacement animation of the first image view and the displacement animation of the second image view, and respectively setting the displacement path and the animation execution period of the displacement animation of the first image view and the displacement animation of the second image view.
Wherein, the displacement animation is an animation object of a Translateanimation class; the displacement animation construction method specifically comprises the following steps:
TranslateAnimation mTranslateAnimation=new TranslateAnimation(0,0,-VIEW_HEIGHT,0);
wherein mTranslateAnimation is the name of displacement animation, and may represent the displacement animation of the first image view or the displacement animation of the second image view, wherein the name of the displacement animation of the first image view is different from the name of the displacement animation of the second image view, and is not limited to mTranslateAnimation; wherein, a TranslateAnimation type displacement animation can be constructed by the new method.
Wherein, (0,0, -VIEW _ HEIGHT,0) represents the displacement path of the picture VIEW origin corresponding to the displacement animation, and the standard format thereof can be expressed as (fromXDelta, toXDelta, frodyelta, toYDelta), wherein fromXDelta represents the X-axis coordinate of the animation start point, toXDelta represents the X-axis coordinate of the animation end point, frodydelta represents the Y-axis coordinate of the animation start point, and ydtoelta represents the Y-axis coordinate of the animation end point. Wherein, XDelta and YDelta can have three expression modes, which are respectively:
the number: e.g., 50.0, in px pixels;
the percentage is as follows: e.g., 50%, percent indicates a percentage relative to the width of the view;
percent + "p": e.g., 50% p, percent + "p" represents the percentage relative to the parent layout of the view.
Wherein, the origin of the picture view is the upper left corner of the picture view; the displacement path is based on a father layout coordinate system, the upper left corner of the father layout is the origin of the coordinate system, the right direction is the positive direction of an X axis, and the downward direction is the positive direction of a Y axis. Thus, (0,0, -VIEW _ HEIGHT,0) can be understood as the image VIEW does not have any change in the X-axis coordinates during the execution cycle of the displacement animation, setting the left side of the Y-axis to-VIEW _ HEIGHT to 0, i.e., the image VIEW is completely moved from the top of the parent layout to the inside of the parent layout, and if the image VIEW is the same size as the parent layout, the image VIEW is completely moved from the top of the parent layout to the inside of the parent layout, and just completely covers the parent layout.
The displacement path of the displacement animation of the first image VIEW may be (0,0, VIEW _ HEIGHT,0), that is, the first image VIEW is translated from the parent layout from bottom to top into the parent layout, and returns to the start position through filbeform ═ true after the animation is finished; or (0,0, VIEW _ HEIGHT, -VIEW _ HEIGHT), that is, after the first animation is translated from the parent layout from bottom to top into the parent layout, the first animation is directly translated from the parent layout to the parent layout from the inside to the top; in addition, the first animation may also be translated from left to right or from top to bottom, which is not limited herein. Wherein, to ensure that the first image view and the second image view are visually the same view, the displacement path of the second image view may correspond to the first image view, e.g. when the first image view enters the parent layout from bottom to top, the second image view may be translated out of the parent layout upwards; when the first image view is brought from top to bottom into the parent layout, the second view may be panned down out of the parent layout, to name but a few.
The method for setting the animation execution period of the displacement animation may specifically be:
mTranslateAnimation.setDuration(1000);
wherein, the unit of 1000 is ms, which represents the execution period from the beginning to the end of the displacement animation, and research personnel can change the execution period value according to specific requirements; wherein, the execution period of the displacement animation mTranslateAnimation can be set through the setDuration function.
By reasonably setting the displacement path and the animation execution period of the displacement animation of the first image view and the displacement animation of the second image view, the visual display method can visually present the animation effect that the first image view and the second image view are perfectly jointed into an advertisement animation and are translated from the outside of a parent layout to the inside of the parent layout, and after the advertisement animation is paused for a period of time, the advertisement animation is moved from the inside of the parent layout to the outside of the parent layout.
Optionally, before receiving the start instruction, the method further includes: a listener addition method is invoked to add an animation listener to the first image view.
Adding an animation monitor to the first image view through a mImageView.addAnimationUpdateListener () function; the monitoring may include three callback functions for monitoring the displacement animation of the first image view, which may be an onantimationstart function, an onantimationsupdate (int update) function, and an onantimationsend function; the onantimmunity start is used for monitoring whether the displacement animation of the first image view is started, the onantimmunity update is used for monitoring the execution progress or execution time of the displacement animation of the first image view, and the onantimoniend function is used for monitoring whether the displacement animation of the first image view is ended.
By the pre-preparation step before the start instruction is received in the advertisement animation execution method, normal execution of the advertisement animation execution method provided by the embodiment can be ensured, so that the advertisement animation is translated into the parent layout, and the advertisement animation is translated to the animation effect outside the parent layout after the parent layout is paused for a period of time.
EXAMPLE III
Fig. 2 is a schematic structural diagram of an advertisement animation executing apparatus according to a third embodiment of the present invention, which is applicable to executing an advertisement animation.
Referring to fig. 2, the advertisement animation executing apparatus in this embodiment includes:
the first moving picture starting module 210 is configured to receive a starting instruction and start a displacement animation of a first image view according to the starting instruction;
a parent layout top-level setting module 220, configured to set the second image view on a parent layout top level and construct a pause timer when the animation listener of the first image view monitors that the first image view has been completely leveled to the parent layout of the first image view;
a first moving picture out module 230, configured to move the first image view from inside the parent layout to outside the parent layout before the timeout of the pause timer;
a second moving picture starting module 240, configured to start the moving animation of the second image view when the pause timer is over, where an animation effect of the moving animation of the second image view is that the second image view is moved from the parent layout to the outside of the parent layout;
the size of the first image view and the size of the second image view are the same as the size of the parent layout, and the preset picture of the first image view is the same as the preset picture of the second image view.
Optionally, the advertisement animation executing apparatus further includes:
the parent layout size defining module is used for defining size information of a parent layout of the first image view, calling a size setting method to set the size of the parent layout to be equal to the size information, wherein the size information is a static global variable;
the image view construction module is used for calling a view object construction method to construct a first image view and a second image view, and setting the size of the first image view and the size of the second image view to be equal to the parent layout size;
and the image view picture setting module is used for calling a picture setting method to set the preset picture in the first image view and the second image view.
Optionally, the advertisement animation executing apparatus further includes:
and the image view animation construction module is used for calling a displacement animation construction method to construct a displacement animation of the first image view and a displacement animation of the second image view, and respectively setting a displacement path and an animation execution cycle of the displacement animation of the first image view and the displacement animation of the second image view.
Optionally, the advertisement animation executing apparatus further includes:
and the animation monitor adding module is used for calling a monitor adding method to add an animation monitor to the first image view.
Optionally, the parent layout top-level setting module 220 is specifically configured to:
and calling an image view setting method to set the second image view on the top layer of the parent layout.
Optionally, the parent layout top-level setting module 220 is further specifically configured to:
and calling a timer construction method in the sub-thread to construct a pause timer, and setting the timing period of the pause timer.
Optionally, the second moving picture opening module 240 is specifically configured to:
when the pause timer is overtime, defining a Handler object in the sub-thread, and calling a message sending function of the Handler object to send an empty message to the main thread; and when the main thread receives the empty message, starting the displacement animation of the second image view according to the empty message.
The advertisement animation executing device provided by the embodiment belongs to the same inventive concept as the advertisement animation executing method provided by the first embodiment, and technical details which are not described in detail in the embodiment can be referred to in the first embodiment.
Example four
The embodiment provides a terminal which can be used for the situation of executing advertisement animation. Fig. 3 is a schematic structural diagram of a terminal according to a fourth embodiment of the present invention.
Referring to fig. 3, the terminal includes:
one or more processors 310;
a memory 320 for storing one or more programs;
when executed by the one or more processors 310, cause the one or more processors 310 to implement an advertisement animation execution method as set forth in an embodiment.
In FIG. 3, a processor 310 is illustrated as an example; the processor 310 and the memory 320 may be connected by a bus or other means, such as the bus connection shown in FIG. 3.
The memory 320 is a computer-readable storage medium for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the advertisement animation execution method in the embodiment of the present invention. The processor 310 executes various functional applications and data processing of the terminal by executing software programs, instructions and modules stored in the memory 320, that is, implements the advertisement animation execution method described above.
The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 320 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 320 may further include memory located remotely from the processor 310, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The terminal and the advertisement animation execution method provided by the first embodiment belong to the same inventive concept, and technical details that are not described in detail in the first embodiment can be referred to in the first embodiment, and the first embodiment have the same beneficial effects.
EXAMPLE five
The present embodiment provides a readable medium on which a computer program is stored, which when executed by a processor implements an advertisement animation execution method as set forth in an embodiment.
The readable medium proposed by the embodiment and the advertisement animation execution method proposed by the first embodiment belong to the same inventive concept, and technical details that are not described in detail in the embodiment can be referred to in the first embodiment, and the first embodiment have the same beneficial effects.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. An advertisement animation execution method, comprising:
receiving a starting instruction, and starting the displacement animation of the first image view according to the starting instruction;
when the animation monitor of the first image view monitors that the first image view is completely leveled to the parent layout of the first image view, the second image view is arranged at the top layer of the parent layout, and a pause timer is constructed;
moving a first image view from within the parent layout to outside the parent layout before the pause timer times out;
when the pause timer is over, starting the displacement animation of the second image view, wherein the animation effect of the displacement animation of the second image view is that the second image view is translated from the inner side of the father layout to the outer side of the father layout;
the size of the first image view and the size of the second image view are the same as the size of the parent layout, and the preset picture of the first image view is the same as the preset picture of the second image view.
2. The method of claim 1, prior to said receiving an open command, comprising:
defining size information of a parent layout of a first image view, and calling a size setting method to set the size of the parent layout to be equal to the size information, wherein the size information is a static global variable;
calling a view object construction method to construct a first image view and a second image view, and setting the size of the first image view and the size of the second image view to be equal to the parent layout size;
and calling a picture setting method to set the preset picture in the first image view and the second image view.
3. The method of claim 1, prior to said receiving an open command, comprising:
and calling a displacement animation construction method to construct the displacement animation of the first image view and the displacement animation of the second image view, and respectively setting the displacement path and the animation execution period of the displacement animation of the first image view and the displacement animation of the second image view.
4. The method of claim 1, prior to said receiving an open command, comprising: a listener addition method is invoked to add an animation listener to the first image view.
5. The method of claim 1, wherein said placing a second image view on top of said parent layout comprises: and calling an image view setting method to set a second image view on the top layer of the parent layout.
6. The method of claim 1, wherein the constructing a pause timer comprises:
and calling a timer construction method in the sub-thread to construct a pause timer, and setting the timing period of the pause timer.
7. The method of claim 6, wherein starting the second image view displacement animation when the pause timer times out comprises:
when the pause timer is overtime, defining a Handler object in the sub-thread, and calling a message sending function of the Handler object to send an empty message to the main thread;
and when the main thread receives the empty message, starting the displacement animation of the second image view according to the empty message.
8. An advertisement animation executing apparatus, comprising:
the first moving picture starting module is used for receiving a starting instruction and starting the displacement animation of the first image view according to the starting instruction;
a parent layout top layer setting module, configured to set a second image view on a parent layout top layer and construct a pause timer when an animation listener of a first image view monitors that the first image view has been completely leveled to a parent layout of the first image view;
a first moving picture moving-out module, configured to move the first image view from the parent layout to the outside of the parent layout before the timeout of the pause timer;
a second bit moving picture starting module, configured to start a displacement animation of a second image view when a pause timer expires, where an animation effect of the displacement animation of the second image view is that the second image view is translated from within the parent layout to outside the parent layout;
the size of the first image view and the size of the second image view are the same as the size of the parent layout, and the preset picture of the first image view is the same as the preset picture of the second image view.
9. A terminal, characterized in that the terminal comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the ad animation execution method of any of claims 1-7.
10. A readable medium on which a computer program is stored, which program, when being executed by a processor, is adapted to carry out the advertising animation execution method according to any one of claims 1 to 7.
CN201810890206.4A 2018-08-07 2018-08-07 Advertisement animation execution method, device, terminal and readable medium Active CN109117137B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810890206.4A CN109117137B (en) 2018-08-07 2018-08-07 Advertisement animation execution method, device, terminal and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810890206.4A CN109117137B (en) 2018-08-07 2018-08-07 Advertisement animation execution method, device, terminal and readable medium

Publications (2)

Publication Number Publication Date
CN109117137A CN109117137A (en) 2019-01-01
CN109117137B true CN109117137B (en) 2021-07-23

Family

ID=64852752

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810890206.4A Active CN109117137B (en) 2018-08-07 2018-08-07 Advertisement animation execution method, device, terminal and readable medium

Country Status (1)

Country Link
CN (1) CN109117137B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111951355A (en) * 2020-08-04 2020-11-17 北京字节跳动网络技术有限公司 Animation processing method and device, computer equipment and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09160746A (en) * 1995-12-11 1997-06-20 Sumitomo Electric Ind Ltd Image display device and method
JP2011113381A (en) * 2009-11-27 2011-06-09 Olympus Corp Image display method and device of the same, method for generating image data for scroll display, and recording medium
TW201305946A (en) * 2011-07-29 2013-02-01 Rakuten Inc Information processing device, information processing method, information processing program product, and recording medium with information processing program recorded therein
CN104216606A (en) * 2013-06-05 2014-12-17 北京齐尔布莱特科技有限公司 WebView page turning special effect method based on Android operation system
JP6061637B2 (en) * 2012-11-16 2017-01-18 株式会社半導体エネルギー研究所 Information processing method and program
CN106792101A (en) * 2017-01-03 2017-05-31 青岛海信电器股份有限公司 Home interface method of adjustment, device and intelligent television
CN107147940A (en) * 2017-05-05 2017-09-08 广州阿里巴巴文学信息技术有限公司 Method, device, electronic equipment and the storage medium of content carousel
CN107391152A (en) * 2017-07-31 2017-11-24 北京酷我科技有限公司 A kind of method for realizing focus chart carousel animation effect on Mac
CN108008950A (en) * 2017-11-24 2018-05-08 武汉斗鱼网络科技有限公司 The implementation method and device of a kind of user interface updating

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6742881B2 (en) * 2016-10-11 2020-08-19 キヤノン株式会社 Information processing apparatus, control method thereof, and program

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09160746A (en) * 1995-12-11 1997-06-20 Sumitomo Electric Ind Ltd Image display device and method
JP2011113381A (en) * 2009-11-27 2011-06-09 Olympus Corp Image display method and device of the same, method for generating image data for scroll display, and recording medium
TW201305946A (en) * 2011-07-29 2013-02-01 Rakuten Inc Information processing device, information processing method, information processing program product, and recording medium with information processing program recorded therein
JP6061637B2 (en) * 2012-11-16 2017-01-18 株式会社半導体エネルギー研究所 Information processing method and program
CN104216606A (en) * 2013-06-05 2014-12-17 北京齐尔布莱特科技有限公司 WebView page turning special effect method based on Android operation system
CN106792101A (en) * 2017-01-03 2017-05-31 青岛海信电器股份有限公司 Home interface method of adjustment, device and intelligent television
CN107147940A (en) * 2017-05-05 2017-09-08 广州阿里巴巴文学信息技术有限公司 Method, device, electronic equipment and the storage medium of content carousel
CN107391152A (en) * 2017-07-31 2017-11-24 北京酷我科技有限公司 A kind of method for realizing focus chart carousel animation effect on Mac
CN108008950A (en) * 2017-11-24 2018-05-08 武汉斗鱼网络科技有限公司 The implementation method and device of a kind of user interface updating

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
如何实现图片向上滚动,而且完全显示时要暂停一下;百度网友cb90622;《https://zhidao.baidu.com/question/136681260.html》;20100206;全文 *

Also Published As

Publication number Publication date
CN109117137A (en) 2019-01-01

Similar Documents

Publication Publication Date Title
CN112269604B (en) Window interaction method and device for compatibly running Android application on Linux
WO2019174469A1 (en) Message notification method, apparatus, device and storage medium
US9285945B2 (en) Method and apparatus for displaying multi-task interface
CN108803964B (en) Buoy display method, device, terminal and storage medium
CN107145355B (en) Page layout adjusting method and device, storage medium, processor and terminal
US11551392B2 (en) Graphic drawing method and apparatus, device, and storage medium
CN106658139B (en) Focus control method and device
CN107608550B (en) Touch operation response method and device
CN104836906A (en) Mobile terminal and method for acquiring images from short message operation interface in real time thereof
CN105045823A (en) Method and device for generating demo file of mobile terminal based on screen capture
CN104869346A (en) Method and electronic equipment for processing image in video call
CN105872832A (en) Video calling method, video calling system and display device
CN109117237B (en) Bullet screen display method and device and electronic equipment
CN108829486B (en) Background setting method, device, equipment and storage medium
CN112612436A (en) Screen projection switching method, device, equipment and storage medium
CN109117137B (en) Advertisement animation execution method, device, terminal and readable medium
CN105446676B (en) Carry out the method and device that large-size screen monitors are shown
CN105096365A (en) 3D interface local refreshing method and system
CN107861711B (en) Page adaptation method and device
CN111913343B (en) Panoramic image display method and device
CN105183288B (en) Single-window multi-task display method and intelligent mobile terminal thereof
CN107632746A (en) A kind of application interface display methods and device
CN112651801B (en) Method and device for displaying house source information
CN111913711B (en) Video rendering method and device
CN109675312B (en) Game item list display method and device

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
GR01 Patent grant
GR01 Patent grant