Menu

Give me in idea to plan some movement in runtime

Help
Hamed
2018-06-29
2018-06-30
  • Hamed

    Hamed - 2018-06-29

    Hi everyone,
    I'm trying to make some TGLSphere in runtime. After that, I assign some points and colors for every Sphere in runtime to create an animation.
    The problem is how to make an animation. the number of spheres is specified at runtime. Give me a clue how to do that. Making movement, path, node or using tweening or sth else?

     
  • Hamed

    Hamed - 2018-06-30

    Hi Jerome. Thanks for your attention.
    Just one question; how to change the color of an object while moving. (somewhere between node1 and node2)

     
  • Jerome.D (BeanzMaster)

    Hi Hamed you can try something like this (from scratch, so perhaps, need some little corrections )

    procedure TForm1.SphereProgress(Sender: TObject; const deltaTime, newTime: Double);
    var
        targetColor: TColorVector;
       CurrentTimeAnimation : Double; 
    begin
      with Sender as TGLCustomSceneObject do
      begin
       CurrentTimeAnimation := (NewTime - aPath.ActivePath.StartTime) / aPath.ActivePath.EstimatedTime ;
        if  (CurrentTimeAnimation>0) and  (CurrentTimeAnimation <= 1.0)  then
          targetColor :=aPath.ActivePath.Nodes.Items[aPath.CurrentNodeIndex+1].Color
          else  targetColor :=aPath.ActivePath.Nodes.Items[aPath.CurrentNodeIndex].Color;
        // Set new color between current and target color
        with Material.FrontProperties.Emission do
          Color := VectorLerp(targetColor, Color, CurrentTimeAnimation)
      end;
    end;
    
     

    Last edit: Jerome.D (BeanzMaster) 2018-06-30

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.