This package contains a React component for a Random Dot Kinematogram (RDK) build with the P5 library.
In RDKs, a certain percentage of dots are designated as “signal” to move in one coherent direction, and the remaining percentage of dots are designated as “noise” to move in random directions.
Simply add the <RDK>
component to your React tree.
import RDK from "@empirica/random-dot-kinematogram";
//...
<RDK coherence={0.5} direction="right" />;
RDK expects 2 props:
- direction: "right" or "left" for the direction the signal
- coherence: a value between 0 (incoherent) and 1 (coherent) for the noise
This package is based on the work of @josephbb. Thank you @josephbb for allowing us to share your work with the community.