{"id":13661968,"url":"https://github.com/beinteractive/UrMotion","last_synced_at":"2025-04-25T06:30:57.359Z","repository":{"id":145845143,"uuid":"53488980","full_name":"beinteractive/UrMotion","owner":"beinteractive","description":"Flexible motion engine for non time-based animation in Unity.","archived":false,"fork":false,"pushed_at":"2018-03-29T01:31:51.000Z","size":154,"stargazers_count":274,"open_issues_count":1,"forks_count":28,"subscribers_count":27,"default_branch":"master","last_synced_at":"2024-11-10T17:45:29.825Z","etag":null,"topics":["animation","tween","unity","unity3d"],"latest_commit_sha":null,"homepage":"","language":"C#","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/beinteractive.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":"2016-03-09T10:25:42.000Z","updated_at":"2024-10-19T10:38:40.000Z","dependencies_parsed_at":"2023-10-20T18:21:10.566Z","dependency_job_id":null,"html_url":"https://github.com/beinteractive/UrMotion","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/beinteractive%2FUrMotion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beinteractive%2FUrMotion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beinteractive%2FUrMotion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beinteractive%2FUrMotion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beinteractive","download_url":"https://codeload.github.com/beinteractive/UrMotion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250767043,"owners_count":21483914,"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":["animation","tween","unity","unity3d"],"created_at":"2024-08-02T05:01:45.650Z","updated_at":"2025-04-25T06:30:53.083Z","avatar_url":"https://github.com/beinteractive.png","language":"C#","readme":"# A flexible motion engine for non time-based animation in Unity\n\nUrMotion (Your motion) is a brand new simple \u0026 flexible motion engine for Unity.\nIt enables you to create non time-based complex animations on your script easy and fast.\n\nTo start using UrMotion, copy `Assets/UrMotion` directoy to your project and write `using UrMotion;` in your code.\n\n```C#\nusing UnityEngine;\nusing System.Collections;\nusing UrMotion;\n```\n\n## Examples\n\n### Simply uniform move\n\n```C#\ng.MotionX().Velocity(3f);\n```\n\n![velocity_x](https://cloud.githubusercontent.com/assets/1482297/13745657/a492e7fa-ea32-11e5-98dd-22f61cdd7617.gif)\n\n### Simply uniform move (Moving Y)\n\n```C#\ng.MotionY().Velocity(3f);\n```\n\n![velocity_y](https://cloud.githubusercontent.com/assets/1482297/13745812/6cbe3ffe-ea33-11e5-8cf1-6b1a64b02502.gif)\n\n### Simply uniform move (Moving X \u0026 Y)\n\n```C#\ng.MotionP().Velocity(new Vector2(3f, 2f));\n```\n\n![velocity_xy](https://cloud.githubusercontent.com/assets/1482297/13745885/ce749d06-ea33-11e5-8848-dbd05516affa.gif)\n\n### Accel move\n\n```C#\ng.MotionX().Accel(0.3f);\n```\n\n![accel_x](https://cloud.githubusercontent.com/assets/1482297/13746040/a856bd6a-ea34-11e5-8682-1c03d62dde29.gif)\n\n### Accel move with initial speed\n\n```C#\ng.MotionX().Velocity(1f).Accel(0.3f);\n```\n\n![accel_x_with_init](https://cloud.githubusercontent.com/assets/1482297/13746163/4f3dc79a-ea35-11e5-8e00-5126c8e1e9ab.gif)\n\n```C#\ng.MotionX().Velocity(-6f).Accel(0.3f);\n```\n\n![accel_with_init_2](https://cloud.githubusercontent.com/assets/1482297/13764927/0e84f5d0-ea98-11e5-9206-9fef6dcb1c24.gif)\n\n### Accel by ratio\n\n```C#\ng.MotionX().AccelByRatio(10f, 0.9f);\n```\n\n![accel_by_ratio](https://cloud.githubusercontent.com/assets/1482297/13765144/babeb15a-ea99-11e5-9eb0-7dd14b8e1482.gif)\n\n### Sin move\n\n```C#\ng.MotionX().Sin(83f, 0.5f);\n```\n\n![sin](https://cloud.githubusercontent.com/assets/1482297/13766403/e5b9d0dc-eaa4-11e5-8e6d-8b7810213f53.gif)\n\n### Circular move\n\n```C#\ng.MotionP().Circular(83f, 0.5f);\n```\n\n![circular](https://cloud.githubusercontent.com/assets/1482297/13766625/ef8fea72-eaa6-11e5-9d8b-3b39b9733590.gif)\n\n### Lissajous move\n\n```C#\ng.MotionP().Lissajous(83f, 51f, 0.6f, 1.2f, 0f);\n```\n\n![lissajous](https://cloud.githubusercontent.com/assets/1482297/13766843/d274a156-eaa8-11e5-887e-fbf4a3f502b3.gif)\n\n### Aiming with uniform move\n\nAn aiming method produce a velocity that makes a GameObject go toward the specified position.\n\n```C#\ng.MotionP().AimAt(p, 10f);\n```\n\n![aim](https://cloud.githubusercontent.com/assets/1482297/13769120/6018c26e-eac0-11e5-8bdf-45400aef0136.gif)\n\n### Aiming with common ratio\n\n```C#\ng.MotionP().AimRatioAt(p, 0.15f);\n```\n\n![aim_ratio](https://cloud.githubusercontent.com/assets/1482297/13769156/b445e3a8-eac0-11e5-9437-a498f5efed44.gif)\n\n### Aiming with spring move\n\n```C#\ng.MotionP().AimSpringAt(p, 0.15f, 0.8f);\n```\n\n![aim_spring](https://cloud.githubusercontent.com/assets/1482297/13769261/98ecd9ee-eac1-11e5-88d5-17f898f569bd.gif)\n\n### Aiming with exponential interpolation\n\n```C#\ng.MotionP().AimExpoAt(p, 0.15f);\n```\n\n![aim_expo](https://cloud.githubusercontent.com/assets/1482297/13769301/e35d8cda-eac1-11e5-8a2c-0a37af14768b.gif)\n\n### Aiming with critically damped spring smoothing\n\n```C#\ng.MotionP().AimCriticalDampingAt(p, 0.15f);\n```\n\n![aim_critical](https://cloud.githubusercontent.com/assets/1482297/13769357/4aac3f44-eac2-11e5-914d-5cba808441b1.gif)\n\n### Perlin noise\n\n```C#\ng.MotionP().Perlin(new Vector2(0.4f, 0.8f)).AmplifyComponents(new Vector2(3f, 2f));\n```\n\n![perlin](https://cloud.githubusercontent.com/assets/1482297/13772583/4a0903e0-ead8-11e5-82a5-e15678af3283.gif)\n\n### Fractional brownian motion\n\n```C#\ng.MotionP().Fbm(new Vector2(0.4f, 0.8f), 3).AmplifyComponents(new Vector2(3f, 2f));\n```\n\n![fbm](https://cloud.githubusercontent.com/assets/1482297/13772542/162a7c70-ead8-11e5-9584-e2a386352ce8.gif)\n\n### Timed parameter\n\nChange velocity by time with sin curve.\n\n```C#\ng.MotionX().Velocity(Source.Float.Sin(2f, 1f).Offset(2f));\n```\n\n![velocity_sin](https://cloud.githubusercontent.com/assets/1482297/13766518/c7b454da-eaa5-11e5-903f-9e602c03078d.gif)\n\nChange radius by time with sin curve.\n\n```C#\ng.MotionX().Sin(Source.Float.Sin(51f, 0.5f).Offset(51f), 1f);\n```\n\n![radius_sin](https://cloud.githubusercontent.com/assets/1482297/13766584/76bee0ee-eaa6-11e5-9926-cff56378bf4b.gif)\n\n### Custom parameter\n\nYou can use any of the following types as a motion parameter.\n\n * `V`\n * `IEnumerator\u003cV\u003e`\n * `IEnumerable\u003cV\u003e`\n * `Func\u003cV\u003e`\n\n`V` is: `float`, `Vector2`, `Vector3` or `Vector4`\n\n```C#\ng.MotionX().Velocity(() =\u003e Random.Range(-10f, 10f));\n```\n\n![own_function](https://cloud.githubusercontent.com/assets/1482297/13768846/981ffe28-eabd-11e5-84dd-49778119e2ac.gif)\n\n### Lifetime control\n\nFinish velocity effect after 15fr.\n\n```C#\ng.MotionX().Accel(0.3f).Lifetime(15f);\n```\n\n![lifetime](https://cloud.githubusercontent.com/assets/1482297/13766138/a8bc5fc6-eaa2-11e5-860d-2dc673629edd.gif)\n\nStart velocity effect after 15fr.\n\n```C#\ng.MotionX().Accel(0.3f).StartDelay(15f);\n```\n\n![delay](https://cloud.githubusercontent.com/assets/1482297/13766176/ffdc7ade-eaa2-11e5-92cf-407e565884b0.gif)\n\nFinish velocity effect if it magnitude is less than 0.01f.\nThen, destroy a GameObject.\n\n```C#\ng.MotionX().AccelByRatio(10f, 0.9f).LiveThreshold(0.01f).Next(() =\u003e Destroy(g));\n```\n\n![complete_velocity](https://cloud.githubusercontent.com/assets/1482297/13765840/5bfe617c-eaa0-11e5-87ac-8572d7a771c4.gif)\n\n## Complex motion examples\n\n### Parabola\n\n```C#\ng.MotionX().Velocity(6f);\ng.MotionY().Velocity(18f).Accel(-0.98f);\n```\n\n![parabola](https://cloud.githubusercontent.com/assets/1482297/13764902/c2e1ba50-ea97-11e5-91ad-581e37cce268.gif)\n\n### Spiral\n\n```C#\ng.MotionP().Circular(Source.Float.Sin(51f, 0.5f).Offset(51f), 2f);\n```\n\n![spiral](https://cloud.githubusercontent.com/assets/1482297/13766722/d051baea-eaa7-11e5-90c2-e82e12a6051e.gif)\n\n### Lissajous + Lissajous\n\n```C#\ng.MotionP().Lissajous(83f, 51f, 0.6f, 1.2f, 0f).Lissajous(24f, 32f, 2.4f, 0.8f, 0f);\n```\n\n![lissajous lissajous](https://cloud.githubusercontent.com/assets/1482297/13766920/576e4542-eaa9-11e5-8497-71bda0f558ed.gif)\n\n### Lissajous with directon\n\n```C#\nvar vel = default(IEnumerator\u003cVector2\u003e);\ng.MotionP().Lissajous(83f, 51f, 0.6f, 1.2f, 0f).Capture(out vel);\ng.MotionR().AimRatioAt(vel.ToAngle().Offset(-90f), 1f);\n```\n\n![lissajous direction](https://cloud.githubusercontent.com/assets/1482297/13767022/36d96914-eaaa-11e5-9bde-2d2ecb559a7c.gif)\n\n### Floating scaling\n\n```C#\ng.MotionS().AccelByRatio(Vector2.one * 0.4f, 0.85f).Sin(Vector2.one * 0.5f, 0.5f);\n```\n\n![floating_scaling](https://cloud.githubusercontent.com/assets/1482297/13767235/d3f350f6-eaab-11e5-9045-ba38b9d74370.gif)\n\n### Aiming + Ciruclular move\n\n```C#\nvar vel = default(IEnumerator\u003cVector2\u003e);\nvar m = g.MotionP();\nm.AimSpringAt(p, 0.1f, 0.45f).Capture(out vel);\nm.Circular(vel.Magnitude().Amplify(2f), 2f);\n```\n\n![aim circular](https://cloud.githubusercontent.com/assets/1482297/13769818/e2d947c8-eac5-11e5-851f-095265aeb32b.gif)\n\n### Scaling by velocity\n\n```C#\nvar vel = default(IEnumerator\u003cVector2\u003e);\ng.MotionP().AimExpoAt(p, 0.15f).Capture(out vel);\ng.MotionS().AimSpringAt(vel.Magnitude().Amplify(0.075f).Offset(1f).ToVector2(), 0.12f, 0.7f);\n```\n\n![scaling_by_velocity](https://cloud.githubusercontent.com/assets/1482297/13769616/5fab509a-eac4-11e5-9b41-5c83567f1e97.gif)\n\n### Circular + Noise\n\n```C#\ng.MotionP().Circular(83f, 0.25f).Fbm(new Vector2(2f, 3f), 3).Amplify(6f);\n```\n\n![circular noise](https://cloud.githubusercontent.com/assets/1482297/13773205/75218414-eadb-11e5-9da0-583d0deea74c.gif)\n\n### Follow move\n\n```C#\nFunc\u003cVector2\u003e p = () =\u003e GetMousePosition();\ng.MotionP().AimCriticalDampingAt(p, 0.8f);\n```\n\n![follow](https://cloud.githubusercontent.com/assets/1482297/13770186/ae3889d6-eac8-11e5-93df-98c5a1d0082e.gif)\n\n### Follow + Circular move\n\n```C#\nFunc\u003cVector2\u003e p = () =\u003e GetMousePosition();\ng.MotionP().AimCriticalDampingAt(p, 0.8f).Circular(83f, 1.5f);\n```\n\n![follow circular](https://cloud.githubusercontent.com/assets/1482297/13771198/90db5484-eacf-11e5-932e-798d9905147e.gif)\n\n### Follow + Follow + Follow\n\n```C#\nSystem.Func\u003cVector2\u003e gp = () =\u003e new Vector2(g.transform.localPosition.x, g.transform.localPosition.y);\ng.MotionP().AimCriticalDampingAt(p, 0.8f);\nf1.MotionP().AimCriticalDampingAt(gp, 0.3f).StartDelay(6f).AccelByRatio(new Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f)) * 20f, 0.9f);\nf2.MotionP().AimCriticalDampingAt(gp, 0.2f).StartDelay(9f).AccelByRatio(new Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f)) * 15f, 0.9f);\n```\n\n![follow follow](https://cloud.githubusercontent.com/assets/1482297/13773012/7e0ec5d8-eada-11e5-8d72-6a59e3084cc0.gif)\n\n### Aiming + Noise\n\n```C#\nvar vel = default(IEnumerator\u003cVector2\u003e);\nvar m = g.MotionP();\nm.AimSpringAt(p, 0.1f, 0.45f).Capture(out vel);\nm.Perlin(new Vector2(7f, 11f)).Amplify(vel.Magnitude().Amplify(1.2f));\n```\n\n![aim noise](https://cloud.githubusercontent.com/assets/1482297/13773530/fced7438-eadc-11e5-81f9-e390d8e7fab9.gif)\n\n### Spiral #2\n\n```C#\nfor (var i = 0; i \u003c 12; ++i) {\n\tg = GameObject.Instantiate(prefab);\n\tg.transform.SetParent(prefab.transform.parent);\n\tg.transform.localPosition = Vector3.zero;\n\tg.transform.localScale = Vector3.one;\n\n\tvar angle = 30f * i;\n\tvar radius = Velocity.AccelByRatio(218f, Source.Constant(0.92f)).Offset(83f);\n\tvar speed = Velocity.AccelByRatio(0.75f, Source.Constant(0.94f)).Offset(0.01f);\n\tg.MotionP().Circular(radius, speed).Angle(angle).Fbm(new Vector2(0f, 1f), 3).AmplifyComponents(new Vector2(0f, 0.3f));\n}\n```\n\n![spiral_2](https://cloud.githubusercontent.com/assets/1482297/13800153/b9fa493e-eb69-11e5-97ec-3069291197b3.gif)\n\n## License\n\nCopyright 2016 Oink Games, Inc. and other contributors.\n\nCode licensed under the MIT License: http://opensource.org/licenses/MIT\n","funding_links":[],"categories":["Animation","C\\#","Open Source Repositories","Easing"],"sub_categories":["Animation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeinteractive%2FUrMotion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeinteractive%2FUrMotion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeinteractive%2FUrMotion/lists"}