[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
direction:
ZoomIn := TStoryboard.Create(World);
ZoomIn.Add(Skybox.Camera.Direction, Vec3(0))
.Duration(0.5)
.Easing('easy');
ZoomIn.Add(Skybox.Camera.Position, Vec3(0))
.Duration(0.5)
.Easing('easy');
ZoomOut := TStoryboard.Create(World);
ZoomOut.Add(Skybox.Camera.Direction, Vec3(30, 20, 0))
.Duration(0.5)
.Easing('easy');
ZoomOut.Add(Skybox.Camera.Position, Vec3(-8, 8, 4))
.Duration(0.5)
.Easing('easy');
... 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
begin
if (Skybox.Camera.Direction = Vec3(0)) and (Skybox.Camera.Position =
Vec3(0)) then
ZoomOut.Play
else
ZoomIn.Play;
end
... 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)
.Duration(0.2)
.Easing('Easy');
Animations.Add(Button.Scale, Vec2(1.2))
.Duration(0.2)
.Easing('Boing');
... 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.
http://cache.codebot.org/snapshops/easing-modes.jpg
Older copy of the animation unit on github
https://github.com/sysrpl/Bare.Game/blob/master/source/bare.animation.pas
-------------- 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