
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
pixi-motion
Advanced tools
Animation library that brings the power of Motion to @pixi/react
Install with your favorite package manager:
npm install pixi-motion motion @pixi/react
yarn install pixi-motion motion @pixi/react
pnpm install pixi-motion motion @pixi/react
bun install pixi-motion motion @pixi/react
[!NOTE] pixi-motion is still fresh and mostly untested, please try it out and report bugs!
Import pixiMotion
and use it like a regular @pixi/react
component, but with animation capabilities similar to motion/react
:
import { Application, extend } from "@pixi/react";
import { Container, Graphics } from "pixi.js";
import { useCallback } from "react";
import { pixiMotion } from "pixi-motion";
extend({
Container,
Graphics,
});
const MyComponent = () => {
const drawCallback = useCallback((graphics) => {
graphics.clear();
graphics.setFillStyle({ color: "red" });
graphics.rect(0, 0, 100, 100);
graphics.fill();
}, []);
const [position, setPosition] = useState({ x: 100, y: 100 });
const handleClick = () => {
// move to a random spot
setPosition((prev) => ({
x: Math.random() * 600,
y: Math.random() * 600,
}));
};
return (
<Application>
<pixiMotion.pixiContainer
onClick={handleClick}
initial={{ alpha: 0 }}
position={position}
transition={{
duration: 1,
bounce: 0.5,
alpha: { ease: "easeOut", duration: 0.5 },
}}
>
<pixiGraphics draw={drawCallback} />
</pixiMotion.pixiContainer>
</Application>
);
};
pixi-motion
supports the initial
prop and the animate
prop, which function similarly to motion/react
. Nothing else is included right now.
You can animate the following properties:
x
, y
(position coordinates)position
(as a PointData object)alpha
(transparency)scale
(uniform or as a PointData object)rotation
, angle
(rotation in radians or degrees)width
, height
(dimensions)pivot
(rotation origin)skew
(skew transformation)pixiMotion supports all PixiJS components that have animatable properties, including:
pixiMotion.pixiContainer
pixiMotion.pixiSprite
pixiMotion.pixiGraphics
pixiMotion.pixiText
pixiMotion.pixiAnimatedSprite
0.1.3
FAQs
motion/react integration for @pixi/react
The npm package pixi-motion receives a total of 0 weekly downloads. As such, pixi-motion popularity was classified as not popular.
We found that pixi-motion demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.