Jump to content

Creating a basic animation


Tainder
 Share

Recommended Posts

Hey guys !

 

I'd like to create a basic animation on only 1 axis. I want to move a plane from 1 place wich i already know x , y ,z  to another place wich i also know x , y ,z and never stop this animation.

 

I tried with the tutorail and swap the "scaling.x" by a position.x but this didnt work. Here is the code i discribe :

 

var animationBox = new BABYLON.Animation(
"tutoPigeon",
"position.x",
30,
BABYLON.Animation.ANIMATIONTYPE_FLOAT,
BABYLON.Animation.ANIMATIONLOOPMODE_CYCLE);

// An array with all animation keys
var keys = [];  

   //At the animation key 0, the value of scaling is "1"
    keys.push({
       frame: 0,
       value: 1
   // });

    //At the animation key 20, the value of scaling is "0.2"
    keys.push({
       frame: 20,
       value: 0.2
    });

    //At the animation key 100, the value of scaling is "1"
    keys.push({
       frame: 100,
       value: 1
    });

animationBox.setKeys(keys);

planPigeon.animations.push(animationBox);

 scene.beginAnimation(planPigeon, 0, 100, true);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...