Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotation animation not working #44

Closed
socratesone opened this issue Mar 27, 2020 · 5 comments
Closed

Rotation animation not working #44

socratesone opened this issue Mar 27, 2020 · 5 comments

Comments

@socratesone
Copy link

socratesone commented Mar 27, 2020

Using React 16.13.1
npm 6.14.4
Node v12.16.0
P5 1.0.0

I've created a component to place a sketch in, which is displaying a single frame of the sketch, but that's it. The animation of the included sketches based on the "rotation" property isn't updating.

I'm using both example sketchs (sketch1.js and sketch2.js, as well as the example in the README file -- all have the same behavior.

App.js:

import React from 'react';
import BackgroundAnimation from './BackgroundAnimation';

function App() {
return (
< BackgroundAnimation />
)
}
export default App;

`

BackgroundAnimation.js:
`
import React from 'react';
import P5Wrapper from 'react-p5-wrapper';
import {default as sketch1} from './sketches/sketch1';

const BackgroundAnimation = () => {
let rotation = 10;

return (
    <P5Wrapper sketch={sketch2} rotation={rotation} />
)

}

export default BackgroundAnimation;
`

I've added some console.log(), which appear to never be called (Not seeing anything in the console).

I'm still a little new to React. I'm guessing I have to add something to one of the life cycle functions? Maybe I can't use functional components and need to explicitly make it a class component? Are there any hooks I could use? I'm not seeing much documentation.

Any help would be greatly appreciated.

Thanks in advance.

@jamesrweb
Copy link
Collaborator

@socratesone do you have a link to your repo or some better formatted code at least and I can take a look?

@socratesone
Copy link
Author

Sorry. I didn't get any help soon enough, so I decided to use a difference p5 wrapper.

@jamesrweb
Copy link
Collaborator

@socratesone which one did you end up using?

@socratesone
Copy link
Author

react-p5

Nothing against react-p5-wrapper, but react-p5 worked out of the box and saved me some troubleshooting time.

@jamesrweb
Copy link
Collaborator

@socratesone good to know, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants