{"id":16355987,"url":"https://github.com/timobechtel/minimation","last_synced_at":"2026-05-04T01:34:27.500Z","repository":{"id":117356966,"uuid":"385982870","full_name":"TimoBechtel/Minimation","owner":"TimoBechtel","description":"A mini animation/ task framework for microcontrollers (e.g. ESP32, Arduino, etc.)","archived":false,"fork":false,"pushed_at":"2021-07-14T18:25:56.000Z","size":2,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-06T18:07:42.097Z","etag":null,"topics":["animation","arduino","esp32","esp8266","microcontroller"],"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/TimoBechtel.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-14T15:11:57.000Z","updated_at":"2023-03-07T02:39:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"7fd8dee5-0af6-4c94-8a4a-9464bda7d927","html_url":"https://github.com/TimoBechtel/Minimation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TimoBechtel/Minimation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimoBechtel%2FMinimation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimoBechtel%2FMinimation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimoBechtel%2FMinimation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimoBechtel%2FMinimation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimoBechtel","download_url":"https://codeload.github.com/TimoBechtel/Minimation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimoBechtel%2FMinimation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32591601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"ssl_error","status_checked_at":"2026-05-03T22:09:10.534Z","response_time":103,"last_error":"SSL_read: 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":["animation","arduino","esp32","esp8266","microcontroller"],"created_at":"2024-10-11T01:42:19.553Z","updated_at":"2026-05-04T01:34:27.483Z","avatar_url":"https://github.com/TimoBechtel.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minimation\r\n\r\n## Table of Contents\r\n\r\n- [About](#about)\r\n- [Getting Started](#getting_started)\r\n- [Usage](#usage)\r\n- [Contributing](../CONTRIBUTING.md)\r\n\r\n## About\r\n\r\nI needed a simple way to run multiple actions \"at the same time\" in specific intervals for an ESP32.\r\n\r\nEnter: Minimation. It is a mini animation framework for microcontrollers.\r\nThink a bit like `setInterval` / `setTimeout` in javascript.\r\n\r\n## Usage\r\n\r\n### Include header file\r\n\r\n```c++\r\n#include \"Animation.h\"\r\n```\r\n\r\n### Create a new Animation\r\n\r\n```c++\r\nunsigned int duration = 5000; // in milliseconds\r\nAnimation *blink = new Animation(duration);\r\n```\r\n\r\nOn Arduino, you would create this in a setup function.\r\n\r\n### Call the loop function to advance the animation\r\n\r\nFor Arduino you can run this in the loop function, e.g.:\r\n\r\n```c++\r\nvoid loop() {\r\n  blink-\u003eloop();\r\n}\r\n```\r\n\r\nNow you can define functions that should run on certain events:\r\n\r\n(You can do this wherever in the code, but I recommend not to add callbacks in a loop.)\r\n\r\n### Run a function on start\r\n\r\n```c++\r\nblink-\u003eonStart([]() {\r\n  cout \u003c\u003c \"Started\" \u003c\u003c endl;\r\n});\r\n```\r\n\r\n### Run a function on an interval\r\n\r\n```c++\r\nunsigned int interval = 500; // interval in milliseconds\r\nblink-\u003eonInterval(interval, []() {\r\n  cout \u003c\u003c \"Hello World\" \u003c\u003c endl;\r\n});\r\n```\r\n\r\nSometimes a callback may be skipped because a loop takes longer than the given interval. If this is not what you want, you can set the `lazy` flag to `false`. Then callbacks are stacked and run in a batch on the next loop.\r\n\r\n```c++\r\nblink-\u003eonInterval(10, []() {\r\n  cout \u003c\u003c \"Hello World\" \u003c\u003c endl;\r\n}, false);\r\n```\r\n\r\n### Run a function on every loop\r\n\r\n```c++\r\nblink-\u003eonLoop([](float progress) {\r\n  cout \u003c\u003c progress \u003c\u003c endl;\r\n});\r\n```\r\n\r\n### Run a function when the animation has finished\r\n\r\n```c++\r\nblink-\u003eonDone([]() {\r\n  cout \u003c\u003c \"Stopped\" \u003c\u003c endl;\r\n});\r\n```\r\n\r\n### Make sure to start the animation\r\n\r\nYou can also use this function to reset the animation.\r\n\r\n```c++\r\nblink-\u003estart();\r\n```\r\n\r\n## Full example\r\n\r\nExample with the arduino framework\r\n\r\n```c++\r\n#include \u003cArduino.h\u003e\r\n#include \"Animation.h\"\r\n\r\nAnimation *animation;\r\n\r\nvoid setup()\r\n{\r\n  Serial.begin(9600);\r\n  animation = new Animation(5000);\r\n  animation-\u003eonStart([]() {\r\n    Serial.println(\"Started animation\");\r\n  });\r\n  animation-\u003eonInterval(1000, []() {\r\n    Serial.println(\"1 second elapsed\");\r\n  });\r\n  animation-\u003eonDone([]() {\r\n    Serial.println(\"Animation finished\");\r\n    animation-\u003estart(); // restart animation\r\n  });\r\n  animation-\u003estart();\r\n}\r\n\r\nvoid loop()\r\n{\r\n  animation-\u003eloop();\r\n}\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimobechtel%2Fminimation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimobechtel%2Fminimation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimobechtel%2Fminimation/lists"}