{"id":17598006,"url":"https://github.com/cvan/aframe-role","last_synced_at":"2025-03-29T20:27:59.935Z","repository":{"id":137964573,"uuid":"48187390","full_name":"cvan/aframe-role","owner":"cvan","description":"Popmotion Role for A-Frame animation, tracking and physics.","archived":false,"fork":false,"pushed_at":"2015-12-17T17:09:00.000Z","size":556,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-24T09:50:17.221Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://popmotion.io","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cvan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-17T17:05:06.000Z","updated_at":"2021-09-21T14:50:29.000Z","dependencies_parsed_at":"2023-03-15T14:15:56.070Z","dependency_job_id":null,"html_url":"https://github.com/cvan/aframe-role","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvan%2Faframe-role","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvan%2Faframe-role/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvan%2Faframe-role/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvan%2Faframe-role/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cvan","download_url":"https://codeload.github.com/cvan/aframe-role/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246240685,"owners_count":20745919,"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":[],"created_at":"2024-10-22T09:44:13.933Z","updated_at":"2025-03-29T20:27:59.909Z","avatar_url":"https://github.com/cvan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A-Frame plugin for Popmotion\n\nPopmotion Actor role to enable A-Frame animation, physics and input tracking.\n\n## Examples\n\n- [Physics](http://codepen.io/popmotion/pen/pgyoYx?editors=101)\n- Some rather obnoxious-yet-demonstrative animation](http://codepen.io/popmotion/pen/GoZpjo?editors=101)\n\n## Use\n\n```html\n\u003ca-cube width=\"3\" color=\"red\"\u003e\u003c/a-cube\u003e\n```\n\n```javascript\nimport ui from 'popmotion';\nimport aframeRole from 'popmotion-aframe-role';\n\nconst cube = new ui.Actor({\n    element: document.querySelector('a-cube'),\n    as: aframeRole\n});\n```\n\n`cube` is now a standard Popmotion `Actor`, except with an applied A-Frame Role.\n\nThis allows you to run a standard `Tween`, `Simulate` or `Track` action:\n\n```javascript\nconst moveBackAndForth = new ui.Tween({\n    values: {\n        x: 5\n    },\n    duration: 600,\n    ease: 'easeInOut',\n    yoyo: true\n});\n\ncube.start(moveBackAndForth);\n```\n\n### Create many A-Frame Actors\n\nAs A-Frame elements are DOM elements, you can use `ui.select` to create multiple `Actors` at once. For instance:\n\n```javascript\nui.select('a-cube', {\n    as: aframeRole\n});\n```\n\nWill return an `Iterator` of `Actor` elements (see [full documentation](http://popmotion.io/api/popmotion/select)). You must remember to set `as` on Actor initialisation.\n\n## Supported properties\n\nAll numerical properties can be set with Popmotion.\n\n- `position` properties can be set with `x`, `y`, and `z`.\n- `scale` and `rotation` properties can be set eg `scaleX` and `rotateY`.\n- Dash-case characters are set as camelCase, eg `radius-bottom` becomes `radiusBottom`.\n\n## Advanced: create an A-Frame Actor\n\nIf you're creating a lot of A-Frame Actors and don't want to set `as` each time, you could make something like this:\n\n```javascript\nimport { Actor } from 'popmotion';\nimport aframeRole from 'popmotion-aframe-role';\n\nclass AFrameActor extends Actor {\n    constructor(props, ...args) {\n        props.as = aframeRole;\n        super(props, ...args);\n    }\n}\n\nconst cube = new AFrameActor(document.querySelector('a-cube'));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvan%2Faframe-role","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcvan%2Faframe-role","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvan%2Faframe-role/lists"}