{"id":27995590,"url":"https://github.com/chokcoco/css3-3d-transform","last_synced_at":"2025-05-08T20:34:10.719Z","repository":{"id":34938433,"uuid":"39010649","full_name":"chokcoco/css3-3d-transform","owner":"chokcoco","description":"90行代码实现图片旋转木马3D效果","archived":false,"fork":false,"pushed_at":"2015-07-14T03:24:44.000Z","size":196,"stargazers_count":9,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-01T18:35:45.457Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chokcoco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-13T12:27:13.000Z","updated_at":"2020-09-12T07:03:10.000Z","dependencies_parsed_at":"2022-09-01T03:40:23.639Z","dependency_job_id":null,"html_url":"https://github.com/chokcoco/css3-3d-transform","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chokcoco%2Fcss3-3d-transform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chokcoco%2Fcss3-3d-transform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chokcoco%2Fcss3-3d-transform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chokcoco%2Fcss3-3d-transform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chokcoco","download_url":"https://codeload.github.com/chokcoco/css3-3d-transform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253145734,"owners_count":21861274,"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":"2025-05-08T20:34:09.971Z","updated_at":"2025-05-08T20:34:10.671Z","avatar_url":"https://github.com/chokcoco.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# css3-3d-transform\n仅需关键代码50行实现一个3D类似旋转木马的图片浏览功能\n\n##代码示意\n```html\n\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n    \u003ctitle\u003eCss3-3d-transform__实现图片旋转木马3D效果\u003c/title\u003e\n\u003c/head\u003e\n\u003cstyle\u003e\n#doc{\n\theight: 600px;\n\tposition: relative;\n\toverflow: hidden;\n\tbackground-color: #ddd;\n}\n\n#stage{\n\twidth: 1000px;\n\tmargin: 100px auto 0 auto;\n\theight: 400px;\n\t-webkit-perspective: 800px;\n\t   -moz-perspective: 800px;\n            perspective: 800px;\n\t\n\t-webkit-transition: top .5s;\n\n\tposition: relative;\n}\n\n#container{\n\tposition: absolute;\n\twidth: 128px;\n\theight: 72px;\n\tleft: 50%;\n\ttop:50%;\n\tmargin-left: -64px;\n\tmargin-top: -36px;\n\tcursor: pointer;\n\n\t-webkit-transition: -webkit-transform 1s;\n\t   -moz-transition: -moz-transform 1s;\n\t        transition: transform 1s;\n\t\n\t-webkit-transform-style: preserve-3d;\n\t   -moz-transform-style: preserve-3d;\n\t        transform-style: preserve-3d;\n}\n\n.piece{\n\twidth: 128px;\n\toverflow: hidden;\n\tbox-shadow: 0 1px 3px rgba(0,0,0,.5);\n\t-webkit-transition: opacity 1s, -webkit-transform 1s;\n       -moz-transition: opacity 1s, -moz-transform 1s;\n            transition: opacity 1s, transform 1s;\n\t\t\t\n\tposition: absolute;\n\tbottom: 0;\n}\n\u003c/style\u003e\n\u003cbody\u003e\n\t\u003cdiv id=\"doc\"\u003e\n\t\t\u003cdiv id=\"stage\"\u003e\n\t\t\t\u003cdiv id=\"container\"\u003e\n\t\t\t\t\u003c!--此处可上传自己的图片--\u003e\n\t\t\t\t\u003cimg src=\"../static/images/1.png\" class='piece' style=\"-webkit-transform: rotateY(0deg) translateZ(196px);\"\u003e\n\t\t\t\t\u003cimg src=\"../static/images/2.png\" class='piece' style=\"-webkit-transform: rotateY(60deg) translateZ(196px);\"\u003e\n\t\t\t\t\u003cimg src=\"../static/images/3.png\" class='piece' style=\"-webkit-transform: rotateY(120deg) translateZ(196px);\"\u003e\n\t\t\t\t\u003cimg src=\"../static/images/1.png\" class='piece' style=\"-webkit-transform: rotateY(180deg) translateZ(196px);\"\u003e\n\t\t\t\t\u003cimg src=\"../static/images/2.png\" class='piece' style=\"-webkit-transform: rotateY(240deg) translateZ(196px);\"\u003e\n\t\t\t\t\u003cimg src=\"../static/images/4.png\" class='piece' style=\"-webkit-transform: rotateY(300deg) translateZ(196px);\"\u003e\n\t\t\t\u003c/div\u003e\n\t\t\u003c/div\u003e\n\t\u003c/div\u003e\n\u003c/body\u003e\n\n\u003cscript\u003e\n\t(function(){\n\t\tvar indexPiece = 0,\n\t\t\trotateDeg = 0,\n\t\t\teleContainer = document.getElementById('container');\n\n\t\t// alert('start');\n\t\teleContainer.addEventListener(\"click\",function(){\n\t\t\t// alert('in');\n\t\t\trotateDeg = 60*++indexPiece;\n\t\t\teleContainer.style.transform = \"rotateY(\"+rotateDeg+\"deg)\";\n\t\t})\n\t})();\n\u003c/script\u003e\n\u003c/html\u003e\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchokcoco%2Fcss3-3d-transform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchokcoco%2Fcss3-3d-transform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchokcoco%2Fcss3-3d-transform/lists"}