Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: BareGame

  1. #11
    PGDCE Developer Carver413's Avatar
    Join Date
    Jun 2010
    Location
    Spokane,WA,Usa
    Posts
    206
    very nicely done,I look forward to playing around with it.

  2. #12
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25
    Please feel free to embed video or images here on PGD!



    Our site can support Vimeo, YouTube and a few others.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  3. #13
    Okay Will, here is another quick and dirty video. This is the easings demo which shows how a function prototype is used to animate properties of objects. It also highlights how 2D vector graphics can be rendered transformed in 3D space if so desired.

    Code:
    type 
      TEasing = function(Percent: Float): Float;
    
      TEasings = class(TDictionary<string, TEasing>)
      protected
        {doc off}
        function DefaultValue: TEasing; override;
      public
        procedure RegisterDefaults;
        {doc on}
      end;   
    
    
    class function TEasingDefaults.Linear(Percent: Float): Float;
    begin
      Result := Percent;
    end;
    
    class function TEasingDefaults.Easy(Percent: Float): Float;
    begin
      Result := Percent * Percent * (3 - 2 * Percent);
    end;
    
    class function TEasingDefaults.Boing(Percent: Float): Float;
    begin
      Percent := Power(Percent, 1.5);
      Result := Sin(PI * Power(Percent, 2) * 20 - PI / 2) / 4;
      Result := Result * (1 - Percent) + 1;
      if Percent < 0.2 then
        Result := Result * Easy(Percent / 0.2);
    end;


    You can add your own easings by simply writing Easings.Add('MyCustomEasingName', MyCustomEasingFunc). You can animate an property by writing:

    Code:
    Animations.Add(MySprite.Angle, 90)
      .Easing('MyCustomEasingName')
      .Duration(0.75)
      .Looping(loopReverse, loopInfinite)
    Which causes MySprite to spin on it's Z axis from its current angle to 90 in 0.75 seconds using 'MyCustomEasingName' to interpolate the angle over the animation time frame. The animation will loop infinitely reversing itself every 0.75 seconds until the Angle property is issued a different animation or removed by writing Animations.Remove(MySprite.Angle). Animations can be reused by using a Storyboard class.

    Most every world object has animatable properties. Canvas Brush can animate the width, texture coords, colors, gradient stop locations. Camera position, direction, and field of view can be animated. Sprite color, origin, size, position, scale, and rotation can be animated. Even sound bank volume and 3D space position can be animated. ect

  4. #14
    looks impressive, definitely will try it out

  5. #15
    Just reported bunch of spam messages on BG forums. If I'd be mod there, I could do more.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •