{"id":13409070,"url":"https://github.com/dntzhang/pasition","last_synced_at":"2025-05-16T11:03:48.173Z","repository":{"id":57314293,"uuid":"94290371","full_name":"dntzhang/pasition","owner":"dntzhang","description":"Path Transition with little JS code, render to anywhere - 轻量级 Path 过渡库，渲染到任何地方","archived":false,"fork":false,"pushed_at":"2023-05-27T23:56:27.000Z","size":129,"stargazers_count":1216,"open_issues_count":2,"forks_count":94,"subscribers_count":44,"default_branch":"master","last_synced_at":"2025-04-19T09:41:05.818Z","etag":null,"topics":["canvas","pasition","path","svg"],"latest_commit_sha":null,"homepage":"https://dntzhang.github.io/pasition/","language":"JavaScript","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/dntzhang.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,"governance":null}},"created_at":"2017-06-14T04:51:25.000Z","updated_at":"2025-04-18T10:52:19.000Z","dependencies_parsed_at":"2022-09-20T23:20:41.691Z","dependency_job_id":"0e688eb8-b091-4a9d-9eb7-95e002f7df38","html_url":"https://github.com/dntzhang/pasition","commit_stats":null,"previous_names":["alloyteam/pasition"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dntzhang%2Fpasition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dntzhang%2Fpasition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dntzhang%2Fpasition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dntzhang%2Fpasition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dntzhang","download_url":"https://codeload.github.com/dntzhang/pasition/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518384,"owners_count":22084374,"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":["canvas","pasition","path","svg"],"created_at":"2024-07-30T20:00:57.770Z","updated_at":"2025-05-16T11:03:48.119Z","avatar_url":"https://github.com/dntzhang.png","language":"JavaScript","readme":"﻿\n\u003cp align=\"center\"\u003e\n  \u003ca href =\"##\"\u003e\u003cimg alt=\"pasition\" src=\"http://images2015.cnblogs.com/blog/105416/201706/105416-20170620094820476-131210795.gif\"\u003e\u003c/a\u003e\u003ca href =\"##\"\u003e\u003cimg alt=\"pasition\" src=\"http://images2015.cnblogs.com/blog/105416/201706/105416-20170620094817554-48316107.gif\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003ch3 align=\"center\"\u003e\nPasition - Path Transition with little JS code, render to anywhere.\n\u003c/h3\u003e\n\n---\n\n## [中文 README](https://github.com/dntzhang/pasition/blob/master/docs/release.md)\n\n## DEMO\n\n* [https://dntzhang.github.io/pasition/](https://dntzhang.github.io/pasition/)\n\n## Install\n\n```\nnpm install pasition\n```\n\nor get js by the cdn address:\n\n[https://unpkg.com/pasition](https://unpkg.com/pasition)\n\n## Usage\n\n```js\npasition.animate({\n    from : fromPath,\n    to : toPath,\n    time : time,\n    easing : function(){ },\n    begin : function(shapes){ },\n    progress : function(shapes, percent){ },\n    end : function(shapes){ }\n})\n```\n\nyou can get the path from attr d of svg path element.\n\nSupported All the svg path commands:\n\n```\nM/m = moveto\nL/l = lineto\nH/h = horizontal lineto\nV/v = vertical lineto\nC/c = curveto\nS/s = smooth curveto\nA/a = elliptical Arc\nZ/z = closepath\nQ/q = quadratic Belzier curve\nT/t = smooth quadratic Belzier curveto\n```\n\nExample:\n\n```js\npasition.animate({\n    from: 'M 40 40 Q 60 80 80 40T 120 40 T 160 40 z',\n    to: 'M32,0C14.4,0,0,14.4,0,32s14.3,32,32,32 s32-14.3,32-32S49.7,0,32,0z',\n    time: 1000,\n    easing : function(){ },\n    begin:function(shapes){ },\n    progress : function(shapes, percent){\n        //render you shape to svg or canvas or webgl\n    },\n    end : function(shapes){ }\n});\n```\n\nyou can get the progressing shapes by `pasition.lerp`:\n\n```js\nvar shapes  = pasition.lerp(pathA, pathB, 0.5)\n//render shapes in canvas ,svg or anywhere you want\n...\n```\n\n# License\nThis content is released under the [MIT](http://opensource.org/licenses/MIT) License.\n","funding_links":[],"categories":["Libraries","Repository","JavaScript"],"sub_categories":["Path animation","Animation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdntzhang%2Fpasition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdntzhang%2Fpasition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdntzhang%2Fpasition/lists"}