Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/activeguild/react-three-animation

A library supports image animation using react-three-fiber. The target files are APNG and GIFfiles.
https://github.com/activeguild/react-three-animation

animation apng gif react react-three-fiber texture threejs

Last synced: about 1 month ago
JSON representation

A library supports image animation using react-three-fiber. The target files are APNG and GIFfiles.

Awesome Lists containing this project

README

        

react-three-animation ⚡ Welcome 😀


GitHub Actions status

# react-three-animation

A library supports image animation using `react-three-fiber`. The target files are `APNG` and `GIF` files.

If there is only one frame, a still image is displayed.

The animate, pause, and reset methods can be called from the texture.

## Install

```bash
npm i react-three-animation
```

## Demo

## Usage

```ts
import React, { useRef, useEffect } from "react";
import * as THREE from "three";
import { useAnimationTexture } from "react-three-animation";

interface Props {
url: string;
}

export function Model({ url }: Props) {
const { animationTexture } = useAnimationTexture({ url });
const meshRef = useRef();

useEffect(() => {
if (meshRef.current && animationTexture) {
meshRef.current.material.map = animationTexture;
meshRef.current.material.needsUpdate = true;
}
}, [animationTexture]);

return (




);
}
```

#### Pre-load if necessary.

```ts
import React from "react";
import * as THREE from "three";
import { preLoad } from "react-three-animation";

export default function App() {
preLoad('/sample.png');
return ...
}

```

## Principles of conduct

Please see [the principles of conduct](https://github.com/activeguild/react-three-animation/blob/main/.github/CONTRIBUTING.md) when building a site.

## License

This library is licensed under the [MIT license](https://github.com/activeguild/react-three-animation/blob/main/LICENSE).