_r.animate
_r.animate( elements, patch, options )
returns a BABYLON.AnimationGroup
_r.animate("camera1", {
position : { x : 0, y : 0, z : 0 },
rotation : { x : 0, y : 0, z : 0 },
fov : 0.1
}, 2); // in seconds
This animate camera1 position, rotation and fov to targetted values, in 2 seconds.
Arguments
argument | description |
---|---|
elements | selector or object |
patch | properties to animate, with target value, using patch syntax |
options | number (time in seconds) or object (list of options) |
Note that when animating instances meshes, BabylonJS set some properties as read-only (e.g.: visibility), which can throw us an error. This can be avoid by using this selector filter: _r.select("*:mesh[instances.length==0]")
.
Options
_r.animate("mesh1",
{
material :
{
alpha : 0
}
},
{
duration : 2,
easing : "easeInSine",
complete : function() {
console.log("animation complete");
},
loop : true
});
name | description |
---|---|
duration | duration in seconds, default = 0.4 |
easing | string from https://easings.net/, default : none |
complete | function called after animation completed |
loop | true for a cycle animation, default = false |