react-zdog
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -74,3 +74,4 @@ 'use strict'; | ||
function useZdog() { | ||
return React.useContext(stateContext); | ||
var state = React.useContext(stateContext); | ||
return state.current; | ||
} | ||
@@ -77,0 +78,0 @@ |
@@ -61,3 +61,4 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
function useZdog() { | ||
return useContext(stateContext); | ||
const state = useContext(stateContext); | ||
return state.current; | ||
} | ||
@@ -64,0 +65,0 @@ |
@@ -44,3 +44,4 @@ import Zdog from 'zdog' | ||
function useZdog() { | ||
return useContext(stateContext) | ||
const state = useContext(stateContext) | ||
return state.current | ||
} | ||
@@ -47,0 +48,0 @@ |
{ | ||
"name": "react-zdog", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "React-fiber renderer for zdog", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -6,3 +6,7 @@ <p align="center"> | ||
npm install zdog react-zdog | ||
# or | ||
yarn add zdog react-zdog | ||
![npm](https://img.shields.io/npm/v/react-zdog.svg?style=flat-square) ![npm](https://img.shields.io/npm/dt/react-zdog.svg?style=flat-square) | ||
react-zdog is a declarative abstraction of [zdog](https://zzz.dog/), a cute pseudo 3d-engine. Doing zdog in React allows you to break up your scene graph into declarative, re-usable components with clean, reactive semantics. Try a live demo [here](https://codesandbox.io/s/nervous-feather-vk9uh). | ||
@@ -19,3 +23,3 @@ | ||
<Illustration zoom={8}> | ||
<Shape stroke={20} color="lightblue" /> | ||
<Shape stroke={20} color="lightblue" rotate={{ x: Math.PI }} /> | ||
</Illustration>, | ||
@@ -26,12 +30,12 @@ document.getElementById('root') | ||
# Api | ||
# API | ||
Comming soon ... For now, this little demo [here](https://codesandbox.io/s/nervous-feather-vk9uh) has it all covered. react-zdog basically forwards props to zdog primitives, anything you can do in zdog is possible here, too. | ||
Coming soon ... For now, this little demo [here](https://codesandbox.io/s/nervous-feather-vk9uh) has it all covered. react-zdog basically forwards props to zdog primitives, anything you can do in zdog is possible here, too. | ||
## Illustration | ||
The `Illustration` object is your portal into zdog. It forwards unreserved properties to the internal Zdog.Illustration instance. | ||
The `Illustration` object is your portal into zdog. It forwards unreserved properties to the internal Zdog.Illustration instance. The component auto adjusts to re-size changes and fills out the wrapping relative/absolute parent. | ||
```jsx | ||
<Canvas element="svg" /> // Can bei either 'svg' or 'canvas' | ||
<Canvas element="svg" /> // Can be either 'svg' or 'canvas' | ||
``` | ||
@@ -50,5 +54,11 @@ | ||
function MyComponent() { | ||
// Subscribes to the render-loop, gets cleaned up automatically when the component unmounts | ||
useRender(t => console.log("I'm in the render-loop")) | ||
function Spin({ children }) { | ||
const ref = useRef(undefined) | ||
useRender(t => ref.current.rotate.y += 0.01) | ||
return ( | ||
<Anchor ref={ref}> | ||
{children} | ||
</Anchor> | ||
) | ||
} | ||
``` | ||
@@ -55,0 +65,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25083
604
76