Platform FM 3D, TFloatAnimation, TPath3D, butterfly

Posted by on in Blogs
Delphi XE5: It's time to turn a catarpillar into a butterfly.

Inspired by sarinadupoint

Source code is available.

Mobile versions are there with desktop ones on the same codebase.


I've done such a functional test with TPath3D when making "live map with business data" (see here, especially if one thinks "butterflies" have nothing to do with "business data visualization").

Take any SVG-editor, load an image and make a "path". This time I used a different SVG-online editor (previously I used another). Now I'm thiking of making my own svg-editor to support some "FM-path-specific" operations. Not really "Delphi-specific", but... like "flip", "scale", "mirrow" and other. For this demo I managed to use some online-available.

 Then I copy from SVG-source only some part for new-made path.

 It's time to go to Delphi project. I'm using standart TSphere and TCylinder for body, tail etc. For a wing I'm taking TPath3D. If you want to animate an object, especially in rotation mode, use TDummy as a parent. The rotation will be simpler. Consider TDummy as an object, representing the "rotation center". Use "Path" property to define the wing contour.

Please, pay attention to a set of MaterialSource properties. We needn't "shaft" as "depth" is 0.001 (how thin is real butterfly wing?). Use Scale.X, Scale.Y, Scale.Z to fit the size of the shape. Set WrapMode property to wmOriginal to avoid distortions.

MaterialSource: use the same link to the same component. In this case you'll get two-sided wing with bitmap applied. No special tricks. Texture should be cut to one wing. In source code images are attached as files.

You may use source of material (TLightMaterialSource to be sensitive to TLight and it's location and/or direction) without Texture, like I do for body, head, tail etc.

 When applying "texture" do use "half a butterfly".

 And now select the parent TDummy for the left wing (duLeftWing), Copy it and Paste. After little rotation (180 degrees around Y-axis for duRightWing) you'll get a symmetrical spacial strcuture. Don't forget to animate Dummies for wings as -30/+30 StartValue/StopValue. Try different "Interpolation" values to fit your aesthetics.


  • Guest
    abc Thursday, 21 November 2013

    А почему исходники никогда не выкладываете? Жалко?

  • Guest
    abc Thursday, 21 November 2013

    извиняюсь, нашел (не шарю в английском, не сразу увидел)

  • Guest
    Vsevolod Leonov Monday, 25 November 2013

    Раньше не выкладывал (как с "комнатой"), т.к. гордиться особо не чем. Да и код нужно "вылизывать".
    Но кто мен пишет в почту - всегда присылаю с поправкой на "сделано на коленках".

  • Guest

    [...] комплектация телефона должна включать и её. Я открыл старый проект (собранный исключительно под iOS, потом портированный [...]

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: