npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

babylon.simple-animation

v1.1.0

Published

A collection of helpers to simplify the animation handling.

Downloads

9

Readme

BABYLON.SimpleAnimation

A collection of helpers to simplify the animation handling.

setup

npm

npm i babylon.simple-animation

ES module

import 'babylon.simple-animation';
import * as BABYLON from 'babylonjs';

Use the tree shaking system.

import {
  SimpleAnimationDelay,
  SimpleParallelAnimationGroup,
  SimplePropertyAnimation,
  SimpleSequentialAnimationGroup,
} from 'babylon.simple-animation/es6';

browser

<script src="https://unpkg.com/babylonjs"></script>
<script src="https://unpkg.com/babylon.simple-animation"></script>

usage

scene.beginSimpleAnimation(
  (new BABYLON.SimpleParallelAnimationGroup()).add(
    new BABYLON.SimplePropertyAnimation({
      target: scene.getMeshByName('box'),
      property: 'scaling.z',
      to: 1/8,
      duration: 2000,
    }),
    (new BABYLON.SimpleSequentialAnimationGroup()).add(
      ...scene.getMeshesByTags('sphere').map(mesh =>
        (new BABYLON.SimpleSequentialAnimationGroup()).add(
          new BABYLON.SimplePropertyAnimation({
            target: mesh,
            property: 'position',
            to: BABYLON.Vector3.Zero(),
            duration: 1000,
            easing: new BABYLON.CircleEase(),
          }),
          new BABYLON.SimpleAnimationDelay(1000),
          new BABYLON.SimplePropertyAnimation({
            target: mesh,
            property: 'visibility',
            to: 0,
            duration: 1000,
          }),          
        )
      )
    ),
  )
);

classes

SimpleAnimation

abstract

instance properties

.onAnimationStartObservable

An instance of Observable. An event is triggered before the animation starts.


.onAnimationEndObservable

An instance of Observable. An event is triggered after the animation ends.

SimplePropertyAnimation

An animated property.

hierarchy

  • SimpleAnimation

constructor

new BABYLON.SimplePropertyAnimation({
  target,
  property,
  type,
  from,
  to,
  duration,
  easing,
})

| argument | description | | ---: | :--- | | target | The target. | | property | A string as a path to the property. | | type | The type of the animation. If omitted, the starting value of the property is used to guess it. | | from | The starting value of the property. If omitted, the current value of the property is used. | | to | The ending value of the property. | | duration | A number as the duration. | | easing | An instance of EasingFunction as the easing function. |

instance properties

.target

.property

.type

.from

.to

.duration

.easing

SimpleAnimationDelay

A delay between animations.

hierarchy

  • SimpleAnimation

constructor

new BABYLON.SimpleAnimationDelay(duration)

| argument | description | | ---: | :--- | | duration | A number as the duration. |

instance properties

.duration

SimpleAnimationGroup

abstract

hierarchy

  • SimpleAnimation

instance properties

.duration

read-only

A number as the duration.

instance functions

.add(...animations)

Adds animations to the group.

| argument | description | | ---: | :--- | | ... | An instance of SimpleAnimation as the animation to add. |

Returns the instance to allow chaining.

SimpleParallelAnimationGroup

A parallel group of animations.

hierarchy

  • SimpleAnimation
  • SimpleAnimationGroup

constructor

new BABYLON.SimpleParallelAnimationGroup()

SimpleSequentialAnimationGroup

A sequential group of animations.

hierarchy

  • SimpleAnimation
  • SimpleAnimationGroup

constructor

new BABYLON.SimpleSequentialAnimationGroup()

SimpleStaggeredAnimationGroup

A staggered group of animations.

hierarchy

  • SimpleAnimation
  • SimpleAnimationGroup

constructor

new BABYLON.SimpleStaggeredAnimationGroup(delay)

| argument | description | | ---: | :--- | | delay | A function to calculate the delay between the start times of each animation. The function starts calling from the second animation in the group. |

delay(index, length, currentAnimation, previousAnimation)

| argument | description | | ---: | :--- | | index | A number as the index of the current animation in the group. | | length | A number as the count of the animations in the group. | | currentAnimation | An instance of SimpleAnimation as the current animation. | | previousAnimation | An instance of SimpleAnimation as the previous animation. |

Scene

instance functions

.beginSimpleAnimation(animation)

Begins the animation.

| argument | description | | ---: | :--- | | animation | An instance of SimpleAnimation as the animation to begin. |