[Lazarus] Improper initialization of manged types

Anthony Walter sysrpl at gmail.com
Tue Jul 9 22:15:07 CEST 2013

If anyone is confused as to what is happening with TVec(n)Prop here are
some examples from my tests.

Camera has TVec3Props called Direction (Heading, Pitch, Roll) and Position
(X, Y Z) which allows a Storyboard to hold a direct reference to those
Camera properties allowing for animation of the view point and view

  ZoomIn := TStoryboard.Create(World);
  ZoomIn.Add(Skybox.Camera.Direction, Vec3(0))
  ZoomIn.Add(Skybox.Camera.Position, Vec3(0))
  ZoomOut := TStoryboard.Create(World);
  ZoomOut.Add(Skybox.Camera.Direction, Vec3(30, 20, 0))
  ZoomOut.Add(Skybox.Camera.Position, Vec3(-8, 8, 4))

... pressing F2 causes the camera to play alternating Storyboards to zoom
the camera in or out in animated fashion ...

  if MessageQueue.KeyDown(VK_F2) then
    if (Skybox.Camera.Direction = Vec3(0)) and (Skybox.Camera.Position =
Vec3(0)) then

... Another example where a button is animated without a Storyboard. Two
vec properties are accessed, Color: TVec4Prop (which has Count 4 and
components, Red, Greem Blue, and Alpha), and Scale: TVec2Prop (which has
Count 2 components, X and Y, buttons are 2d in a 3d world and thus
TVec2Prop is used) ...

      Animations.Add(Button.Color.Alpha, 0.5)
      Animations.Add(Button.Scale, Vec2(1.2))

... The code above causes the button to fade the Alpha color component from
it's current value to 0.5 (half transparency) in 0.2 seconds using the
'Easy' easing, and to scale the button to 1.2 it's original size in 0.2
seconds using the 'Boing' easing.


Older copy of the animation unit on github

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130709/0a9489d9/attachment-0003.html>

More information about the Lazarus mailing list