{"id":21524872,"url":"https://github.com/degjs/numericycle","last_synced_at":"2025-10-14T19:07:10.833Z","repository":{"id":4240281,"uuid":"52469352","full_name":"DEGJS/numericycle","owner":"DEGJS","description":"An ES6 module for animating between two numbers","archived":false,"fork":false,"pushed_at":"2023-01-03T22:13:33.000Z","size":4011,"stargazers_count":0,"open_issues_count":12,"forks_count":0,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-08T10:01:54.619Z","etag":null,"topics":["animation-css"],"latest_commit_sha":null,"homepage":null,"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/DEGJS.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}},"created_at":"2016-02-24T19:40:28.000Z","updated_at":"2021-01-25T21:38:40.000Z","dependencies_parsed_at":"2023-01-13T13:01:33.411Z","dependency_job_id":null,"html_url":"https://github.com/DEGJS/numericycle","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2Fnumericycle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2Fnumericycle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2Fnumericycle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2Fnumericycle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DEGJS","download_url":"https://codeload.github.com/DEGJS/numericycle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244085010,"owners_count":20395523,"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-css"],"created_at":"2024-11-24T01:30:09.896Z","updated_at":"2025-10-14T19:07:05.803Z","avatar_url":"https://github.com/DEGJS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# numericycle\n![Run Tests](https://github.com/DEGJS/numericycle/workflows/Run%20Tests/badge.svg)\n\nNumericycle is a Javascript module that animates a number from one value to another. It takes advantage of [Window.requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) to produce smooth animations. Numericycle can be easily configured for animation duration, easing, and number display format.\n\n## Install\nNumericycle is an ES6 module. Consequently, you may need a transpiler ([Babel](https://babeljs.io) is a nice one) to compile numericycle into compatible Javascript for your runtime environment.\n\nIf you're using NPM, you can install numericycle with the following command:\n\n```\n$ npm install @degjs/numericycle\n```\n\n## Usage\nImport numericycle, create a new instance of it, and get cyclin'.\n```js\nimport numericycle from '@degjs/numericycle';\n\nconst element = document.querySelector('div');\n\nconst instance = numericycle(element);\n\ninstance.cycle({\n\tinitialValue: 1,\n\tfinalValue: 10,\n\tduration: 2000,\n\teasing: 'easeOut',\n\tformat: '0,0'\n});\n\n```\n\n\n## Parameters\n\n### element\nType: `HTMLElement`   \nThe HTML element that contains or will contain the number to be animated. \n\n## Methods\n\n### .cycle(options)\nParameters: `options`   \nAnimates the content of the HTML element using the values specified in the `options` parameter:\n\n#### options.initialValue\nType: `Number`   \nThe initial value of the number. If this option is omitted, numericycle will attempt to convert the content of the HTML element to a number.\n\n#### options.finalValue\nType: `Number`   \nThe final value of the number. This option is required.\n\n#### options.duration\nType: `Number` Default: `2000`   \nThe duration (in milliseconds) of the animation.\n\n#### options.easing\nType: `String` Default: `easeOut`   \nThe type of easing that the animation should use. Valid options are `linear`, `easeIn`, `easeOut`, and `easeInOut`.\n\n#### options.format\nType: `String` Default: `0,0`   \nThe display format for the number. Valid options are `0,0` (thousands separator included) and `0` (thousands separator omitted)\n\n## Browser Support\nNumericycle works on modern browsers. To support legacy browsers, you'll need to include polyfills for the following Javascript APIs:\n\n+ [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)\n+ [Window.requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegjs%2Fnumericycle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdegjs%2Fnumericycle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegjs%2Fnumericycle/lists"}