{"id":13857810,"url":"https://github.com/RinteRface/waypointer","last_synced_at":"2025-07-13T22:31:16.210Z","repository":{"id":85367284,"uuid":"177327500","full_name":"RinteRface/waypointer","owner":"RinteRface","description":"Waypoints \u0026 Animations for Shiny","archived":false,"fork":false,"pushed_at":"2020-01-30T21:06:43.000Z","size":37,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-29T21:39:33.827Z","etag":null,"topics":["r","rstats","shiny"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RinteRface.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,"dei":null}},"created_at":"2019-03-23T18:44:58.000Z","updated_at":"2023-03-17T07:21:48.000Z","dependencies_parsed_at":"2024-02-09T01:57:32.967Z","dependency_job_id":"f140c6ea-d9df-4bb4-99c0-ca50138cb87e","html_url":"https://github.com/RinteRface/waypointer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RinteRface/waypointer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RinteRface%2Fwaypointer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RinteRface%2Fwaypointer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RinteRface%2Fwaypointer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RinteRface%2Fwaypointer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RinteRface","download_url":"https://codeload.github.com/RinteRface/waypointer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RinteRface%2Fwaypointer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265218201,"owners_count":23729496,"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":["r","rstats","shiny"],"created_at":"2024-08-05T03:01:47.620Z","updated_at":"2025-07-13T22:31:15.943Z","avatar_url":"https://github.com/RinteRface.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/RinteRface/waypointer.svg?branch=master)](https://travis-ci.org/RinteRface/waypointer)\n\n# waypointer\n\nSimple animated waypoints for shiny.\n\n- [waypointer](#waypointer)\n  - [Installation](#installation)\n  - [Guide](#guide)\n  - [Methods](#methods)\n  - [Arguments](#arguments)\n  - [Examples](#examples)\n\n## Installation\n\n``` r\n# install.packages(\"remotes\")\nremotes::install_github(\"RinteRface/waypointer\")\n```\n\n## Guide\n\n1. Place `use_waypointer()` anywhere in your ui.\n2. Create a waypoint with `new` method, giving it _at least_ the id of the element to watch.\n3. Start the waypoint with the `start` method.\n4. Watch the waypoint with the `get_direction` method.\n\n## Methods\n\nNote that the `get_*` family of methods return character vectors and not the waypoint, unlike others.\n\n1. `new` - create a waypoint.\n2. `start` - start watching the waypoint.\n3. `enable` - enable the waypoint (enabled by default)\n4. `disable` - disable the waypoint.\n5. `destroy` - destroy the waypoint.\n6. `animate` - animate the waypoint, see `?.init` for the full list.\n7. `get_direction` - returns the direction in which the user scrolls passed the waypoint (`up` or `down`) \n8. `get_triggered` - returns `TRUE` if the waypoint has been triggered previously, and `FALSE` otherwise.\n\n## Arguments\n\nAll the arguments are passed to the `new` method, at the expection of `animation` which can _also_ be passed to the `animate` method.\n\n- `dom_id` - Id of element to watch. \n- `animate` - Set to `TRUE` to automatically animate when the waypoint is triggered.\n- `animation` - Name of animation, defaults to `shake`.\n- `offset` - By default, the handler is triggered when the top of an element hits the top of the viewport. The offset changes the location of that trigger point.\n- `horizontal` - When horizontal is set to true, all of this changes to the horizontal axis and the `get_direction` method will return `left` or `right`.\n- `id` - Id of waypoint. When used you can replace the `get_*` family of methods to traditional shiny inputs, e.g. if the `id` of the waypoint is set to `myInput` then you can obtain the `direction` in your shiny server with `input$myInput_direction`.\n\n## Examples\n\nCreate a waypoint with `waypoint$new()`  passing _at least_ the id of the element to observe as `dom_id` (first argument). Note that technically the `get_*` family of methods are `input`s, you therefore may need to use `shiny::req` where needed (see below).\n\n``` r\nlibrary(shiny)\nlibrary(waypointer)\n\nui \u003c- fluidPage(\n\tuse_waypointer(),\n\tdiv(\n\t\th1(\"Scroll down\"), \n\t\tstyle = \"min-height:90vh\"\n\t),\n\tverbatimTextOutput(\"result\"),\n\tplotOutput(\"plot\"),\n\tdiv(style = \"min-height:90vh\")\n)\n\nserver \u003c- function(input, output, session) {\n\n\tw \u003c- Waypoint$\n\t\tnew(\"plot\", offset = \"20%\")$\n\t\tstart()\n\n\toutput$result \u003c- renderPrint({\n\t\tw$get_direction()\n\t})\n\n\toutput$plot \u003c- renderPlot({\n\n\t\treq(w$going_down())\n\n\t\t# show if scrolling down\n\t\tif(w$going_down())\n\t\t\thist(runif(100))\n\t})\n\n}\n\nshinyApp(ui, server)\n```\n\nNote that in the above we use the `get_direction` method to get the direction in which the user is scrolling, _relative to_ the given `dom_id`. However if you provide an `id` when initialising the waypoint then you can use the traditional way of accessing callbacks: `input$id_direction`. The example below would then look like:\n\n``` r\nlibrary(shiny)\nlibrary(waypointer)\n\nui \u003c- fluidPage(\n\tuse_waypointer(),\n\tdiv(\n\t\th1(\"Scroll down\"), \n\t\tstyle = \"min-height:90vh\"\n\t),\n\tverbatimTextOutput(\"result\"),\n\tplotOutput(\"plot\"),\n\tdiv(style = \"min-height:90vh\")\n)\n\nserver \u003c- function(input, output, session) {\n\n\tw \u003c- Waypoint$\n\t\tnew(\"plot\", offset = \"20%\", id = \"myWaypoint\")$\n\t\tstart()\n\n\toutput$result \u003c- renderPrint({\n\t\tw$get_direction()\n\t})\n\n\toutput$plot \u003c- renderPlot({\n\n\t\treq(input$myWaypoint_direction)\n\n\t\t# show if scrolling down\n\t\tif(input$myWaypoint_direction == \"down\")\n\t\t\thist(runif(100))\n\t})\n\n}\n\nshinyApp(ui, server)\n```\n\nYou can also animate the waypoint, setting `animate` to `TRUE` will automatically animate the waypoint when is triggered.\n\n```r\nlibrary(shiny)\nlibrary(waypointer)\n\nui \u003c- fluidPage(\n\tuse_waypointer(),\n\tdiv(\n\t\t\"Scroll!\", \n\t\tstyle = \"min-height:90vh\"\n\t),\n\tverbatimTextOutput(\"result\"),\n\tplotOutput(\"plot\"),\n\tdiv(style = \"min-height:90vh\")\n)\n\nserver \u003c- function(input, output, session) {\n\n\tw \u003c- Waypoint$\n\t\tnew(\n      \"plot\", \n      offset = \"20%\", \n      animate = TRUE, \n      id = \"waypoint\"\n    )$\n\t\tstart()\n\n\toutput$result \u003c- renderPrint({\n\t\tinput$waypoint_direction\n\t})\n\n\toutput$plot \u003c- renderPlot({\n\n\t\treq(input$waypoint_direction)\n\n\t\tif(input$waypoint_direction == \"down\")\n\t\t\thist(runif(100))\n\t})\n\n}\n\nshinyApp(ui, server)\n```\n\nOtherwise you may use the `animate` method to manually trigger the animation.\n\n```r\nlibrary(shiny)\nlibrary(waypointer)\n\nui \u003c- fluidPage(\n\tuse_waypointer(),\n\tdiv(\n\t\t\"Scroll!\", \n\t\tstyle = \"min-height:90vh\"\n\t),\n\tverbatimTextOutput(\"result\"),\n\tplotOutput(\"plot\"),\n\tdiv(style = \"min-height:90vh\")\n)\n\nserver \u003c- function(input, output, session) {\n\n\tw \u003c- Waypoint$\n\t\tnew(\"plot\", offset = \"20%\")$\n\t\tstart()\n\n\toutput$result \u003c- renderPrint({\n\t\tw$get_direction()\n\t})\n\n\toutput$plot \u003c- renderPlot({\n\n\t\treq(w$get_direction())\n\n\t\thist(runif(100))\n    w$animate()\n\t})\n\n}\n\nshinyApp(ui, server)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRinteRface%2Fwaypointer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRinteRface%2Fwaypointer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRinteRface%2Fwaypointer/lists"}