@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
136 lines (135 loc) • 6 kB
TypeScript
import { Object3D } from "three";
import { USDDocument, USDObject, USDWriter } from "../../ThreeUSDZExporter.js";
import type { RegisteredAnimationInfo } from "./../Animation.js";
import { BehaviorExtension } from "./Behaviour.js";
export interface IBehaviorElement {
id: string;
writeTo(document: USDDocument, writer: USDWriter): any;
}
export declare class BehaviorModel {
static global_id: number;
id: string;
trigger: IBehaviorElement | IBehaviorElement[];
action: IBehaviorElement;
exclusive: boolean;
makeExclusive(exclusive: boolean): BehaviorModel;
constructor(id: string, trigger: IBehaviorElement | IBehaviorElement[], action: IBehaviorElement);
writeTo(_ext: BehaviorExtension, document: USDDocument, writer: USDWriter): void;
}
export type Target = USDObject | USDObject[] | Object3D | Object3D[];
export declare class TriggerModel implements IBehaviorElement {
static global_id: number;
id: string;
targetId?: string | Target;
tokenId?: string;
type?: string;
distance?: number;
constructor(targetId?: string | Target, id?: string);
writeTo(document: USDDocument, writer: USDWriter): void;
}
export declare class TriggerBuilder {
private static __sceneStartTrigger?;
static sceneStartTrigger(): TriggerModel;
/** Trigger that fires when an object has been tapped/clicked.
* @param targetObject The object or list of objects that can be interacted with.
* @param inputMode Input Mode (direct and/or indirect). Only available for USDObject targets. Only supported on Vision OS at the moment. */
static tapTrigger(targetObject: Target, inputMode?: {
direct: boolean;
indirect: boolean;
}): TriggerModel;
static isTapTrigger(trigger?: TriggerModel): boolean;
static proximityToCameraTrigger(targetObject: Target, distance: number): TriggerModel;
}
export declare class GroupActionModel implements IBehaviorElement {
static global_id: number;
static getId(): number;
id: string;
actions: IBehaviorElement[];
loops: number;
performCount: number;
type: string;
multiplePerformOperation: MultiplePerformOperation | undefined;
constructor(id: string, actions: IBehaviorElement[]);
addAction(el: IBehaviorElement): GroupActionModel;
makeParallel(): GroupActionModel;
makeSequence(): GroupActionModel;
makeLooping(): this;
makeRepeat(count: number): this;
writeTo(document: USDDocument, writer: USDWriter): void;
}
/** @internal */
export type EmphasizeActionMotionType = "pop" | "blink" | "bounce" | "flip" | "float" | "jiggle" | "pulse" | "spin";
/** @internal */
export type VisibilityActionMotionType = "none" | "pop" | "scaleUp" | "scaleDown" | "moveLeft" | "moveRight" | "moveAbove" | "moveBelow" | "moveForward" | "moveBack";
/** @internal */
export type MotionStyle = "basic";
/** @internal */
export type Space = "relative" | "absolute";
/** @internal */
export type PlayAction = "play" | "pause" | "stop";
/** @internal */
export type AuralMode = "spatial" | "nonSpatial" | "ambient";
/** @internal */
export type VisibilityMode = "show" | "hide";
/** @internal */
export type MultiplePerformOperation = "allow" | "ignore" | "stop";
/** @internal */
export type EaseType = "none" | "in" | "out" | "inout";
export declare class ActionModel implements IBehaviorElement {
private static global_id;
id: string;
tokenId?: "ChangeScene" | "Visibility" | "StartAnimation" | "Wait" | "LookAtCamera" | "Emphasize" | "Transform" | "Audio" | "Impulse";
affectedObjects?: string | Target;
easeType?: EaseType;
motionType: EmphasizeActionMotionType | VisibilityActionMotionType | undefined;
duration?: number;
moveDistance?: number;
style?: MotionStyle;
type?: Space | PlayAction | VisibilityMode;
front?: Vec3;
up?: Vec3;
start?: number;
animationSpeed?: number;
reversed?: boolean;
pingPong?: boolean;
xFormTarget?: Target | string;
audio?: string;
gain?: number;
auralMode?: AuralMode;
multiplePerformOperation?: MultiplePerformOperation;
velocity?: Vec3;
comment?: string;
animationName?: string;
clone(): ActionModel;
constructor(affectedObjects?: string | Target, id?: string);
writeTo(document: USDDocument, writer: USDWriter): void;
}
declare class Vec3 {
x: number;
y: number;
z: number;
constructor(x: number, y: number, z: number);
static get up(): Vec3;
static get right(): Vec3;
static get forward(): Vec3;
static get back(): Vec3;
static get zero(): Vec3;
}
export declare class ActionBuilder {
static sequence(...params: IBehaviorElement[]): GroupActionModel;
static parallel(...params: IBehaviorElement[]): GroupActionModel;
static fadeAction(targetObject: Target, duration: number, show: boolean): ActionModel;
/**
* creates an action that plays an animation
* @param start offset in seconds!
* @param duration in seconds! 0 means play to end
*/
static startAnimationAction(targetObject: Target, anim: RegisteredAnimationInfo, reversed?: boolean, pingPong?: boolean): IBehaviorElement;
static waitAction(duration: number): ActionModel;
static lookAtCameraAction(targets: Target, duration?: number, front?: Vec3, up?: Vec3): ActionModel;
static emphasize(targets: Target, duration: number, motionType?: EmphasizeActionMotionType, moveDistance?: number, style?: MotionStyle): ActionModel;
static transformAction(targets: Target, transformTarget: Target, duration: number, transformType: Space, easeType?: EaseType): ActionModel;
static playAudioAction(targets: Target, audio: string, type?: PlayAction, gain?: number, auralMode?: AuralMode): ActionModel;
static impulseAction(targets: Target, velocity: Vec3): ActionModel;
}
export { Vec3 as USDVec3 };