{"id":13447470,"url":"https://github.com/mojs/mojs-player","last_synced_at":"2025-12-12T04:56:42.227Z","repository":{"id":37821773,"uuid":"54800263","full_name":"mojs/mojs-player","owner":"mojs","description":"GUI player to control your animations","archived":false,"fork":false,"pushed_at":"2023-09-30T21:39:07.000Z","size":11549,"stargazers_count":296,"open_issues_count":3,"forks_count":50,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-29T01:12:13.763Z","etag":null,"topics":["gui","mojs","player","timeline","tool"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mojs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":"FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"xavierfoucrier"}},"created_at":"2016-03-26T21:24:13.000Z","updated_at":"2025-03-19T17:44:37.000Z","dependencies_parsed_at":"2024-01-18T15:58:59.103Z","dependency_job_id":"e3c4e87b-79b0-481b-b9d0-d629046eefab","html_url":"https://github.com/mojs/mojs-player","commit_stats":null,"previous_names":["legomushroom/mojs-player"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojs%2Fmojs-player","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojs%2Fmojs-player/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojs%2Fmojs-player/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojs%2Fmojs-player/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mojs","download_url":"https://codeload.github.com/mojs/mojs-player/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276163,"owners_count":20912288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gui","mojs","player","timeline","tool"],"created_at":"2024-07-31T05:01:18.672Z","updated_at":"2025-12-12T04:56:42.185Z","avatar_url":"https://github.com/mojs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/xavierfoucrier"],"categories":["JavaScript"],"sub_categories":[],"readme":"# @mojs/player – [![npm](https://img.shields.io/npm/v/@mojs/player.svg)](https://www.npmjs.com/package/@mojs/player)\n\nGUI player to control your animations.\n\n![@mojs/player](logo.png \"@mojs/player\")\n\nPlayer controls for [mojs](https://github.com/mojs/mojs). Intended to help you to craft `mojs` animation sequences. To be clear, this player is not needed to play `mojs` animations. It is just a debug tool that gives you the ability to:\n- control your sequences with `GUI` while working on them\n- it saves the current progress of your animation thus you don't loose the `focus`\n- it gives you `bounds` to constrain `focus point` of your animation\n- it gives you the control over the speed of animation\n- it gives you the ability to seek animations freely\n- it saves player's state and settings thus they not get lost when page reloaded\n\n## Installation\n\nThe `MojsPlayer` depends on `mojs \u003e= 0.225.2` so make sure you link it first.\n\n```console\n# cdn\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/@mojs/player\"\u003e\u003c/script\u003e\n\n# npm\nnpm i @mojs/player\n```\n\nImport `MojsPlayer` constructor to your code, depending on your environment:\n\n```javascript\nconst MojsPlayer = require('mojs-player').default;\n\n// or\nimport MojsPlayer from '@mojs/player';\n```\n\n\u003e If you installed it with script link — you should have `MojsPlayer` global\n\n## Usage\n\nConstruct `MojsPlayer` and pass your main `Tween/Timeline` to the `add` option:\n\n```javascript\n// create the timeline\nconst mainTimeline = new mojs.Timeline({});\n\n// add the timeline to the player\nconst mojsPlayer = new MojsPlayer({\n  add: mainTimeline\n});\n```\n\n\u003e The `add` option is the **only required option** to launch: player's controls should appear at the bottom of the page when ready\n\nYou can also set other player initial state:\n\n```javascript\nconst mojsPlayer = new MojsPlayer({\n\n  // required\n  add:          mainTimeline,\n\n  // optionally\n  className:    '',         // class name to add to main HTMLElement\n  isSaveState:  true,       // determines if should preserve state on page reload\n  isPlaying:    false,      // playback state\n  progress:     0,          // initial progress\n  isRepeat:     false,      // determines if it should repeat after completion\n  isBounds:     false,      // determines if it should have bounds\n  leftBound:    0,          // left bound position  [0...1]\n  rightBound:   1,          // right bound position [0...1]\n  isSpeed:      false,      // determines if speed control should be open\n  speed:        1,          // `speed` value\n  isHidden:     false,      // determines if the player should be hidden\n  precision:    0.1,        // step size for player handle - for instance, after page reload - player should restore timeline progress - the whole timeline will be updated incrementally with the `precision` step size until the progress will be met.\n  name:         'mojs-player', // name for the player - mainly used for localstorage identifier, use to distinguish between multiple local players\n  onToggleHide(isHidden) {  // should be called after user taps on the hide-button (isHidden is a boolean, indicating the visibility state of the player)\n    if (isHidden) {\n      // do something when player is invisible\n    } else {\n      // do something when player is visible\n    }\n  }\n});\n```\n\n## Shortcuts\n\n- `alt + p`  - toggle `play`/`pause` playback state\n- `alt + - `  - decrease progress by `1/100`\n- `alt + +` - increase progress by `1/100`\n- `shift + alt + -` - decrease progress by `1/10`\n- `shift + alt + +` - increase progress by `1/10`\n- `alt + s` - `stop` playback\n- `alt + r` - toggle `repeat` state\n- `alt + b` - toggle `bounds` state\n- `alt + h` - toggle `show`/`hide` player state\n- `alt + q` - reset `speed` to `1x`\n- `alt + 2` - decrease `speed` by `1/50`\n- `alt + 3` - increase `speed` by `1/50`\n- `shift + alt + 2` - decrease `speed` by `1/10`\n- `shift + alt + 3` - increase `speed` by `1/10`\n\n\n## Development\n\nInstall [webpack](https://webpack.github.io/) globally:\n\n```console\n[sudo] npm install webpack -g\n```\n\nInstall dependencies with [npm](https://www.npmjs.com/):\n\n```console\n[sudo] npm install\n```\n\nRun [webpack](https://webpack.github.io/):\n\n```console\nwebpack\n```\n\nPlease make sure you are on the `dev` branch before making changes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmojs%2Fmojs-player","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmojs%2Fmojs-player","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmojs%2Fmojs-player/lists"}