directActions.d.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. import { Action } from "./action";
  2. import type { Condition } from "./condition";
  3. import type { ActionEvent } from "./actionEvent";
  4. /**
  5. * This defines an action responsible to toggle a boolean once triggered.
  6. * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
  7. */
  8. export declare class SwitchBooleanAction extends Action {
  9. /**
  10. * The path to the boolean property in the target object
  11. */
  12. propertyPath: string;
  13. private _target;
  14. private _effectiveTarget;
  15. private _property;
  16. /**
  17. * Instantiate the action
  18. * @param triggerOptions defines the trigger options
  19. * @param target defines the object containing the boolean
  20. * @param propertyPath defines the path to the boolean property in the target object
  21. * @param condition defines the trigger related conditions
  22. */
  23. constructor(triggerOptions: any, target: any, propertyPath: string, condition?: Condition);
  24. /** @internal */
  25. _prepare(): void;
  26. /**
  27. * Execute the action toggle the boolean value.
  28. */
  29. execute(): void;
  30. /**
  31. * Serializes the actions and its related information.
  32. * @param parent defines the object to serialize in
  33. * @returns the serialized object
  34. */
  35. serialize(parent: any): any;
  36. }
  37. /**
  38. * This defines an action responsible to set a the state field of the target
  39. * to a desired value once triggered.
  40. * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
  41. */
  42. export declare class SetStateAction extends Action {
  43. /**
  44. * The value to store in the state field.
  45. */
  46. value: string;
  47. private _target;
  48. /**
  49. * Instantiate the action
  50. * @param triggerOptions defines the trigger options
  51. * @param target defines the object containing the state property
  52. * @param value defines the value to store in the state field
  53. * @param condition defines the trigger related conditions
  54. */
  55. constructor(triggerOptions: any, target: any, value: string, condition?: Condition);
  56. /**
  57. * Execute the action and store the value on the target state property.
  58. */
  59. execute(): void;
  60. /**
  61. * Serializes the actions and its related information.
  62. * @param parent defines the object to serialize in
  63. * @returns the serialized object
  64. */
  65. serialize(parent: any): any;
  66. }
  67. /**
  68. * This defines an action responsible to set a property of the target
  69. * to a desired value once triggered.
  70. * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
  71. */
  72. export declare class SetValueAction extends Action {
  73. /**
  74. * The path of the property to set in the target.
  75. */
  76. propertyPath: string;
  77. /**
  78. * The value to set in the property
  79. */
  80. value: any;
  81. private _target;
  82. private _effectiveTarget;
  83. private _property;
  84. /**
  85. * Instantiate the action
  86. * @param triggerOptions defines the trigger options
  87. * @param target defines the object containing the property
  88. * @param propertyPath defines the path of the property to set in the target
  89. * @param value defines the value to set in the property
  90. * @param condition defines the trigger related conditions
  91. */
  92. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  93. /** @internal */
  94. _prepare(): void;
  95. /**
  96. * Execute the action and set the targeted property to the desired value.
  97. */
  98. execute(): void;
  99. /**
  100. * Serializes the actions and its related information.
  101. * @param parent defines the object to serialize in
  102. * @returns the serialized object
  103. */
  104. serialize(parent: any): any;
  105. }
  106. /**
  107. * This defines an action responsible to increment the target value
  108. * to a desired value once triggered.
  109. * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
  110. */
  111. export declare class IncrementValueAction extends Action {
  112. /**
  113. * The path of the property to increment in the target.
  114. */
  115. propertyPath: string;
  116. /**
  117. * The value we should increment the property by.
  118. */
  119. value: any;
  120. private _target;
  121. private _effectiveTarget;
  122. private _property;
  123. /**
  124. * Instantiate the action
  125. * @param triggerOptions defines the trigger options
  126. * @param target defines the object containing the property
  127. * @param propertyPath defines the path of the property to increment in the target
  128. * @param value defines the value value we should increment the property by
  129. * @param condition defines the trigger related conditions
  130. */
  131. constructor(triggerOptions: any, target: any, propertyPath: string, value: any, condition?: Condition);
  132. /** @internal */
  133. _prepare(): void;
  134. /**
  135. * Execute the action and increment the target of the value amount.
  136. */
  137. execute(): void;
  138. /**
  139. * Serializes the actions and its related information.
  140. * @param parent defines the object to serialize in
  141. * @returns the serialized object
  142. */
  143. serialize(parent: any): any;
  144. }
  145. /**
  146. * This defines an action responsible to start an animation once triggered.
  147. * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
  148. */
  149. export declare class PlayAnimationAction extends Action {
  150. /**
  151. * Where the animation should start (animation frame)
  152. */
  153. from: number;
  154. /**
  155. * Where the animation should stop (animation frame)
  156. */
  157. to: number;
  158. /**
  159. * Define if the animation should loop or stop after the first play.
  160. */
  161. loop?: boolean;
  162. private _target;
  163. /**
  164. * Instantiate the action
  165. * @param triggerOptions defines the trigger options
  166. * @param target defines the target animation or animation name
  167. * @param from defines from where the animation should start (animation frame)
  168. * @param to defines where the animation should stop (animation frame)
  169. * @param loop defines if the animation should loop or stop after the first play
  170. * @param condition defines the trigger related conditions
  171. */
  172. constructor(triggerOptions: any, target: any, from: number, to: number, loop?: boolean, condition?: Condition);
  173. /** @internal */
  174. _prepare(): void;
  175. /**
  176. * Execute the action and play the animation.
  177. */
  178. execute(): void;
  179. /**
  180. * Serializes the actions and its related information.
  181. * @param parent defines the object to serialize in
  182. * @returns the serialized object
  183. */
  184. serialize(parent: any): any;
  185. }
  186. /**
  187. * This defines an action responsible to stop an animation once triggered.
  188. * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
  189. */
  190. export declare class StopAnimationAction extends Action {
  191. private _target;
  192. /**
  193. * Instantiate the action
  194. * @param triggerOptions defines the trigger options
  195. * @param target defines the target animation or animation name
  196. * @param condition defines the trigger related conditions
  197. */
  198. constructor(triggerOptions: any, target: any, condition?: Condition);
  199. /** @internal */
  200. _prepare(): void;
  201. /**
  202. * Execute the action and stop the animation.
  203. */
  204. execute(): void;
  205. /**
  206. * Serializes the actions and its related information.
  207. * @param parent defines the object to serialize in
  208. * @returns the serialized object
  209. */
  210. serialize(parent: any): any;
  211. }
  212. /**
  213. * This defines an action responsible that does nothing once triggered.
  214. * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
  215. */
  216. export declare class DoNothingAction extends Action {
  217. /**
  218. * Instantiate the action
  219. * @param triggerOptions defines the trigger options
  220. * @param condition defines the trigger related conditions
  221. */
  222. constructor(triggerOptions?: any, condition?: Condition);
  223. /**
  224. * Execute the action and do nothing.
  225. */
  226. execute(): void;
  227. /**
  228. * Serializes the actions and its related information.
  229. * @param parent defines the object to serialize in
  230. * @returns the serialized object
  231. */
  232. serialize(parent: any): any;
  233. }
  234. /**
  235. * This defines an action responsible to trigger several actions once triggered.
  236. * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
  237. */
  238. export declare class CombineAction extends Action {
  239. /**
  240. * The list of aggregated animations to run.
  241. */
  242. children: Action[];
  243. /**
  244. * defines if the children actions conditions should be check before execution
  245. */
  246. enableChildrenConditions: boolean;
  247. /**
  248. * Instantiate the action
  249. * @param triggerOptions defines the trigger options
  250. * @param children defines the list of aggregated animations to run
  251. * @param condition defines the trigger related conditions
  252. * @param enableChildrenConditions defines if the children actions conditions should be check before execution
  253. */
  254. constructor(triggerOptions: any, children: Action[], condition?: Condition, enableChildrenConditions?: boolean);
  255. /** @internal */
  256. _prepare(): void;
  257. /**
  258. * Execute the action and executes all the aggregated actions.
  259. * @param evt event to execute
  260. */
  261. execute(evt: ActionEvent): void;
  262. /**
  263. * Serializes the actions and its related information.
  264. * @param parent defines the object to serialize in
  265. * @returns the serialized object
  266. */
  267. serialize(parent: any): any;
  268. }
  269. /**
  270. * This defines an action responsible to run code (external event) once triggered.
  271. * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
  272. */
  273. export declare class ExecuteCodeAction extends Action {
  274. /**
  275. * The callback function to run.
  276. */
  277. func: (evt: ActionEvent) => void;
  278. /**
  279. * Instantiate the action
  280. * @param triggerOptions defines the trigger options
  281. * @param func defines the callback function to run
  282. * @param condition defines the trigger related conditions
  283. */
  284. constructor(triggerOptions: any, func: (evt: ActionEvent) => void, condition?: Condition);
  285. /**
  286. * Execute the action and run the attached code.
  287. * @param evt event to execute
  288. */
  289. execute(evt: ActionEvent): void;
  290. }
  291. /**
  292. * This defines an action responsible to set the parent property of the target once triggered.
  293. * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
  294. */
  295. export declare class SetParentAction extends Action {
  296. private _parent;
  297. private _target;
  298. /**
  299. * Instantiate the action
  300. * @param triggerOptions defines the trigger options
  301. * @param target defines the target containing the parent property
  302. * @param parent defines from where the animation should start (animation frame)
  303. * @param condition defines the trigger related conditions
  304. */
  305. constructor(triggerOptions: any, target: any, parent: any, condition?: Condition);
  306. /** @internal */
  307. _prepare(): void;
  308. /**
  309. * Execute the action and set the parent property.
  310. */
  311. execute(): void;
  312. /**
  313. * Serializes the actions and its related information.
  314. * @param parent defines the object to serialize in
  315. * @returns the serialized object
  316. */
  317. serialize(parent: any): any;
  318. }