
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
react-projection-mapping
Advanced tools
<img src="https://raw.githubusercontent.com/wirewirewirewire/react-projection-mapping/main/packages/docs/src/app/github-image.png" data-canonical-src="https://raw.githubusercontent.com/wirewirewirewir
Distort a container by using css 3D transforms for projection mapping and software keystone for react.
Install via npm
npm install react-projection-mapping --save
Wrap your application with Projection
.
import { Projection } from "react-projection-mapping";
<Projection data={data} onChange={update} editing={true} enabled={true}>
Your containers
</Projection>;
Use the onChange
prop to save the current values.
const update = ({ values, action }) => {
if (action === "onEnd") {
localStorage.setItem("projection", JSON.stringify(values));
}
};
data
allows you to load the values from an endpoint.
const [items, setItems] = useState();
useEffect(() => {
const data = JSON.parse(localStorage.getItem("projection"));
if (data) {
setItems(data);
}
}, []);
Each Element you want to distort should wrapped with Layer
. Make sure to add an unique id
.
import { Layer } from "react-projection-mapping";
<Layer id="total">Element</Layer>;
Use the SplitLayer
component to separate the Layer into multiple other layers. It renders the same component multiple times and uses clip-path to split it. It can take all settings from Layer
.
import { Projection, SplitLayer } from "react-projection-mapping";
<Projection data={data} onChange={update} edit={true} enabled={true}>
{[...Array(2)].map((y, index) => (
<SplitLayer
key={index}
id={`tile-${index}`}
clip={[0, index === 0 ? 50 : 0, 0, index === 0 ? 0 : 50]}
>
Content
</SplitLayer>
))}
</Projection>;
useProjection()
hookHook to get the current distort status or manually set it from any place inside Projection
.
import { useProjection } from "react-projection-mapping";
const {
data,
edit,
enabled,
selectedCorner,
selectedLayer,
setSelectedCorner,
setSelectedLayer,
} = useProjection();
Results from the useProjection()
hook
{
"data": {
"id-of-layer": {
"corners": [
-326, 175, -212, 93, -184, 236, -73, 157
],
"zIndex": 3
}
},
"edit": true,
"enabled": true,
"selectedCorner": 0,
"selectedLayer": "id-of-layer",
"setSelectedCorner": () => { return number},
"setSelectedLayer": () => {return "id-of-layer" }
}
While in editing mode you can use the keyboard shortcuts for fine adjustments.
Q
move to next cornerW
move to previous cornerA
move z-index downwardsS
move z-index upwards↑
→
←
↓
Move corner⇧
+ ↑
→
←
↓
Move corner 10pxFAQs
<img src="https://raw.githubusercontent.com/wirewirewirewire/react-projection-mapping/main/packages/docs/src/app/github-image.png" data-canonical-src="https://raw.githubusercontent.com/wirewirewirewir
The npm package react-projection-mapping receives a total of 49 weekly downloads. As such, react-projection-mapping popularity was classified as not popular.
We found that react-projection-mapping 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
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.