Skip to content

demo3d/aframe-lerp-component

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aframe-lerp-component

A linear interpolation component for A-Frame.

Changes the position, rotation, or scale when you call el.setAttribute('position', ...) from the current value to the new value in time duration.

Use directly by calling el.components.lerp.toPosition(from, to)

GIF Example

API

Property Description Default Value
duration Time to move from from to to in milliseconds (ms) 100
properties Array of properties to lerp. Eg. to only lerp position and rotation set to position, rotation position, rotation, scale

Installation

Browser

Install and use by directly including the browser files:

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.4.0/aframe.min.js"></script>
  <script src="https://unpkg.com/aframe-lerp-component/dist/aframe-lerp-component.min.js"></script>
</head>

<body>
  <a-scene>
    <a-entity lerp="duration: 100; properties: position, rotation, scale"></a-entity>
  </a-scene>
</body>

npm

Install via npm:

npm install aframe-lerp-component

Then require and use.

require('aframe');
require('aframe-lerp-component');

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%