{"id":13526636,"url":"https://github.com/azoyan/ShakeDetectorLua","last_synced_at":"2025-04-01T07:33:21.611Z","repository":{"id":88510077,"uuid":"172047796","full_name":"azoyan/ShakeDetectorLua","owner":"azoyan","description":"Shake Detector in Lua","archived":false,"fork":false,"pushed_at":"2019-04-16T11:28:34.000Z","size":31,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-02T06:22:29.736Z","etag":null,"topics":["accelerometer","gamedev","lua","mit"],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/azoyan.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-02-22T10:36:38.000Z","updated_at":"2024-07-20T15:43:44.000Z","dependencies_parsed_at":"2024-01-03T04:02:36.111Z","dependency_job_id":null,"html_url":"https://github.com/azoyan/ShakeDetectorLua","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/azoyan%2FShakeDetectorLua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azoyan%2FShakeDetectorLua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azoyan%2FShakeDetectorLua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azoyan%2FShakeDetectorLua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azoyan","download_url":"https://codeload.github.com/azoyan/ShakeDetectorLua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222709906,"owners_count":17026765,"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":["accelerometer","gamedev","lua","mit"],"created_at":"2024-08-01T06:01:32.477Z","updated_at":"2024-11-02T11:31:27.399Z","avatar_url":"https://github.com/azoyan.png","language":"Lua","readme":"# Shake Detector Lua\nIt is porting of [shake.js](https://github.com/alexgibson/shake.js/blob/master/shake.js) library to Lua.\n\nThe module is designed to be compatible with any Lua engine that can get delta-time between update cycles and accelerometer data.\n\nExample of usage with [Love2d](https://love2d.org) (free 2d Game Engine):\n\n**main.lua**\n```Lua\nfunction love.load()\n    shakeDetector = require \"shakeDetector\"\n    local joysticks = love.joystick.getJoysticks()\n    joystick = joysticks[#joysticks]    \nend\n\nfunction love.update(dt)    \n    local x, y, z = joystick:getAxes()\n    shakeDetector:update(dt, x, y, z)\nend\n\nfunction love.draw()\n    love.graphics.print(shakeDetector.count)\nend\n```\n## API\nUpdate shake detector\n\n`update(dt, x, y, z)` arguments: delta-time between update cycles, accelerometer data x-axis, y-axis, z-axis\n\nGet shakes count\n```Lua\nlocal shakesCount = shakeDetector.count\n```\n\nChanging threshold and timeout:\n```Lua\nshakeDetector:reset()         -- reset to defaults (threshold = 0.5, timeout = 0.25)\nshakeDetector:reset(0.6, 0.3) -- set threshold to 0.6 and timeout to 0.3\nshakeDetector:reset(nil, 0.4) -- set threshold to default (0.5) and timeout to 0.4\nshakeDetector:reset(0.2, nil) -- set threshold to 0.2 and timeout to default (0.25)\n```\n","funding_links":[],"categories":["Utilities"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazoyan%2FShakeDetectorLua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazoyan%2FShakeDetectorLua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazoyan%2FShakeDetectorLua/lists"}