{"id":20163827,"url":"https://github.com/systemlight/micro-transform2d","last_synced_at":"2026-05-16T13:05:08.021Z","repository":{"id":42831895,"uuid":"265466027","full_name":"SystemLight/micro-transform2d","owner":"SystemLight","description":":dizzy:  A tool for quickly setting CSS Transform.【使用JS设置CSS transform属性】","archived":false,"fork":false,"pushed_at":"2023-08-03T06:12:54.000Z","size":760,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-31T04:27:51.162Z","etag":null,"topics":["css","js","transform2d"],"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/SystemLight.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-20T06:00:41.000Z","updated_at":"2022-07-03T11:48:10.000Z","dependencies_parsed_at":"2024-11-14T00:32:04.846Z","dependency_job_id":null,"html_url":"https://github.com/SystemLight/micro-transform2d","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SystemLight/micro-transform2d","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fmicro-transform2d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fmicro-transform2d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fmicro-transform2d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fmicro-transform2d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SystemLight","download_url":"https://codeload.github.com/SystemLight/micro-transform2d/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fmicro-transform2d/sbom","scorecard":{"id":136756,"data":{"date":"2025-08-04","repo":{"name":"github.com/SystemLight/micro-transform2d","commit":"f2fcaef3013c747d7910b5fcb8fffccd38a600e5"},"scorecard":{"version":"v5.2.1-28-gc1d103a9","commit":"c1d103a9bb9f635ec7260bf9aa0699466fa4be0e"},"score":1.7,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"36 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27","Warn: Project is vulnerable to: GHSA-4www-5p9h-95mh","Warn: Project is vulnerable to: GHSA-9gqv-wp59-fq42","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76c9-3jph-rj3q","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-hc6q-2mpp-qw7j","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-4v9v-hfq4-rm2v","Warn: Project is vulnerable to: GHSA-9jgg-88mc-972h","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c1d103a9bb9f635ec7260bf9aa0699466fa4be0e/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T06:43:46.289Z","repository_id":42831895,"created_at":"2025-08-16T06:43:46.290Z","updated_at":"2025-08-16T06:43:46.290Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33103971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["css","js","transform2d"],"created_at":"2024-11-14T00:31:59.528Z","updated_at":"2026-05-16T13:05:07.986Z","avatar_url":"https://github.com/SystemLight.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# micro-transform2d\n\n[![NPM version](https://img.shields.io/npm/v/micro-transform2d.svg)](https://www.npmjs.com/package/micro-transform2d)\n\n\u003e A tool for quickly setting CSS Transform  \n\u003e NPM page: https://www.npmjs.com/package/micro-transform2d\n\n# Installation\n\n```\nnpm install micro-transform2d --save\n```\n\n# User Guide\n\n```\nimport {Transform2D} from \"micro-transform2d\";\nlet t2d = new Transform2D(tou.el);\nt2d.setRotate(rotate).setTranslate(5, 5);\n```\n\n```\n注意变换是有顺序区分的，如果你要求变换按照一定顺序请初始化时这样操作\nimport {Transform2D} from \"micro-transform2d\";\nlet t2d = new Transform2D(tou.el);\nTranslate会在rotate之前执行\nt2d.setTranslate().setRotate();\n```\n\n```\n设置相对值\nimport {Transform2D} from \"micro-transform2d\";\nlet t2d = new Transform2D(tou.el);\nt2d.setTranslate(x, y, true);\n\n注意setScale的开启相对值设置时是基于当前大小进行伸缩\n如当前是1，传入1.5，伸缩值为1.5，\n如当前是2，传入0.5，伸缩值为1，\n除此之外setScale的relative参数不是接收布尔值，而是接收number或者函数\n\n当设置relative为number时，基于这个值进行收缩，\n当设置relative为函数时时，接收一个数组为当前元素的收缩值和传入的sca值，返回sca值为想要设置的收缩值\n通过函数可以更加灵活控制sca值\nt2d.setScale(scale, function (val) {\n    let sca = relativeSca * val[1];\n    return sca \u003c 0.6 ? 0.6 : sca;\n});\n\n除了setScale之外，其余方法relative参数均为布尔值，相对于元素当前偏移值增加传入值\n```\n\n```\n结合micro-touch实现拖拽阻力\n\nlet pullN = 0.2;\n\nlet tg = new TouchGesture(divDom.current);\nlet t2d = new Transform2D(divDom.current);\nt2d.setTranslate(50, 0);\n\ntg.on(\"tapDown\", function () {\n    divDom.current.style.removeProperty(\"transition\");\n    t2d.setTranslate(50, 0);\n});\n\ntg.on(\"pressMove\", function (e) {\n    let {moveDistance: {x, y, d}} = e;\n    let [nowX, nowY] = t2d.getTranslate();\n\n    if (nowY \u003e 50) {\n        y *= pullN;\n    }\n\n    t2d.setTranslate(50, nowY + y);\n});\n\ntg.on(\"tapUp\", function () {\n    divDom.current.style.transition = \"500ms\";\n    t2d.setTranslate(50, 0);\n});\n```\n\n# Note\n\n- new Transform2D(el)\n  - el: DOM对象\n\n- getMatrix() : 获取Matrix属性，返回是一个大小为6的数组，代表变换矩阵\n- setMatrix([1,0,0,1,0,0]) : 设置Matrix属性\n- getTranslate() : 获取偏移translate\n- setTranslate(x,y) : 设置偏移translate\n- getScale() : 获取缩放比例\n- setScale(sca) : 设置缩放比例，原比例是1\n- getRotate() : 获取旋转角度\n- setRotate(angle) : 设置旋转角度\n- getSkew() : 获取斜切属性\n- setSkew(xAngle,yAngle) : 设置斜切属性\n\n- radian2angle() : 弧度转角度\n- angle2radian() : 角度转弧度\n- transform() : 获取transform属性\n- setTransform(result: RegExpMatchArray | null, val: string) :\n\n- reset() : 清除变换顺序用于重新初始变换应用顺序\n\n- origin() : 获取变换原点\n- setOrigin() : 设置变换原点\n\n# Resources\n\nYou can read [transform2d Documentation](https://github.com/SystemLight/micro-transform2d) online for more information.\n\n# License\n\nmicro-transform2d uses the MIT license, see LICENSE file for the details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsystemlight%2Fmicro-transform2d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsystemlight%2Fmicro-transform2d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsystemlight%2Fmicro-transform2d/lists"}