Introduction to Delphi xe2 firemonkey (13)-animation (bottom)

Source: Internet
Author: User
Tanimation Main member of the class:
Protected function normalizedtime: single; // procedure processanimation; virtual; // its subclasses mainly implement procedure loaded; override; // public procedure start by overwriting this method; virtual; // play procedure stop; virtual; // stop procedure stopatcurrent; virtual; // stop at the current frame; unlike the pause attribute, it will touch the onfinish event procedure starttrigger (...); virtual; // if not overwritten, the attributes of trigger and triggerinverse should be used instead of procedure processtick (...); // The internal animation execution method, mainly used to call the processanimation process. property running: Boolean ...; // whether the job is running; read-only property pause: Boolean ...; // pause published property animationtype: tanimationtype ...; // animation type; it seems to only affect the insert (interpolation) Algorithm Property autoreverse: Boolean ...; // Automatic reverse (start point> end point> Start Point) Property enabled: Boolean ...; // whether property delay is available: single ...; // how many seconds will the animation start property Duration: single ...; // animation length (SEC); its subclass is generally 0.2 property interpolation: tinterpolationtype ...; // specifies the animation insertion type. This option can be used to achieve multiple animation effects (such as bounce). Property inverse: Boolean ...; // reverse animation (end point-> Start Point) Property loop: Boolean ...; // loop playback property trigger: ttrigger ...; // specifies the event that can trigger the animation. The value is a string (see the following table) Property triggerinverse: ttrigger ...; // specifies the event that can trigger reverse animation. The value is a string (see the following table) Property onprocess: tpolicyevent ...; // The property onfinish: tpolicyevent triggered by each animation frame ...; // event end triggered when the stop is stopped; {optional values of the trigger and triggerinverse attributes :} 'ismouseover = true' ismouseover = false''' isfocused = true' isfocused = false''' isvisible = true' isvisible = false''' isdragover = true' isdragover = false' 'isopen = true' 'isopen = false'
Tfloatanimation Used for dimensional animation;
Tcoloranimation Used for color-changing animation;
Tgradientanimation Used for color gradient animation;
Trectanimation Used for border (padding, margins) animation; their extension attributes are the same (but the parameter types are different ):
 
Startvalue // start value stopvalue // end value startfromcurrent // whether the animation propertyname is to be controlled from the current frame; the value is a string (see the table below) {commonly used propertyname values:} 'width'' heigth'' strokethickness ''position. x' position. Y '''scale. x' scale. Y ''rotationcenter. X ''rotationcenter. Y ''rotationangle ''opacity ''' margins. left ''margins. top ''margins. ristm''' margins. bottom ''padding. left ''padding. top ''padding. ristm''' padding. bottom ''fill. color ''stroke. color ''fill. gradient ''stroke. gradient ''margins ''padding'
Tfloatkeyanimation , Tcolorkeyanimation You can use its keys attribute to define multiple key frames (the first few have only two key frames). Its attribute is extended:
 
A set of keys // tkeys. The element type is tkey. The attribute propertyname // startfromcurrent //
Tbitmapanimation It is used for switching between two images. Its extended attributes include:

 
Startvalue // stopvalue of the starting image // propertyname of the ending image // It can only be 'bitmap'
Tbitmaplistanimation You only need an image, divide the image equally according to the expected animation frame count, and then link the split parts into an animation. Its extended attributes include:

 
Animationcount // Number of animation frames animationbitmap // picture propertyname //
Tpathanimation An object can be moved around a specified path. Its Extension attributes include:

Path: tpathdata; // path data; Generally, data is read and written through tpathdata. Data (string) uses the path format standard rotate: Boolean in SVG; // whether to rotate (rotate)
Simple Example of path Animation: first place a trectangle on the HD form, and then add a tpathanimation to it. Test Code :
Const strpath ='m 3.84500002861023, 3.47300004959106 '+ 'C 4.83799982070923, 24.6110000610352 26.2040004730225, 34.9749984741211 42.875, 30.8320007324219' + 'C 69.8730010986328, 24.121000289917 82.1620025634766,-9.76099967956543 74.6009979248047, -37.4169998168945 '+ 'C 63.992000579834,-76.2160034179688 23.7210006713867,-93.3140029907227-9.33600044250488,-80.4909973144531' + 'C-52.2709999084473,-63.8380012512207-70.8339996337891,-8.08600044250488-55.2200012207031, 37.6059989929199 '+ 'C-35.9000015258789, 94.1429977416992 24.3759994506836, 118.28099822998 73.6240005493164, 96.3960037231445' + 'C 132.567993164063, 70.2020034790039 157.505996704102,-7.92000007629395 133.664993286133,-71.5500030517578 '+ 'C 105.81600189209,-145.880996704102 25.3040008544922, -177.113998413086-40.0859985351563,-146.054992675781 '+ 'C-95.6880035400391,-119.646003723145-129.975997924805,-55.0750007629395-127.064002990723, 11.4790000915527'; Procedure tform1.formcreate (Sender: tobject); begin pathanimation1.path. data: = strpath; pathanimation1.duration: = 8; paths: = true; pathanimation1.loop: = true; pathanimation1.rotate: = true; pathanimation1.enabled: = true; end; {if you want to display the path, you also need to use tpath, which is used to present path data .}
In addition, the animation should be able to be superimposed and nested.

Also, in practice, using these classes may be cheaper than using methods in fmxobject directly, for example:

 
Procedure tform1.button1click (Sender: tobject); begin button1.animatefloat ('position. x', button1.position. x * 2, 1.5); end;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.