# Babylon~cinematics

**URL:** <https://forum.babylonjs.com/t/babylon-cinematics/5343>\
**Category:** Demos and projects\
**Created:** [August 28, 2019, 3:44pm UTC](https://forum.babylonjs.com/t/babylon-cinematics/5343 "2019-08-28T15:44:24Z")\
**Posts on this page:** 1\
**Showing post:** 82

<div class="post-metadata">

**Author:** ![aFalcon](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/afalcon/32/7015_2.png) [@aFalcon](https://forum.babylonjs.com/u/aFalcon)\
**Post date:** [December 18, 2019, 4:29am UTC](https://forum.babylonjs.com/t/babylon-cinematics/5343/82 "2019-12-18T04:29:12Z")

</div>

IMPORTANT

> Found a great animation syntax.

> Had to dig for it. Very obscure. Hidden. Not explained on web.

It was necessary to “instrument” a web cinematic.

It uses “Inbetweening” syntax underneath, (CPU ok) and works (better than) ok.

Proof shortly.

> EXAMPLE: interpolates 4 things simultaneously: x, y, z, with 1 rotation.

anm.({FROM},{TO});

x: 0 - 1  
y: 10 - 0  
z: 100 - 1  
anything: 3.14 - 0

```auto
 anm({x:0,y:10,z:100, anything: 3.14})
 .anim8({x:1,y:0,z:1,anything:0},
 {bunch:false,dur:8000,ease:'swing',
 idx: function(now) {
    hero.position.x = this.x; //<-- this.x is the interpolation num assigned to BABYLON.position.x
    hero.position.y = this.y;
    hero.position.z = this.z;
    hero.rotation.x = this.anything; //<-- interpolate multiple things simultaneously with PRECISION-.
 },done:function(){ //important, simple syntax.
}});

```

> ALL IN ONE-LINE OF CODE!

Being COMPACT is key - to scale up.

* * *

It is called ANM~PATTERN-.

REQUIREMENT: anms defined ALL IN ONE LINE OF CODE -so they can move around and be instrumented. Which then results in fine-tuned animations at scale.

This is important to me. I had to have it. And I want to share-back. Happy Holidays!  
NOTE: item for shelf, not dustheap. lol. : )

EXAMPLE: moving a camera and focus simultaneously:

```auto
 $({cx:initCAMPOS.x,cy:initCAMPOS.y,cz:initCAMPOS.z})
 .animate({cx:endCAMPOS.x,cy:endCAMPOS.y,cz:endCAMPOS.z
 },{queue:false,duration:8000*nx.RUNTIME,easing:'swing',
   step: function(now) {
       if(nx.cinemaStop){ $(this).stop(); console.log('stopped'); nx.spaceSeqIdx[1]={on:1}; return;}
          nx.camz.freeCam.position.x = this.cx;
          nx.camz.freeCam.position.y = this.cy;
          nx.camz.freeCam.position.z = this.cz;
          nx.camz.freeCam.setTarget(new BABYLON.Vector3(this.fx,this.fy,this.fz))
      },complete:function(){
       //SEQUENTIAL-ANMS-.
} });

```

Additional features (above): STOP, FFWD, and SLOWMO, as well.

CPU .

> Could it be GPU?, as BABYLON.ANM;

Idk. My code is useless. But the concept is not.

> BABYLON could make it cosmic.

_Animation-Factory_

> BABYLON.anm({from},{to},idx=\>,done:=\>});

- seems cool2me. \<-shrug-\>
- it is unique

(ping) @Deltakosh waddya think? : ]

Does aFalcon have ping-power? : )

> BABYLON Animation Factory 2020.

It’ll happen.

🦅

(NOTE: I try to say clear concepts, good words, few jokes, re-write often. Working on better writing - still. : )

---

_[View the full topic](https://forum.babylonjs.com/t/babylon-cinematics/5343)._
