{"id":16695906,"url":"https://github.com/jasonchen1982/jcc2d","last_synced_at":"2025-03-17T00:33:44.575Z","repository":{"id":9317267,"uuid":"61592961","full_name":"jasonChen1982/jcc2d","owner":"jasonChen1982","description":"A lightweight canvas2d-render \u0026 built-in an awesome animator with timeline manager","archived":false,"fork":false,"pushed_at":"2022-12-06T17:40:40.000Z","size":37755,"stargazers_count":53,"open_issues_count":13,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-13T21:56:35.152Z","etag":null,"topics":["ae","after-effects","animation","bodymovin","canvas"],"latest_commit_sha":null,"homepage":"https://jasonchen1982.github.io/jcc2d/","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/jasonChen1982.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-06-21T01:38:18.000Z","updated_at":"2023-09-28T03:25:00.000Z","dependencies_parsed_at":"2023-01-11T20:11:56.324Z","dependency_job_id":null,"html_url":"https://github.com/jasonChen1982/jcc2d","commit_stats":null,"previous_names":[],"tags_count":106,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonChen1982%2Fjcc2d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonChen1982%2Fjcc2d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonChen1982%2Fjcc2d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonChen1982%2Fjcc2d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonChen1982","download_url":"https://codeload.github.com/jasonChen1982/jcc2d/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243835942,"owners_count":20355611,"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":["ae","after-effects","animation","bodymovin","canvas"],"created_at":"2024-10-12T17:08:58.801Z","updated_at":"2025-03-17T00:33:39.565Z","avatar_url":"https://github.com/jasonChen1982.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jcc2d\n[![Build Status](https://img.shields.io/travis/jasonChen1982/jcc2d.svg?style=flat-square)](https://travis-ci.org/jasonChen1982/jcc2d)\n[![npm](https://img.shields.io/npm/v/jcc2d.svg?style=flat-square)](https://jasonchen1982.github.io/jcc2d/)\n[![javascript style guide](https://img.shields.io/badge/code_style-google-brightgreen.svg)](https://google.github.io/styleguide/jsguide.html)\n[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)\n\n\nA canvas 2d renderer \u0026 An awesome animator\n---\n\u003cp\u003e\u003ca target=\"_blank\" href=\"https://jasonchen1982.github.io/jcc2d/\" title=\"jcc2d main page\"\u003e\u003cimg src=\"https://jasonchen1982.github.io/jcc2d/static/images/main-page.png\" width=\"100%\" alt=\"main page\" title=\"main page\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n## Show case\n* [refactor usopen-sessions main page][jcc2d]\n* [particle effect][particle]\n* [3D pictures cloud][zIndex-demo]\n* [multi-segment animation][combine]\n* [sprites movieclip][movieclip]\n* [blur mask high performance filter][blur-mask]\n* [skeleton draw by graphics][skeleton-graphics]\n* [skeleton draw by sprite][skeleton-sprite]\n* [check eventer pointer exact polygon][event-exact-polygon]\n* [varied timingfunction supported][varied-timingfunction]\n* [path motion animation][path-motion]\n* [after effect export][ae-export]\n\n## Introduction\n[main page][jcc2d]\n\n`jcc2d` is a lightweight canvas2d-render engine and built-in an awesome animator with timeline manager. obviously, `jcc2d` support event system by default.\n\n`jcc2d` built-in support [bodymovin][bodymovin] keyframes data, which use [bodymovin add-on][bodymovin-add-on] to exporting `keyframes data` from [after effect][ae], and `jcc2d` can parse the `keyframes data` to [jcc2d][jcc2d] keyFrames animation, just like following:\n\n```js\n// parser all animation layers\nconst ani = new JC.ParserAnimation({\n  keyframes: data,\n  // fr: 30, // frame rate\n  // prefix: '', // assets url prefix\n  // infinite: true, // infinite loop\n  // alternate: true, // alternate\n  onUpdate() {},\n  onComplete() {\n    console.log(this.element);\n  },\n});\n\n// or you can just parser a single animation layer\nconst coin = new JC.Sprite({\n  texture: new JC.Texture('/path/coin.png'),\n});\ncoin.keyFrames({\n  ks: data.layers[0], // bodymovin keyframes data\n  fr: 30, // overwrite frame rate\n  // infinite: true, // infinite loop\n  // alternate: true, // alternate, just like yoyo\n  onUpdate() {},\n  onComplete() {\n    console.log(this.element);\n  },\n});\n```\n\n[view demo][ae-export]\n\n## Feature\n\n`jcc2d` Include `Stage` `Sprite` `Graphics` `Container` `BlurFilter` `TextFace` and so on.\n\nEvery display instance can easy start an animation and attach a timeline, like following:\n\n```javascript\nconst ball = new JC.Sprite({\n    texture: new JC.Texture('/path/xx.png'),\n});\nconst timeline = ball.animate({\n  from: {x: 100}, // start pose, optional\n  to: {x: 200}, // target pose\n  ease: JC.Tween.Bounce.Out, // set a timingfunction\n  repeats: 10, // repeat sometimes\n  delay: 1000, // delay a moment every repeat\n  wait: 1000, // wait a moment to start\n  infinite: true, // want infinite repeats?\n  alternate: true, // repeats with alternate\n  duration: 1000, // duration\n  onUpdate: function(state,rate){}, // onUpdate callback\n  onComplete: function(){ console.log('end'); } // onComplete callback\n});\ntimeline.pause(); // pause animation progress\ntimeline.restart(); // restart animation progress, use with pause\ntimeline.stop(); // stop animation to end, will trigger onComplete callback\ntimeline.cancle(); // cancle animation right now, will not trigger onComplete callback\ntimeline.timeScale = 0.5; // set timeScale, get a Slow motion，just like speed * 0.5\n```\n\n## Display animation property\n\n|                   type                   |         property          |\n| :--------------------------------------: | :-----------------------: |\n|       display instance scale value       | `scale` `scaleX` `scaleY` |\n|         display instance origin          |    `originX` `originY`    |\n|          display instance pivot          |     `pivotX` ` pivotY`    |\n|       display instance skew value        |      `skewX` `skewY`      |\n|    display instance rotation with CCW    |        `rotation`         |\n| display instance coordinate axis position |         `x` `y`          |\n|      display instance opacity alpha      |          `alpha`          |\n\n\n\n\n## Quick Start\n\n`jcc2d` was so easy to use, you just need `new` a `Stage` instance and appoint a `canvas` dom, then you can add every display object into `stage`.\n\n```js\nconst stage = new JC.Stage({\n  dom: 'canvas-stage',\n  resolution: 1, // was normal\n});\nconst coin = new JC.Sprite({\n  texture: new JC.Texture('/path/coin.png'),\n});\nstage.adds(coin);\nstage.startEngine(); // the coin would be render\n```\n\n`jcc2d` built-in support `timeline` animation , you can start multiple animation. let's use `coin` to show.\n\n```js\n/* start a animate */\ncoin.animate({\n  from: { x: 100, rotation: 0 },\n  to: { x: 300, rotation: 360 },\n  ...       // other options\n});\n\n/* start a motion */\ncoin.motion({\n  path: new JC.BezierCurve([...]), // coin will move along with this path\n  ...       // other options\n});\n\n/* start a runners */\ncoin.runners({             // combination multiple animation and run one by one\n  runners: [\n    {from: {}, to: {}, ease: JC.Tween.Back.In, ...},\n    {path: new JC.BezierCurve([...]), ease: JC.Tween.Ease.Bezier(0, 0, 1, 1), ...},\n    {to: {}, ease: JC.Tween.Back.Out, ...},\n  ],\n  ...       // other options\n});\n```\n\nwould like to know more information please look in [documentation][documentation], or quick start a living edit in web [runing man][quick-start].\n\n## Documentation\n\n`jcc2d` source code was used `ES6 Modules` and build to `UMD` bundle by `rollup`. so `jcc2d` can support `tree-shaking` seamless.\n\n```js\n// import all over the modules\nimport * as JC from 'jcc2d';\n\n// import modules which you need, allow tree-shaking\nimport { Stage, Sprite, Graphics } from 'jcc2d';\n```\n\nand if you just want use `UMD` bundle, you can use `require` method\n\n```js\n// require jcc2d\nconst JC = require('jcc2d');\n\n// require a lightweight jcc2d\nconst JC = require('jcc2d/build/jcc2d.light.js');\n```\n\n[documentation][documentation]\n\n## Examples\n[examples][examples]\n\n## Changelog\n\n[changelog][change-log]\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n\n[jcc2d]:https://jasonchen1982.github.io/jcc2d/ \"jcc2d main page\"\n[documentation]:https://jasonchen1982.github.io/jcc2d/docs/ \"jcc2d documention page\"\n[examples]:https://jasonchen1982.github.io/jcc2d/examples/ \"jcc2d examples page\"\n[particle]:https://jasonchen1982.github.io/jcc2d/examples/ \"Particle effect\"\n[zIndex-demo]:https://jasonchen1982.github.io/jcc2d/examples/#demo_zIndex_bitmap \"3D pictures cloud used zIndex\"\n[combine]:https://jasonchen1982.github.io/jcc2d/examples/#demo_animation_combine \"multi-segment animation\"\n[movieclip]:https://jasonchen1982.github.io/jcc2d/examples/#demo_frames_sprite \"sprites movieclip\"\n[blur-mask]:https://jasonchen1982.github.io/jcc2d/examples/#demo_filter_blur \"blur mask high performance filter\"\n[skeleton-graphics]:https://jasonchen1982.github.io/jcc2d/examples/#demo_skeleton_graphics \"skeleton draw by graphics\"\n[skeleton-sprite]:https://jasonchen1982.github.io/jcc2d/examples/#demo_skeleton_sprite \"skeleton draw by sprite\"\n[event-exact-polygon]:https://jasonchen1982.github.io/jcc2d/examples/#demo_interactive_boundPrecise \"check eventer pointer exact polygon\"\n[varied-timingfunction]:https://jasonchen1982.github.io/jcc2d/examples/#demo_timingfunction_allInOne \"varied timingfunction supported\"\n[path-motion]:https://jasonchen1982.github.io/jcc2d/examples/#demo_animation_motion \"path motion animation\"\n[quick-start]:http://codepen.io/JasonChen1982/pen/grJzmz?editors=0010 \"quick start demo\"\n[ae-export]:https://jasonchen1982.github.io/jcc2d/examples/#demo_animation_ae \"after effect export\"\n[bodymovin]:https://github.com/bodymovin/bodymovin \"bodymovin github\"\n[bodymovin-add-on]:https://creative.adobe.com/addons/products/12557#.WPRdl1N94o8 \"bodymovin add-on\"\n[change-log]:https://github.com/jasonChen1982/jcc2d/blob/master/Changelog.md \"change log\"\n[ae]:http://www.adobe.com/cn/products/aftereffects.html \"ae\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonchen1982%2Fjcc2d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonchen1982%2Fjcc2d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonchen1982%2Fjcc2d/lists"}