consts.ts

  1. import { IObject } from "@daybrush/utils";
  2. import { RoleObject, OptionType, EventType, EasingFunction } from "./types";
  3. import { EASE, EASE_IN, EASE_IN_OUT, LINEAR, EASE_OUT, STEP_START, STEP_END } from "./easing";
  4. export const PREFIX = "__SCENEJS_";
  5. export const DATA_SCENE_ID = "data-scene-id";
  6. export const TIMING_FUNCTION = "animation-timing-function";
  7. export const ROLES: RoleObject = { transform: {}, filter: {}, attribute: {}, html: true };
  8. export const ALIAS: IObject<string[]> = { easing: [TIMING_FUNCTION] };
  9. export const FIXED = { [TIMING_FUNCTION]: true, contents: true, html: true };
  10. export const MAXIMUM = 1000000;
  11. export const THRESHOLD = 0.000001;
  12. export const DURATION = "duration";
  13. export const FILL_MODE = "fillMode";
  14. export const DIRECTION = "direction";
  15. export const ITERATION_COUNT = "iterationCount";
  16. export const DELAY = "delay";
  17. export const EASING = "easing";
  18. export const PLAY_SPEED = "playSpeed";
  19. export const EASING_NAME = "easingName";
  20. export const ITERATION_TIME = "iterationTime";
  21. export const PAUSED = "paused";
  22. export const ENDED = "ended";
  23. export const TIMEUPDATE = "timeupdate";
  24. export const ANIMATE = "animate";
  25. export const PLAY = "play";
  26. export const RUNNING = "running";
  27. export const ITERATION = "iteration";
  28. export const START_ANIMATION = "startAnimation";
  29. export const PAUSE_ANIMATION = "pauseAnimation";
  30. export const ALTERNATE = "alternate";
  31. export const REVERSE = "reverse";
  32. export const ALTERNATE_REVERSE = "alternate-reverse";
  33. export const NORMAL = "normal";
  34. export const INFINITE = "infinite";
  35. export const PLAY_STATE = "playState";
  36. export const PLAY_CSS = "playCSS";
  37. export const PREV_TIME = "prevTime";
  38. export const TICK_TIME = "tickTime";
  39. export const CURRENT_TIME = "currentTime";
  40. export const SELECTOR = "selector";
  41. export const TRANSFORM_NAME = "transform";
  42. export const EASINGS = {
  43. "linear": LINEAR,
  44. "ease": EASE,
  45. "ease-in": EASE_IN,
  46. "ease-out": EASE_OUT,
  47. "ease-in-out": EASE_IN_OUT,
  48. "step-start": STEP_START,
  49. "step-end": STEP_END,
  50. };
  51. /**
  52. * option name list
  53. * @name Scene.OPTIONS
  54. * @memberof Scene
  55. * @static
  56. * @type {$ts:OptionType}
  57. * @example
  58. * Scene.OPTIONS // ["duration", "fillMode", "direction", "iterationCount", "delay", "easing", "playSpeed"]
  59. */
  60. export const OPTIONS: OptionType = [DURATION, FILL_MODE, DIRECTION, ITERATION_COUNT, DELAY, EASING, PLAY_SPEED];
  61. /**
  62. * Event name list
  63. * @name Scene.EVENTS
  64. * @memberof Scene
  65. * @static
  66. * @type {$ts:EventType}
  67. * @example
  68. * Scene.EVENTS // ["paused", "ended", "timeupdate", "animate", "play", "iteration"];
  69. */
  70. export const EVENTS: EventType = [PAUSED, ENDED, TIMEUPDATE, ANIMATE, PLAY, ITERATION];