The following props can be passed: onUpdate
, onError
, isPlaying
, progress
, inputState
, labels
, cameraPreset
. Also layout
and data
which will be discussed further down.
-
onUpdate
should be a function that takes one argument
onUpdate={ object => {
this.setState(object);
}}
An object containing the state of the visualizer, with the following structure, will be returned:
{progress: 1, currentSegmentNumber: 16, isPlaying: false, isInteracting: true, isHovering: false}
-
onError
If any errors are thrown within the visualizer component this function will be called (if it has been passed as a prop) with the errors object as the only argument:
onError={errors => {
console.log(errors);
}}
-
inputState
an object with structure
{
qubits: [
{ name: "qubit1", x: 0, y: 1, z: 0 },
{ name: "qubit2", x: 0, y: 0, z: -1 }
],
vectors: [{ name: "a", x: 0, y: 0, z: -1 }]
}
that will be set as an arbitrary starting / position for the pulse indicators
-
isPlaying
tells the Bloch sphere component to start or stop the animation
-
progress
will have the pulse path starting at the progress percent specified. Eg: if you want to have the whole path showing on mount set progress to 1
progress={<float between 0 and 1>}
-
Labels
needs to be an object with the following structure and will control the visibility of individual labels:
{
xAxis: true,
yAxis: true,
zAxis: true,
theta: true,
thetaArc: true,
phi: true,
phiArc: true,
northPole: true,
southPole: true
}
-
templateName
tells the visualizer what element layout template to generate, I.e a one qubit layout or a two qubit layout. You can import available templates/names from the library like so:
import Visualizer, { GRID_TEMPLATE_NAMES } from "@qctrl/visualizer";