{"id":19423907,"url":"https://github.com/swizec/something-3d","last_synced_at":"2025-04-24T16:31:12.250Z","repository":{"id":66695711,"uuid":"94861012","full_name":"Swizec/something-3d","owner":"Swizec","description":"An experiment in compositional three.js","archived":false,"fork":false,"pushed_at":"2017-06-20T07:20:25.000Z","size":703,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-03T07:38:59.619Z","etag":null,"topics":["react","reactjs","three","three-js","threejs"],"latest_commit_sha":null,"homepage":null,"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/Swizec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-06-20T07:12:31.000Z","updated_at":"2020-04-03T08:29:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"1ce0b14c-9eaf-494d-93ec-41dd0a033e80","html_url":"https://github.com/Swizec/something-3d","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/Swizec%2Fsomething-3d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swizec%2Fsomething-3d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swizec%2Fsomething-3d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Swizec%2Fsomething-3d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Swizec","download_url":"https://codeload.github.com/Swizec/something-3d/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250663544,"owners_count":21467366,"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":["react","reactjs","three","three-js","threejs"],"created_at":"2024-11-10T13:41:16.978Z","updated_at":"2025-04-24T16:31:11.945Z","avatar_url":"https://github.com/Swizec.png","language":"JavaScript","readme":"This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).\n\n# An experiment in compositional Three.js\n\n2 spinning cubes\n\n![2 spinning cubes](https://raw.githubusercontent.com/Swizec/something-3d/master/compositional-threejs.gif)\n\nMade from a normal React component tree.\n\n```javascript\nclass App extends Component {\n    state = {\n        rotation1: { x: 0, y: 0, z: 0 },\n        rotation2: { x: 0, y: 0, z: 0 }\n    }\n\n    componentDidMount() {\n        this.gameLoop();\n    }\n\n\n    gameLoop = () =\u003e {\n        requestAnimationFrame(this.gameLoop);\n\n        const { rotation1, rotation2 } = this.state;\n\n        this.setState({\n            rotation1: { x: rotation1.x + 0.03,\n                         y: rotation1.y + 0.03, },\n            rotation2: { x: rotation2.x - 0.06,\n                         y: rotation2.y - 0.06 }\n        });\n    }\n\n\n    render() {\n        const { rotation1, rotation2 } = this.state;\n\n        return (\n            \u003cdiv className=\"App\"\u003e\n                \u003cdiv className=\"App-header\"\u003e\n                    \u003cimg src={logo} className=\"App-logo\" alt=\"logo\" /\u003e\n                    \u003ch2\u003eWelcome to React\u003c/h2\u003e\n                \u003c/div\u003e\n                \u003cdiv className=\"App-intro\"\u003e\n                    \u003cThreeScene width={800} height={600}\n                                style={{margin: '0 auto' }}\u003e\n                        \u003cPerspectiveCamera fov={75}\n                                           aspect={800/600}\n                                           near={0.1}\n                                           far={1000}\n                                           position={{x: 0, y: 0, z: 30}}\u003e\n\n                            \u003cCube rotation={rotation1}\n                                  position={{x: 2, y: 0, z: 25}}  /\u003e\n                            \u003cCube rotation={rotation2}\n                                  position={{x: -10, y: 5, z: 10 }} /\u003e\n\n                        \u003c/PerspectiveCamera\u003e\n                    \u003c/ThreeScene\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        );\n    }\n}\n\n```\n\nExcellent.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswizec%2Fsomething-3d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswizec%2Fsomething-3d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswizec%2Fsomething-3d/lists"}