This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from "react" | |
interface WorldOrientation { | |
/** A number representing the motion of the device around the z axis, expressed in degrees with values ranging from 0 to 360. */ | |
alpha: number | |
/** A number representing the motion of the device around the x axis, expressed in degrees with values ranging from -180 to 180. This represents a front to back motion of the device. */ | |
beta: number | |
/** A number representing the motion of the device around the y axis, expressed in degrees with values ranging from -90 to 90. This represents a left to right motion of the device. */ | |
gamma: number | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useRef, useLayoutEffect, RefObject } from "react" | |
interface PositionTransitionOptions extends Partial<TransitionOptions> { | |
/** A list of {@link Dependencies} for the position of the element. This could for example be the index in a list, the window size or a combination of those. When the dependencies change a transition can happen. */ | |
dependencies: Dependencies | |
/** The element ref can be passed in if you don't want to use the ref returned by the hook. */ | |
ref?: RefObject<HTMLDivElement> | |
} | |
interface PositionInfo { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react" | |
// Share values among components using a hook. The values are available using an identifier. | |
// There are currently three types of build-in tokens: | |
// - useNumberToken | |
// - useStringToken | |
// - useBooleanToken | |
// - useObjectToken | |
// - useArrayToken |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react" | |
// For sharing a search string among components | |
// export const searchStore = new Store(""); | |
// Register class components on mount | |
// componentDidMount() { searchStore.registerComponent(this) } | |
// And unregister on unmount | |
// componentWillUnmount() { searchStore.unregisterComponent(this) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react" | |
import { Frame, addPropertyControls, ControlType } from "framer" | |
interface Props { | |
enabled: boolean | |
onChange: (enabled: boolean) => void | |
tint?: string | |
} | |
export function Switch({ enabled, tint, onChange }: Props) { |