
Security News
NIST Officially Stops Enriching Most CVEs as Vulnerability Volume Skyrockets
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.
use-spritesheet
Advanced tools
use-spritesheet is a set of hooks to use pixel art, spritesheets and Aseprite with react-three-fiber in just a few lines of code.
👁 Live Demo (source in example)
npm i use-spritesheet
yarn add use-spritesheet
usePixelTextureA small time-saver if you want crisp pixels on a texture, sets the texture filter to nearest-neighbour and (optionally) enables wrapping.
import frogSrc from './resources/frog.png';
const PixelTexture = () => {
const tex = usePixelTexture(frogSrc);
return (
<sprite>
<spriteMaterial transparent map={tex} />
</sprite>
);
};
useSpritesheetPerfect for when you have a spritesheet and want to slice out a single frame to display statically (such as an icon from a icon set).
import smileySrc from './resources/smiley_idle.png';
const SpritesheetSingleFrame = () => {
// 1 row
// 8 columns
// display frame index 2
const tex = useSpritesheet(smileySrc, 1, 8, 2);
return (
<sprite>
<spriteMaterial transparent map={tex} />
</sprite>
);
};
useSpritesheetAnimationPlay a series of frames that are baked into a single texture, ideal for particle effects.
import impSrc from './resources/impo.png';
const SpritesheetAnimation = ({ paused }: { paused: boolean }) => {
// 100ms per frame
// 2 rows
// 4 columns
const [tex] = useSpritesheetAnimation(impSrc, 100, 2, 4, paused);
return (
<sprite>
<spriteMaterial transparent map={tex} />
</sprite>
);
};
useAsepriteAnimationImport a texture + json file exported from Aseprite, select which animation to play and control playback speed.
import gremlin from "./resources/bomber.png";
import gremlinJson from "./resources/bomber.json";
export const AsepriteAnimation = ({
animation = "idle",
paused,
}: any) => {
const [texture] = useAseprite(
gremlin,
gremlinJson as AsepriteJson,
animation, // Changing this parameter automatically switches animations
paused
);
return (
<sprite>
<spriteMaterial transparent map={texture} />
</sprite>
);
};
We make use of yarn workspaces to develop the example alongside the library itself.
yarn
cd use-spritesheet
yarn build
cd ../example
yarn start
FAQs
Bringing spritesheets and aseprite intergration to react-three-fiber
The npm package use-spritesheet receives a total of 4 weekly downloads. As such, use-spritesheet popularity was classified as not popular.
We found that use-spritesheet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.