├── .Rbuildignore
├── .github
└── FUNDING.yml
├── .gitignore
├── .travis.yml
├── CODE_OF_CONDUCT.md
├── CRAN-RELEASE
├── DESCRIPTION
├── LICENSE
├── LICENSE.md
├── NAMESPACE
├── NEWS.md
├── R
├── scroll_reveal.R
└── scrollreveal_dep.R
├── README.Rmd
├── README.md
├── cran-comments.md
├── inst
└── scrollreveal
│ └── scrollreveal.min.js
├── man
├── figures
│ ├── exampleapp.gif
│ └── exampleapp2.gif
├── html-dependencies.Rd
└── scroll_reveal.Rd
├── scrollrevealR.Rproj
└── vignettes
├── .gitignore
└── Introduction.Rmd
/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^.*\.Rproj$
2 | ^\.Rproj\.user$
3 | ^LICENSE\.md$
4 | ^README\.Rmd$
5 | ^cran-comments\.md$
6 | ^CRAN-RELEASE$
7 | ^CODE_OF_CONDUCT\.md$
8 | ^\.travis\.yml$
9 | ^man/figures/exampleapp\.gif$
10 | ^man/figures/exampleapp2\.gif$
11 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | custom: ['https://www.buymeacoffee.com/Fodil']
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .RData
4 | .Ruserdata
5 | inst/doc
6 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # R for travis: see documentation at https://docs.travis-ci.com/user/languages/r
2 |
3 | language: R
4 | cache: packages
5 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socio-economic status,
9 | nationality, personal appearance, race, religion, or sexual identity and
10 | orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | * Demonstrating empathy and kindness toward other people
21 | * Being respectful of differing opinions, viewpoints, and experiences
22 | * Giving and gracefully accepting constructive feedback
23 | * Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | * Focusing on what is best not just for us as individuals, but for the overall
26 | community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | * The use of sexualized language or imagery, and sexual attention or
31 | advances of any kind
32 | * Trolling, insulting or derogatory comments, and personal or political attacks
33 | * Public or private harassment
34 | * Publishing others' private information, such as a physical or email
35 | address, without their explicit permission
36 | * Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards
42 | of acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies
54 | when an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail
56 | address, posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leaders responsible for enforcement at [INSERT CONTACT
63 | METHOD]. All complaints will be reviewed and investigated promptly and fairly.
64 |
65 | All community leaders are obligated to respect the privacy and security of the
66 | reporter of any incident.
67 |
68 | ## Enforcement Guidelines
69 |
70 | Community leaders will follow these Community Impact Guidelines in determining
71 | the consequences for any action they deem in violation of this Code of Conduct:
72 |
73 | ### 1. Correction
74 |
75 | **Community Impact**: Use of inappropriate language or other behavior deemed
76 | unprofessional or unwelcome in the community.
77 |
78 | **Consequence**: A private, written warning from community leaders, providing
79 | clarity around the nature of the violation and an explanation of why the
80 | behavior was inappropriate. A public apology may be requested.
81 |
82 | ### 2. Warning
83 |
84 | **Community Impact**: A violation through a single incident or series of
85 | actions.
86 |
87 | **Consequence**: A warning with consequences for continued behavior. No
88 | interaction with the people involved, including unsolicited interaction with
89 | those enforcing the Code of Conduct, for a specified period of time. This
90 | includes avoiding interactions in community spaces as well as external channels
91 | like social media. Violating these terms may lead to a temporary or permanent
92 | ban.
93 |
94 | ### 3. Temporary Ban
95 |
96 | **Community Impact**: A serious violation of community standards, including
97 | sustained inappropriate behavior.
98 |
99 | **Consequence**: A temporary ban from any sort of interaction or public
100 | communication with the community for a specified period of time. No public or
101 | private interaction with the people involved, including unsolicited interaction
102 | with those enforcing the Code of Conduct, is allowed during this period.
103 | Violating these terms may lead to a permanent ban.
104 |
105 | ### 4. Permanent Ban
106 |
107 | **Community Impact**: Demonstrating a pattern of violation of community
108 | standards, including sustained inappropriate behavior, harassment of an
109 | individual, or aggression toward or disparagement of classes of individuals.
110 |
111 | **Consequence**: A permanent ban from any sort of public interaction within the
112 | community.
113 |
114 | ## Attribution
115 |
116 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117 | version 2.0,
118 | available at https://www.contributor-covenant.org/version/2/0/
119 | code_of_conduct.html.
120 |
121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct
122 | enforcement ladder](https://github.com/mozilla/diversity).
123 |
124 | [homepage]: https://www.contributor-covenant.org
125 |
126 | For answers to common questions about this code of conduct, see the FAQ at
127 | https://www.contributor-covenant.org/faq. Translations are available at https://
128 | www.contributor-covenant.org/translations.
129 |
--------------------------------------------------------------------------------
/CRAN-RELEASE:
--------------------------------------------------------------------------------
1 | This package was submitted to CRAN on 2020-10-14.
2 | Once it is accepted, delete this file and tag the release (commit 4059509).
3 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: scrollrevealR
2 | Type: Package
3 | Title: Animate 'shiny' Elements when They Scroll into View using the 'scrollrevealjs' Library
4 | Version: 0.2.0
5 | Authors@R: c(
6 | person("Mohamed El Fodil", "Ihaddaden", email = "ihaddaden.fodeil@gmail.com", role = c("aut", "cre")),
7 | person("Julian", "Lloyd", role = c("ctb", "cph"), comment = "scrollreveal.js library developer"))
8 | Description: Allows the user to animate 'shiny' elements when scrolling to view them.
9 | The animations are activated using the 'scrollrevealjs' library. See for more information.
10 | License: MIT + file LICENSE
11 | Encoding: UTF-8
12 | LazyData: true
13 | URL: https://github.com/feddelegrand7/scrollrevealR
14 | BugReports: https://github.com/feddelegrand7/scrollrevealR/issues
15 | Imports:
16 | htmltools,
17 | glue
18 | Suggests:
19 | knitr,
20 | rmarkdown
21 | VignetteBuilder: knitr
22 | RoxygenNote: 7.1.1
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | YEAR: 2020
2 | COPYRIGHT HOLDER: Mohamed El Fodil Ihaddaden, Julian Lloyd
3 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The scrollrevealR package is distributed under MIT License.
2 |
3 | The scrollrevealR package relies on the scrollreveal.js library which is distributed under GPL-3 (General Public License 3.0) for compatible open source projects and non-commercial use.
4 |
5 |
6 | # MIT License
7 |
8 | Copyright (c) 2020 Mohamed El Fodil Ihaddaden, Julian Lloyd
9 |
10 | Permission is hereby granted, free of charge, to any person obtaining a copy
11 | of this software and associated documentation files (the "Software"), to deal
12 | in the Software without restriction, including without limitation the rights
13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 | copies of the Software, and to permit persons to whom the Software is
15 | furnished to do so, subject to the following conditions:
16 |
17 | The above copyright notice and this permission notice shall be included in all
18 | copies or substantial portions of the Software.
19 |
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 | SOFTWARE.
27 |
28 |
29 | # scrollreveal.js
30 |
31 |
32 | GNU GENERAL PUBLIC LICENSE
33 | Version 3, 29 June 2007
34 |
35 | Copyright (C) 2007 Free Software Foundation, Inc.
36 | Everyone is permitted to copy and distribute verbatim copies
37 | of this license document, but changing it is not allowed.
38 |
39 | Preamble
40 |
41 | The GNU General Public License is a free, copyleft license for
42 | software and other kinds of works.
43 |
44 | The licenses for most software and other practical works are designed
45 | to take away your freedom to share and change the works. By contrast,
46 | the GNU General Public License is intended to guarantee your freedom to
47 | share and change all versions of a program--to make sure it remains free
48 | software for all its users. We, the Free Software Foundation, use the
49 | GNU General Public License for most of our software; it applies also to
50 | any other work released this way by its authors. You can apply it to
51 | your programs, too.
52 |
53 | When we speak of free software, we are referring to freedom, not
54 | price. Our General Public Licenses are designed to make sure that you
55 | have the freedom to distribute copies of free software (and charge for
56 | them if you wish), that you receive source code or can get it if you
57 | want it, that you can change the software or use pieces of it in new
58 | free programs, and that you know you can do these things.
59 |
60 | To protect your rights, we need to prevent others from denying you
61 | these rights or asking you to surrender the rights. Therefore, you have
62 | certain responsibilities if you distribute copies of the software, or if
63 | you modify it: responsibilities to respect the freedom of others.
64 |
65 | For example, if you distribute copies of such a program, whether
66 | gratis or for a fee, you must pass on to the recipients the same
67 | freedoms that you received. You must make sure that they, too, receive
68 | or can get the source code. And you must show them these terms so they
69 | know their rights.
70 |
71 | Developers that use the GNU GPL protect your rights with two steps:
72 | (1) assert copyright on the software, and (2) offer you this License
73 | giving you legal permission to copy, distribute and/or modify it.
74 |
75 | For the developers' and authors' protection, the GPL clearly explains
76 | that there is no warranty for this free software. For both users' and
77 | authors' sake, the GPL requires that modified versions be marked as
78 | changed, so that their problems will not be attributed erroneously to
79 | authors of previous versions.
80 |
81 | Some devices are designed to deny users access to install or run
82 | modified versions of the software inside them, although the manufacturer
83 | can do so. This is fundamentally incompatible with the aim of
84 | protecting users' freedom to change the software. The systematic
85 | pattern of such abuse occurs in the area of products for individuals to
86 | use, which is precisely where it is most unacceptable. Therefore, we
87 | have designed this version of the GPL to prohibit the practice for those
88 | products. If such problems arise substantially in other domains, we
89 | stand ready to extend this provision to those domains in future versions
90 | of the GPL, as needed to protect the freedom of users.
91 |
92 | Finally, every program is threatened constantly by software patents.
93 | States should not allow patents to restrict development and use of
94 | software on general-purpose computers, but in those that do, we wish to
95 | avoid the special danger that patents applied to a free program could
96 | make it effectively proprietary. To prevent this, the GPL assures that
97 | patents cannot be used to render the program non-free.
98 |
99 | The precise terms and conditions for copying, distribution and
100 | modification follow.
101 |
102 | TERMS AND CONDITIONS
103 |
104 | 0. Definitions.
105 |
106 | "This License" refers to version 3 of the GNU General Public License.
107 |
108 | "Copyright" also means copyright-like laws that apply to other kinds of
109 | works, such as semiconductor masks.
110 |
111 | "The Program" refers to any copyrightable work licensed under this
112 | License. Each licensee is addressed as "you". "Licensees" and
113 | "recipients" may be individuals or organizations.
114 |
115 | To "modify" a work means to copy from or adapt all or part of the work
116 | in a fashion requiring copyright permission, other than the making of an
117 | exact copy. The resulting work is called a "modified version" of the
118 | earlier work or a work "based on" the earlier work.
119 |
120 | A "covered work" means either the unmodified Program or a work based
121 | on the Program.
122 |
123 | To "propagate" a work means to do anything with it that, without
124 | permission, would make you directly or secondarily liable for
125 | infringement under applicable copyright law, except executing it on a
126 | computer or modifying a private copy. Propagation includes copying,
127 | distribution (with or without modification), making available to the
128 | public, and in some countries other activities as well.
129 |
130 | To "convey" a work means any kind of propagation that enables other
131 | parties to make or receive copies. Mere interaction with a user through
132 | a computer network, with no transfer of a copy, is not conveying.
133 |
134 | An interactive user interface displays "Appropriate Legal Notices"
135 | to the extent that it includes a convenient and prominently visible
136 | feature that (1) displays an appropriate copyright notice, and (2)
137 | tells the user that there is no warranty for the work (except to the
138 | extent that warranties are provided), that licensees may convey the
139 | work under this License, and how to view a copy of this License. If
140 | the interface presents a list of user commands or options, such as a
141 | menu, a prominent item in the list meets this criterion.
142 |
143 | 1. Source Code.
144 |
145 | The "source code" for a work means the preferred form of the work
146 | for making modifications to it. "Object code" means any non-source
147 | form of a work.
148 |
149 | A "Standard Interface" means an interface that either is an official
150 | standard defined by a recognized standards body, or, in the case of
151 | interfaces specified for a particular programming language, one that
152 | is widely used among developers working in that language.
153 |
154 | The "System Libraries" of an executable work include anything, other
155 | than the work as a whole, that (a) is included in the normal form of
156 | packaging a Major Component, but which is not part of that Major
157 | Component, and (b) serves only to enable use of the work with that
158 | Major Component, or to implement a Standard Interface for which an
159 | implementation is available to the public in source code form. A
160 | "Major Component", in this context, means a major essential component
161 | (kernel, window system, and so on) of the specific operating system
162 | (if any) on which the executable work runs, or a compiler used to
163 | produce the work, or an object code interpreter used to run it.
164 |
165 | The "Corresponding Source" for a work in object code form means all
166 | the source code needed to generate, install, and (for an executable
167 | work) run the object code and to modify the work, including scripts to
168 | control those activities. However, it does not include the work's
169 | System Libraries, or general-purpose tools or generally available free
170 | programs which are used unmodified in performing those activities but
171 | which are not part of the work. For example, Corresponding Source
172 | includes interface definition files associated with source files for
173 | the work, and the source code for shared libraries and dynamically
174 | linked subprograms that the work is specifically designed to require,
175 | such as by intimate data communication or control flow between those
176 | subprograms and other parts of the work.
177 |
178 | The Corresponding Source need not include anything that users
179 | can regenerate automatically from other parts of the Corresponding
180 | Source.
181 |
182 | The Corresponding Source for a work in source code form is that
183 | same work.
184 |
185 | 2. Basic Permissions.
186 |
187 | All rights granted under this License are granted for the term of
188 | copyright on the Program, and are irrevocable provided the stated
189 | conditions are met. This License explicitly affirms your unlimited
190 | permission to run the unmodified Program. The output from running a
191 | covered work is covered by this License only if the output, given its
192 | content, constitutes a covered work. This License acknowledges your
193 | rights of fair use or other equivalent, as provided by copyright law.
194 |
195 | You may make, run and propagate covered works that you do not
196 | convey, without conditions so long as your license otherwise remains
197 | in force. You may convey covered works to others for the sole purpose
198 | of having them make modifications exclusively for you, or provide you
199 | with facilities for running those works, provided that you comply with
200 | the terms of this License in conveying all material for which you do
201 | not control copyright. Those thus making or running the covered works
202 | for you must do so exclusively on your behalf, under your direction
203 | and control, on terms that prohibit them from making any copies of
204 | your copyrighted material outside their relationship with you.
205 |
206 | Conveying under any other circumstances is permitted solely under
207 | the conditions stated below. Sublicensing is not allowed; section 10
208 | makes it unnecessary.
209 |
210 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
211 |
212 | No covered work shall be deemed part of an effective technological
213 | measure under any applicable law fulfilling obligations under article
214 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
215 | similar laws prohibiting or restricting circumvention of such
216 | measures.
217 |
218 | When you convey a covered work, you waive any legal power to forbid
219 | circumvention of technological measures to the extent such circumvention
220 | is effected by exercising rights under this License with respect to
221 | the covered work, and you disclaim any intention to limit operation or
222 | modification of the work as a means of enforcing, against the work's
223 | users, your or third parties' legal rights to forbid circumvention of
224 | technological measures.
225 |
226 | 4. Conveying Verbatim Copies.
227 |
228 | You may convey verbatim copies of the Program's source code as you
229 | receive it, in any medium, provided that you conspicuously and
230 | appropriately publish on each copy an appropriate copyright notice;
231 | keep intact all notices stating that this License and any
232 | non-permissive terms added in accord with section 7 apply to the code;
233 | keep intact all notices of the absence of any warranty; and give all
234 | recipients a copy of this License along with the Program.
235 |
236 | You may charge any price or no price for each copy that you convey,
237 | and you may offer support or warranty protection for a fee.
238 |
239 | 5. Conveying Modified Source Versions.
240 |
241 | You may convey a work based on the Program, or the modifications to
242 | produce it from the Program, in the form of source code under the
243 | terms of section 4, provided that you also meet all of these conditions:
244 |
245 | a) The work must carry prominent notices stating that you modified
246 | it, and giving a relevant date.
247 |
248 | b) The work must carry prominent notices stating that it is
249 | released under this License and any conditions added under section
250 | 7. This requirement modifies the requirement in section 4 to
251 | "keep intact all notices".
252 |
253 | c) You must license the entire work, as a whole, under this
254 | License to anyone who comes into possession of a copy. This
255 | License will therefore apply, along with any applicable section 7
256 | additional terms, to the whole of the work, and all its parts,
257 | regardless of how they are packaged. This License gives no
258 | permission to license the work in any other way, but it does not
259 | invalidate such permission if you have separately received it.
260 |
261 | d) If the work has interactive user interfaces, each must display
262 | Appropriate Legal Notices; however, if the Program has interactive
263 | interfaces that do not display Appropriate Legal Notices, your
264 | work need not make them do so.
265 |
266 | A compilation of a covered work with other separate and independent
267 | works, which are not by their nature extensions of the covered work,
268 | and which are not combined with it such as to form a larger program,
269 | in or on a volume of a storage or distribution medium, is called an
270 | "aggregate" if the compilation and its resulting copyright are not
271 | used to limit the access or legal rights of the compilation's users
272 | beyond what the individual works permit. Inclusion of a covered work
273 | in an aggregate does not cause this License to apply to the other
274 | parts of the aggregate.
275 |
276 | 6. Conveying Non-Source Forms.
277 |
278 | You may convey a covered work in object code form under the terms
279 | of sections 4 and 5, provided that you also convey the
280 | machine-readable Corresponding Source under the terms of this License,
281 | in one of these ways:
282 |
283 | a) Convey the object code in, or embodied in, a physical product
284 | (including a physical distribution medium), accompanied by the
285 | Corresponding Source fixed on a durable physical medium
286 | customarily used for software interchange.
287 |
288 | b) Convey the object code in, or embodied in, a physical product
289 | (including a physical distribution medium), accompanied by a
290 | written offer, valid for at least three years and valid for as
291 | long as you offer spare parts or customer support for that product
292 | model, to give anyone who possesses the object code either (1) a
293 | copy of the Corresponding Source for all the software in the
294 | product that is covered by this License, on a durable physical
295 | medium customarily used for software interchange, for a price no
296 | more than your reasonable cost of physically performing this
297 | conveying of source, or (2) access to copy the
298 | Corresponding Source from a network server at no charge.
299 |
300 | c) Convey individual copies of the object code with a copy of the
301 | written offer to provide the Corresponding Source. This
302 | alternative is allowed only occasionally and noncommercially, and
303 | only if you received the object code with such an offer, in accord
304 | with subsection 6b.
305 |
306 | d) Convey the object code by offering access from a designated
307 | place (gratis or for a charge), and offer equivalent access to the
308 | Corresponding Source in the same way through the same place at no
309 | further charge. You need not require recipients to copy the
310 | Corresponding Source along with the object code. If the place to
311 | copy the object code is a network server, the Corresponding Source
312 | may be on a different server (operated by you or a third party)
313 | that supports equivalent copying facilities, provided you maintain
314 | clear directions next to the object code saying where to find the
315 | Corresponding Source. Regardless of what server hosts the
316 | Corresponding Source, you remain obligated to ensure that it is
317 | available for as long as needed to satisfy these requirements.
318 |
319 | e) Convey the object code using peer-to-peer transmission, provided
320 | you inform other peers where the object code and Corresponding
321 | Source of the work are being offered to the general public at no
322 | charge under subsection 6d.
323 |
324 | A separable portion of the object code, whose source code is excluded
325 | from the Corresponding Source as a System Library, need not be
326 | included in conveying the object code work.
327 |
328 | A "User Product" is either (1) a "consumer product", which means any
329 | tangible personal property which is normally used for personal, family,
330 | or household purposes, or (2) anything designed or sold for incorporation
331 | into a dwelling. In determining whether a product is a consumer product,
332 | doubtful cases shall be resolved in favor of coverage. For a particular
333 | product received by a particular user, "normally used" refers to a
334 | typical or common use of that class of product, regardless of the status
335 | of the particular user or of the way in which the particular user
336 | actually uses, or expects or is expected to use, the product. A product
337 | is a consumer product regardless of whether the product has substantial
338 | commercial, industrial or non-consumer uses, unless such uses represent
339 | the only significant mode of use of the product.
340 |
341 | "Installation Information" for a User Product means any methods,
342 | procedures, authorization keys, or other information required to install
343 | and execute modified versions of a covered work in that User Product from
344 | a modified version of its Corresponding Source. The information must
345 | suffice to ensure that the continued functioning of the modified object
346 | code is in no case prevented or interfered with solely because
347 | modification has been made.
348 |
349 | If you convey an object code work under this section in, or with, or
350 | specifically for use in, a User Product, and the conveying occurs as
351 | part of a transaction in which the right of possession and use of the
352 | User Product is transferred to the recipient in perpetuity or for a
353 | fixed term (regardless of how the transaction is characterized), the
354 | Corresponding Source conveyed under this section must be accompanied
355 | by the Installation Information. But this requirement does not apply
356 | if neither you nor any third party retains the ability to install
357 | modified object code on the User Product (for example, the work has
358 | been installed in ROM).
359 |
360 | The requirement to provide Installation Information does not include a
361 | requirement to continue to provide support service, warranty, or updates
362 | for a work that has been modified or installed by the recipient, or for
363 | the User Product in which it has been modified or installed. Access to a
364 | network may be denied when the modification itself materially and
365 | adversely affects the operation of the network or violates the rules and
366 | protocols for communication across the network.
367 |
368 | Corresponding Source conveyed, and Installation Information provided,
369 | in accord with this section must be in a format that is publicly
370 | documented (and with an implementation available to the public in
371 | source code form), and must require no special password or key for
372 | unpacking, reading or copying.
373 |
374 | 7. Additional Terms.
375 |
376 | "Additional permissions" are terms that supplement the terms of this
377 | License by making exceptions from one or more of its conditions.
378 | Additional permissions that are applicable to the entire Program shall
379 | be treated as though they were included in this License, to the extent
380 | that they are valid under applicable law. If additional permissions
381 | apply only to part of the Program, that part may be used separately
382 | under those permissions, but the entire Program remains governed by
383 | this License without regard to the additional permissions.
384 |
385 | When you convey a copy of a covered work, you may at your option
386 | remove any additional permissions from that copy, or from any part of
387 | it. (Additional permissions may be written to require their own
388 | removal in certain cases when you modify the work.) You may place
389 | additional permissions on material, added by you to a covered work,
390 | for which you have or can give appropriate copyright permission.
391 |
392 | Notwithstanding any other provision of this License, for material you
393 | add to a covered work, you may (if authorized by the copyright holders of
394 | that material) supplement the terms of this License with terms:
395 |
396 | a) Disclaiming warranty or limiting liability differently from the
397 | terms of sections 15 and 16 of this License; or
398 |
399 | b) Requiring preservation of specified reasonable legal notices or
400 | author attributions in that material or in the Appropriate Legal
401 | Notices displayed by works containing it; or
402 |
403 | c) Prohibiting misrepresentation of the origin of that material, or
404 | requiring that modified versions of such material be marked in
405 | reasonable ways as different from the original version; or
406 |
407 | d) Limiting the use for publicity purposes of names of licensors or
408 | authors of the material; or
409 |
410 | e) Declining to grant rights under trademark law for use of some
411 | trade names, trademarks, or service marks; or
412 |
413 | f) Requiring indemnification of licensors and authors of that
414 | material by anyone who conveys the material (or modified versions of
415 | it) with contractual assumptions of liability to the recipient, for
416 | any liability that these contractual assumptions directly impose on
417 | those licensors and authors.
418 |
419 | All other non-permissive additional terms are considered "further
420 | restrictions" within the meaning of section 10. If the Program as you
421 | received it, or any part of it, contains a notice stating that it is
422 | governed by this License along with a term that is a further
423 | restriction, you may remove that term. If a license document contains
424 | a further restriction but permits relicensing or conveying under this
425 | License, you may add to a covered work material governed by the terms
426 | of that license document, provided that the further restriction does
427 | not survive such relicensing or conveying.
428 |
429 | If you add terms to a covered work in accord with this section, you
430 | must place, in the relevant source files, a statement of the
431 | additional terms that apply to those files, or a notice indicating
432 | where to find the applicable terms.
433 |
434 | Additional terms, permissive or non-permissive, may be stated in the
435 | form of a separately written license, or stated as exceptions;
436 | the above requirements apply either way.
437 |
438 | 8. Termination.
439 |
440 | You may not propagate or modify a covered work except as expressly
441 | provided under this License. Any attempt otherwise to propagate or
442 | modify it is void, and will automatically terminate your rights under
443 | this License (including any patent licenses granted under the third
444 | paragraph of section 11).
445 |
446 | However, if you cease all violation of this License, then your
447 | license from a particular copyright holder is reinstated (a)
448 | provisionally, unless and until the copyright holder explicitly and
449 | finally terminates your license, and (b) permanently, if the copyright
450 | holder fails to notify you of the violation by some reasonable means
451 | prior to 60 days after the cessation.
452 |
453 | Moreover, your license from a particular copyright holder is
454 | reinstated permanently if the copyright holder notifies you of the
455 | violation by some reasonable means, this is the first time you have
456 | received notice of violation of this License (for any work) from that
457 | copyright holder, and you cure the violation prior to 30 days after
458 | your receipt of the notice.
459 |
460 | Termination of your rights under this section does not terminate the
461 | licenses of parties who have received copies or rights from you under
462 | this License. If your rights have been terminated and not permanently
463 | reinstated, you do not qualify to receive new licenses for the same
464 | material under section 10.
465 |
466 | 9. Acceptance Not Required for Having Copies.
467 |
468 | You are not required to accept this License in order to receive or
469 | run a copy of the Program. Ancillary propagation of a covered work
470 | occurring solely as a consequence of using peer-to-peer transmission
471 | to receive a copy likewise does not require acceptance. However,
472 | nothing other than this License grants you permission to propagate or
473 | modify any covered work. These actions infringe copyright if you do
474 | not accept this License. Therefore, by modifying or propagating a
475 | covered work, you indicate your acceptance of this License to do so.
476 |
477 | 10. Automatic Licensing of Downstream Recipients.
478 |
479 | Each time you convey a covered work, the recipient automatically
480 | receives a license from the original licensors, to run, modify and
481 | propagate that work, subject to this License. You are not responsible
482 | for enforcing compliance by third parties with this License.
483 |
484 | An "entity transaction" is a transaction transferring control of an
485 | organization, or substantially all assets of one, or subdividing an
486 | organization, or merging organizations. If propagation of a covered
487 | work results from an entity transaction, each party to that
488 | transaction who receives a copy of the work also receives whatever
489 | licenses to the work the party's predecessor in interest had or could
490 | give under the previous paragraph, plus a right to possession of the
491 | Corresponding Source of the work from the predecessor in interest, if
492 | the predecessor has it or can get it with reasonable efforts.
493 |
494 | You may not impose any further restrictions on the exercise of the
495 | rights granted or affirmed under this License. For example, you may
496 | not impose a license fee, royalty, or other charge for exercise of
497 | rights granted under this License, and you may not initiate litigation
498 | (including a cross-claim or counterclaim in a lawsuit) alleging that
499 | any patent claim is infringed by making, using, selling, offering for
500 | sale, or importing the Program or any portion of it.
501 |
502 | 11. Patents.
503 |
504 | A "contributor" is a copyright holder who authorizes use under this
505 | License of the Program or a work on which the Program is based. The
506 | work thus licensed is called the contributor's "contributor version".
507 |
508 | A contributor's "essential patent claims" are all patent claims
509 | owned or controlled by the contributor, whether already acquired or
510 | hereafter acquired, that would be infringed by some manner, permitted
511 | by this License, of making, using, or selling its contributor version,
512 | but do not include claims that would be infringed only as a
513 | consequence of further modification of the contributor version. For
514 | purposes of this definition, "control" includes the right to grant
515 | patent sublicenses in a manner consistent with the requirements of
516 | this License.
517 |
518 | Each contributor grants you a non-exclusive, worldwide, royalty-free
519 | patent license under the contributor's essential patent claims, to
520 | make, use, sell, offer for sale, import and otherwise run, modify and
521 | propagate the contents of its contributor version.
522 |
523 | In the following three paragraphs, a "patent license" is any express
524 | agreement or commitment, however denominated, not to enforce a patent
525 | (such as an express permission to practice a patent or covenant not to
526 | sue for patent infringement). To "grant" such a patent license to a
527 | party means to make such an agreement or commitment not to enforce a
528 | patent against the party.
529 |
530 | If you convey a covered work, knowingly relying on a patent license,
531 | and the Corresponding Source of the work is not available for anyone
532 | to copy, free of charge and under the terms of this License, through a
533 | publicly available network server or other readily accessible means,
534 | then you must either (1) cause the Corresponding Source to be so
535 | available, or (2) arrange to deprive yourself of the benefit of the
536 | patent license for this particular work, or (3) arrange, in a manner
537 | consistent with the requirements of this License, to extend the patent
538 | license to downstream recipients. "Knowingly relying" means you have
539 | actual knowledge that, but for the patent license, your conveying the
540 | covered work in a country, or your recipient's use of the covered work
541 | in a country, would infringe one or more identifiable patents in that
542 | country that you have reason to believe are valid.
543 |
544 | If, pursuant to or in connection with a single transaction or
545 | arrangement, you convey, or propagate by procuring conveyance of, a
546 | covered work, and grant a patent license to some of the parties
547 | receiving the covered work authorizing them to use, propagate, modify
548 | or convey a specific copy of the covered work, then the patent license
549 | you grant is automatically extended to all recipients of the covered
550 | work and works based on it.
551 |
552 | A patent license is "discriminatory" if it does not include within
553 | the scope of its coverage, prohibits the exercise of, or is
554 | conditioned on the non-exercise of one or more of the rights that are
555 | specifically granted under this License. You may not convey a covered
556 | work if you are a party to an arrangement with a third party that is
557 | in the business of distributing software, under which you make payment
558 | to the third party based on the extent of your activity of conveying
559 | the work, and under which the third party grants, to any of the
560 | parties who would receive the covered work from you, a discriminatory
561 | patent license (a) in connection with copies of the covered work
562 | conveyed by you (or copies made from those copies), or (b) primarily
563 | for and in connection with specific products or compilations that
564 | contain the covered work, unless you entered into that arrangement,
565 | or that patent license was granted, prior to 28 March 2007.
566 |
567 | Nothing in this License shall be construed as excluding or limiting
568 | any implied license or other defenses to infringement that may
569 | otherwise be available to you under applicable patent law.
570 |
571 | 12. No Surrender of Others' Freedom.
572 |
573 | If conditions are imposed on you (whether by court order, agreement or
574 | otherwise) that contradict the conditions of this License, they do not
575 | excuse you from the conditions of this License. If you cannot convey a
576 | covered work so as to satisfy simultaneously your obligations under this
577 | License and any other pertinent obligations, then as a consequence you may
578 | not convey it at all. For example, if you agree to terms that obligate you
579 | to collect a royalty for further conveying from those to whom you convey
580 | the Program, the only way you could satisfy both those terms and this
581 | License would be to refrain entirely from conveying the Program.
582 |
583 | 13. Use with the GNU Affero General Public License.
584 |
585 | Notwithstanding any other provision of this License, you have
586 | permission to link or combine any covered work with a work licensed
587 | under version 3 of the GNU Affero General Public License into a single
588 | combined work, and to convey the resulting work. The terms of this
589 | License will continue to apply to the part which is the covered work,
590 | but the special requirements of the GNU Affero General Public License,
591 | section 13, concerning interaction through a network will apply to the
592 | combination as such.
593 |
594 | 14. Revised Versions of this License.
595 |
596 | The Free Software Foundation may publish revised and/or new versions of
597 | the GNU General Public License from time to time. Such new versions will
598 | be similar in spirit to the present version, but may differ in detail to
599 | address new problems or concerns.
600 |
601 | Each version is given a distinguishing version number. If the
602 | Program specifies that a certain numbered version of the GNU General
603 | Public License "or any later version" applies to it, you have the
604 | option of following the terms and conditions either of that numbered
605 | version or of any later version published by the Free Software
606 | Foundation. If the Program does not specify a version number of the
607 | GNU General Public License, you may choose any version ever published
608 | by the Free Software Foundation.
609 |
610 | If the Program specifies that a proxy can decide which future
611 | versions of the GNU General Public License can be used, that proxy's
612 | public statement of acceptance of a version permanently authorizes you
613 | to choose that version for the Program.
614 |
615 | Later license versions may give you additional or different
616 | permissions. However, no additional obligations are imposed on any
617 | author or copyright holder as a result of your choosing to follow a
618 | later version.
619 |
620 | 15. Disclaimer of Warranty.
621 |
622 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
623 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
624 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
625 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
626 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
627 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
628 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
629 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
630 |
631 | 16. Limitation of Liability.
632 |
633 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
634 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
635 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
636 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
637 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
638 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
639 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
640 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
641 | SUCH DAMAGES.
642 |
643 | 17. Interpretation of Sections 15 and 16.
644 |
645 | If the disclaimer of warranty and limitation of liability provided
646 | above cannot be given local legal effect according to their terms,
647 | reviewing courts shall apply local law that most closely approximates
648 | an absolute waiver of all civil liability in connection with the
649 | Program, unless a warranty or assumption of liability accompanies a
650 | copy of the Program in return for a fee.
651 |
652 | END OF TERMS AND CONDITIONS
653 |
654 | How to Apply These Terms to Your New Programs
655 |
656 | If you develop a new program, and you want it to be of the greatest
657 | possible use to the public, the best way to achieve this is to make it
658 | free software which everyone can redistribute and change under these terms.
659 |
660 | To do so, attach the following notices to the program. It is safest
661 | to attach them to the start of each source file to most effectively
662 | state the exclusion of warranty; and each file should have at least
663 | the "copyright" line and a pointer to where the full notice is found.
664 |
665 |
666 | Copyright (C)
667 |
668 | This program is free software: you can redistribute it and/or modify
669 | it under the terms of the GNU General Public License as published by
670 | the Free Software Foundation, either version 3 of the License, or
671 | (at your option) any later version.
672 |
673 | This program is distributed in the hope that it will be useful,
674 | but WITHOUT ANY WARRANTY; without even the implied warranty of
675 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
676 | GNU General Public License for more details.
677 |
678 | You should have received a copy of the GNU General Public License
679 | along with this program. If not, see .
680 |
681 | Also add information on how to contact you by electronic and paper mail.
682 |
683 | If the program does terminal interaction, make it output a short
684 | notice like this when it starts in an interactive mode:
685 |
686 | Copyright (C)
687 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
688 | This is free software, and you are welcome to redistribute it
689 | under certain conditions; type `show c' for details.
690 |
691 | The hypothetical commands `show w' and `show c' should show the appropriate
692 | parts of the General Public License. Of course, your program's commands
693 | might be different; for a GUI interface, you would use an "about box".
694 |
695 | You should also get your employer (if you work as a programmer) or school,
696 | if any, to sign a "copyright disclaimer" for the program, if necessary.
697 | For more information on this, and how to apply and follow the GNU GPL, see
698 | .
699 |
700 | The GNU General Public License does not permit incorporating your program
701 | into proprietary programs. If your program is a subroutine library, you
702 | may consider it more useful to permit linking proprietary applications with
703 | the library. If this is what you want to do, use the GNU Lesser General
704 | Public License instead of this License. But first, please read
705 | .
706 |
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | exportPattern("^[[:alpha:]]+")
2 |
--------------------------------------------------------------------------------
/NEWS.md:
--------------------------------------------------------------------------------
1 | # scrollrevealR 0.2.0
2 |
3 | # scrollrevealR 0.1.0
4 |
5 | * First publication on CRAN.
6 |
--------------------------------------------------------------------------------
/R/scroll_reveal.R:
--------------------------------------------------------------------------------
1 |
2 |
3 | #' Animate elements when scrolling to view them
4 | #'
5 | #' @param target The elements to animate as they scroll into view
6 | #' @param duration The duration of the animation in milliseconds. Defaults to 1000 ms
7 | #' @param delay The desired delay in milliseconds before triggering the animation. Defaults to 100 ms
8 | #' @param distance Controls how far elements move when revealed. Defaults to 20px
9 | #' @param origin Specifies what direction elements come from when revealed ("top", "bottom", "right", "left"). Defaults to "bottom"
10 | #' @param reset logical, should the function animate the element each time it scrolls into view or only once. Defaults to TRUE.
11 | #'
12 | #' @return An animated shiny element
13 | #' @export
14 | #'
15 | #' @examples
16 | #' if (interactive()) {
17 | #'
18 |
19 | #'ui <- fluidPage(
20 |
21 | #'h1("TIME"),
22 | #'br(),
23 | #'br(),
24 | #'h1("SPACE"),
25 | #'br(),
26 | #'br(),
27 | #'h1("PIZZA"),
28 | #'br(),
29 | #'br(),
30 | #'br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(),
31 | #'br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(),
32 | #'br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(),
33 | #'br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(),
34 | #'
35 | #'# Using the scroll_reveal() function
36 | #'scroll_reveal(target = "h1", duration = 2000, distance = "100px"),
37 | #'
38 | #')
39 | #'server <- function(input, output) {
40 | #'
41 | #'}
42 | #'
43 | #'shinyApp(ui = ui, server = server)
44 | #' }
45 |
46 | scroll_reveal <- function(target, duration = 1000, delay = 100, distance = "20px", origin = "bottom", reset = TRUE){
47 |
48 |
49 |
50 | if (!is.character(target) | !is.character(distance)) {
51 | stop("target and distance must be provided as characer strings")
52 | }
53 |
54 |
55 |
56 | if (reset) {
57 | commande <- glue::glue(
58 | "ScrollReveal().reveal('{target}', {{
59 |
60 | duration: {duration},
61 | reset: true,
62 | origin:'{origin}',
63 | delay:{delay},
64 | distance: '{distance}'}});"
65 | )
66 |
67 |
68 |
69 |
70 |
71 | } else {
72 | commande <- glue::glue(
73 | "ScrollReveal().reveal('{target}', {{
74 | duration: {duration},
75 | origin:'{origin}',
76 | delay: {delay},
77 | distance: '{distance}'}});"
78 | )
79 |
80 |
81 |
82 | }
83 |
84 |
85 | htmltools::tagList(scrollreveal_dep(),
86 |
87 | htmltools::tags$script(htmltools::HTML(commande)))
88 |
89 |
90 |
91 | }
92 |
93 |
94 |
--------------------------------------------------------------------------------
/R/scrollreveal_dep.R:
--------------------------------------------------------------------------------
1 |
2 | #' Create an HTML dependency for scrollreveal.js
3 | #'
4 | #' @rdname html-dependencies
5 | #' @export
6 | #'
7 | #'
8 |
9 |
10 | scrollreveal_dep <- function() {
11 | htmltools::htmlDependency(
12 | name = "scrollreveal",
13 | version = "4.0.7",
14 | package = "scrollrevealR",
15 | src = c(file = "scrollreveal"),
16 | script = "scrollreveal.min.js",
17 | all_files = FALSE
18 | )
19 | }
20 |
--------------------------------------------------------------------------------
/README.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | output: github_document
3 | ---
4 |
5 |
6 |
7 | ```{r, include = FALSE}
8 | knitr::opts_chunk$set(
9 | collapse = TRUE,
10 | comment = "#>",
11 | fig.path = "man/figures/README-",
12 | out.width = "100%"
13 | )
14 | ```
15 |
16 | # scrollrevealR
17 |
18 |
19 |
20 | [](https://cran.r-project.org/package=scrollrevealR)
21 |
22 | [](https://cran.r-project.org/package=scrollrevealR)
23 |
24 | [](https://cran.r-project.org/package=scrollrevealR)
25 |
26 | [](https://cran.r-project.org/package=scrollrevealR)
27 |
28 | [](https://travis-ci.com/feddelegrand7/scrollrevealR)
29 |
30 |
31 | [](https://github.com/feddelegrand7/scrollrevealR)
32 |
33 |
34 |
35 | `scrollrevealR` allows you to animate `shiny` elements when they scroll into view using the [scrollrevealjs library](https://scrollrevealjs.org/).
36 |
37 | 
38 |
39 |
40 |
41 |
42 | ## Installation
43 |
44 | You can install the `scrollrevealR` package from [CRAN](https://CRAN.R-project.org/package=scrollrevealR) with:
45 |
46 | ```{r, eval=FALSE}
47 |
48 | install.packages("scrollrevealR")
49 |
50 |
51 | ```
52 |
53 |
54 |
55 | You can install the development version of `scrollrevealR` from [GitHub](https://github.com/) with:
56 |
57 |
58 | ```{r eval=FALSE}
59 | # install.packages("devtools")
60 | devtools::install_github("feddelegrand7/scrollrevealR")
61 |
62 | ```
63 |
64 | ## Example
65 |
66 | In order to use `scrollrevealR`, you only need to use one function:
67 |
68 | + `scroll_reveal()`: allows you to animate one or many shiny elements as they scroll into view.
69 |
70 |
71 |
72 | #### Important: when you apply the `scroll_reveal()` function on Shiny Tables, they tend to disappear when you scroll down to check the last observations of the table which is annoying. In order to deal with this issue, you can use the `reset = FALSE` argument which will trigger an animation only once.
73 |
74 | Below an example of a simple shiny app that uses the `scrollrevealR` package:
75 |
76 |
77 | ```{r eval=FALSE}
78 | library(shiny)
79 | library(scrollrevealR)
80 |
81 | ui <- fluidPage(
82 |
83 | h1("Mtcars Plot"),
84 |
85 | br(), br(),
86 |
87 | plotOutput(outputId = "plt1"),
88 |
89 | br(), br(),
90 |
91 | h1("Iris Plot"),
92 |
93 | plotOutput(outputId = "plt2"),
94 |
95 | br(), br(),
96 |
97 | h1("ChickWeight Plot"),
98 |
99 | plotOutput(outputId = "plt3"),
100 |
101 | # Using the scroll_reveal() function -------------------------------------------
102 | scroll_reveal(target = c("#plt1", "#plt2", "#plt3"), duration = 2000, distance = "100px"),
103 |
104 | scroll_reveal(target = "h1", duration = 2000, distance = "100px"),
105 | # -----------------------------------------------------------------------------
106 |
107 | # Making some space at the end
108 |
109 | br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br()
110 |
111 | )
112 |
113 | server <- function(input, output) {
114 |
115 |
116 | output$plt1 <- renderPlot({
117 |
118 | plot(mtcars)
119 |
120 | })
121 |
122 |
123 | output$plt2 <- renderPlot({
124 |
125 |
126 | plot(iris)
127 |
128 | })
129 |
130 |
131 | output$plt3 <- renderPlot({
132 |
133 |
134 | plot(ChickWeight)
135 |
136 |
137 | })
138 |
139 |
140 | }
141 |
142 | shinyApp(ui = ui, server = server)
143 |
144 | ```
145 |
146 |
147 | 
148 |
149 |
150 | ## Commercial License
151 |
152 | If you use the `scrollrevealR` package for commercial usage, You can buy a Commercial License from the `scrollreveal` [website](https://scrollrevealjs.org/pricing/).
153 |
154 |
155 | ## Code of Conduct
156 |
157 | Please note that the scrollrevealR project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | # scrollrevealR
5 |
6 |
7 |
8 | [](https://cran.r-project.org/package=scrollrevealR)
9 |
10 | [](https://cran.r-project.org/package=scrollrevealR)
11 |
12 | [](https://cran.r-project.org/package=scrollrevealR)
14 |
15 | [](https://cran.r-project.org/package=scrollrevealR)
17 |
18 | [](https://travis-ci.com/feddelegrand7/scrollrevealR)
20 |
21 | [](https://github.com/feddelegrand7/scrollrevealR)
23 |
24 |
25 |
26 | `scrollrevealR` allows you to animate `shiny` elements when they scroll
27 | into view using the [scrollrevealjs
28 | library](https://scrollrevealjs.org/).
29 |
30 | 
31 |
32 |
33 |
34 | ## Installation
35 |
36 | You can install the `scrollrevealR` package from
37 | [CRAN](https://CRAN.R-project.org/package=scrollrevealR) with:
38 |
39 | ``` r
40 |
41 | install.packages("scrollrevealR")
42 | ```
43 |
44 | You can install the development version of `scrollrevealR` from
45 | [GitHub](https://github.com/) with:
46 |
47 | ``` r
48 | # install.packages("devtools")
49 | devtools::install_github("feddelegrand7/scrollrevealR")
50 | ```
51 |
52 | ## Example
53 |
54 | In order to use `scrollrevealR`, you only need to use one function:
55 |
56 | - `scroll_reveal()`: allows you to animate one or many shiny elements
57 | as they scroll into view.
58 |
59 | #### Important: when you apply the `scroll_reveal()` function on Shiny Tables, they tend to disappear when you scroll down to check the last observations of the table which is annoying. In order to deal with this issue, you can use the `reset = FALSE` argument which will trigger an animation only once.
60 |
61 | Below an example of a simple shiny app that uses the `scrollrevealR`
62 | package:
63 |
64 | ``` r
65 | library(shiny)
66 | library(scrollrevealR)
67 |
68 | ui <- fluidPage(
69 |
70 | h1("Mtcars Plot"),
71 |
72 | br(), br(),
73 |
74 | plotOutput(outputId = "plt1"),
75 |
76 | br(), br(),
77 |
78 | h1("Iris Plot"),
79 |
80 | plotOutput(outputId = "plt2"),
81 |
82 | br(), br(),
83 |
84 | h1("ChickWeight Plot"),
85 |
86 | plotOutput(outputId = "plt3"),
87 |
88 | # Using the scroll_reveal() function -------------------------------------------
89 | scroll_reveal(target = c("#plt1", "#plt2", "#plt3"), duration = 2000, distance = "100px"),
90 |
91 | scroll_reveal(target = "h1", duration = 2000, distance = "100px"),
92 | # -----------------------------------------------------------------------------
93 |
94 | # Making some space at the end
95 |
96 | br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br()
97 |
98 | )
99 |
100 | server <- function(input, output) {
101 |
102 |
103 | output$plt1 <- renderPlot({
104 |
105 | plot(mtcars)
106 |
107 | })
108 |
109 |
110 | output$plt2 <- renderPlot({
111 |
112 |
113 | plot(iris)
114 |
115 | })
116 |
117 |
118 | output$plt3 <- renderPlot({
119 |
120 |
121 | plot(ChickWeight)
122 |
123 |
124 | })
125 |
126 |
127 | }
128 |
129 | shinyApp(ui = ui, server = server)
130 | ```
131 |
132 | 
133 |
134 | ## Commercial License
135 |
136 | If you use the `scrollrevealR` package for commercial usage, You can buy
137 | a Commercial License from the `scrollreveal`
138 | [website](https://scrollrevealjs.org/pricing/).
139 |
140 | ## Code of Conduct
141 |
142 | Please note that the scrollrevealR project is released with a
143 | [Contributor Code of
144 | Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html).
145 | By contributing to this project, you agree to abide by its terms.
146 |
--------------------------------------------------------------------------------
/cran-comments.md:
--------------------------------------------------------------------------------
1 | ## Test environments
2 | * local R installation, R 4.0.0
3 | * ubuntu 16.04 (on travis-ci), R 4.0.0
4 | * win-builder (devel)
5 |
6 | -- R CMD check results -- scrollrevealR 0.2.0 ----
7 | Duration: 18.3s
8 |
9 |
10 | 0 errors √ | 0 warnings √ | 0 notes √
11 |
12 | * This is a resubmission
13 |
14 | - I've used the htmlDependency() function from the htmltools package, now scrollrevealR works locally (the user doesn't need an internet connection), it's also more robust as it relies on a local javascript file (see scrollreveal.min.js).
15 |
16 | - I've moved the GIFS to the .Rbuildignore file.
17 |
18 | Best.
19 |
--------------------------------------------------------------------------------
/inst/scrollreveal/scrollreveal.min.js:
--------------------------------------------------------------------------------
1 | /*! @license ScrollReveal v4.0.7
2 |
3 | Copyright 2020 Fisssion LLC.
4 |
5 | Licensed under the GNU General Public License 3.0 for
6 | compatible open source projects and non-commercial use.
7 |
8 | For commercial sites, themes, projects, and applications,
9 | keep your source code private/proprietary by purchasing
10 | a commercial license from https://scrollrevealjs.org/
11 | */
12 | var ScrollReveal=function(){"use strict";var r={delay:0,distance:"0",duration:600,easing:"cubic-bezier(0.5, 0, 0, 1)",interval:0,opacity:0,origin:"bottom",rotate:{x:0,y:0,z:0},scale:1,cleanup:!1,container:document.documentElement,desktop:!0,mobile:!0,reset:!1,useDelay:"always",viewFactor:0,viewOffset:{top:0,right:0,bottom:0,left:0},afterReset:function(){},afterReveal:function(){},beforeReset:function(){},beforeReveal:function(){}};var n={success:function(){document.documentElement.classList.add("sr"),document.body?document.body.style.height="100%":document.addEventListener("DOMContentLoaded",function(){document.body.style.height="100%"})},failure:function(){return document.documentElement.classList.remove("sr"),{clean:function(){},destroy:function(){},reveal:function(){},sync:function(){},get noop(){return!0}}}};function o(e){return"object"==typeof window.Node?e instanceof window.Node:null!==e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName}function u(e,t){if(void 0===t&&(t=document),e instanceof Array)return e.filter(o);if(o(e))return[e];if(n=e,i=Object.prototype.toString.call(n),"object"==typeof window.NodeList?n instanceof window.NodeList:null!==n&&"object"==typeof n&&"number"==typeof n.length&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(i)&&(0===n.length||o(n[0])))return Array.prototype.slice.call(e);var n,i;if("string"==typeof e)try{var r=t.querySelectorAll(e);return Array.prototype.slice.call(r)}catch(e){return[]}return[]}function s(e){return null!==e&&e instanceof Object&&(e.constructor===Object||"[object Object]"===Object.prototype.toString.call(e))}function f(n,i){if(s(n))return Object.keys(n).forEach(function(e){return i(n[e],e,n)});if(n instanceof Array)return n.forEach(function(e,t){return i(e,t,n)});throw new TypeError("Expected either an array or object literal.")}function h(e){for(var t=[],n=arguments.length-1;0=[].concat(r.body).shift())return g.call(this,n,i,-1,t),c.call(this,e,{reveal:!0,pristine:t});if(!n.blocked.foot&&i===[].concat(o.foot).shift()&&i<=[].concat(r.body).pop())return g.call(this,n,i,1,t),c.call(this,e,{reveal:!0,pristine:t})}}function v(e){var t=Math.abs(e);if(isNaN(t))throw new RangeError("Invalid sequence interval.");this.id=y(),this.interval=Math.max(t,16),this.members=[],this.models={},this.blocked={head:!1,foot:!1}}function d(e,i,r){var o=this;this.head=[],this.body=[],this.foot=[],f(e.members,function(e,t){var n=r.elements[e];n&&n[i]&&o.body.push(t)}),this.body.length&&f(e.members,function(e,t){var n=r.elements[e];n&&!n[i]&&(t
5 | %\VignetteIndexEntry{Introduction}
6 | %\VignetteEngine{knitr::rmarkdown}
7 | %\VignetteEncoding{UTF-8}
8 | ---
9 |
10 | ```{r, include = FALSE}
11 | knitr::opts_chunk$set(
12 | collapse = TRUE,
13 | comment = "#>"
14 | )
15 | ```
16 |
17 | # scrollrevealR
18 |
19 | `scrollrevealR` allows you to animate `shiny` elements when they scroll into view using the [scrollrevealjs library](https://scrollrevealjs.org/).
20 |
21 | ## Installation
22 |
23 |
24 | You can install the `scrollrevealR` package from CRAN:
25 |
26 | ```{r, eval=FALSE}
27 |
28 | install.packages("scrollrevealR")
29 |
30 |
31 | ```
32 |
33 |
34 |
35 | You can install the development version of `scrollrevealR` from [GitHub](https://github.com/) with:
36 |
37 |
38 | ```{r eval=FALSE}
39 | # install.packages("devtools")
40 | devtools::install_github("feddelegrand7/scrollrevealR")
41 |
42 | ```
43 |
44 | ## Example
45 |
46 | In order to use `scrollrevealR`, you only need to use one function:
47 |
48 | + `scroll_reveal()`: allows you to animate one or many shiny elements as they scroll into view.
49 |
50 |
51 | ## Important: when you apply the `scroll_reveal()` function on Shiny Tables, they tend to disappear when you scroll down to check the last observations of the table which is annoying. In order to deal with this issue, you can use the `reset = FALSE` argument which will trigger an animation only once.
52 |
53 | Below an example of a simple shiny app that uses the `scrollrevealR` package:
54 |
55 |
56 | ```{r eval=FALSE}
57 | library(shiny)
58 | library(scrollrevealR)
59 |
60 | ui <- fluidPage(
61 |
62 | h1("Mtcars Plot"),
63 |
64 | br(), br(),
65 |
66 | plotOutput(outputId = "plt1"),
67 |
68 | br(), br(),
69 |
70 | h1("Iris Plot"),
71 |
72 | plotOutput(outputId = "plt2"),
73 |
74 | br(), br(),
75 |
76 | h1("ChickWeight Plot"),
77 |
78 | plotOutput(outputId = "plt3"),
79 |
80 | # Using the scroll_reveal() function -------------------------------------------
81 | scroll_reveal(target = c("#plt1", "#plt2", "#plt3"), duration = 2000, distance = "100px"),
82 |
83 | scroll_reveal(target = "h1", duration = 2000, distance = "100px"),
84 | # -----------------------------------------------------------------------------
85 |
86 | # Making some space at the end
87 |
88 | br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br(), br()
89 |
90 | )
91 |
92 | server <- function(input, output) {
93 |
94 |
95 | output$plt1 <- renderPlot({
96 |
97 | plot(mtcars)
98 |
99 | })
100 |
101 |
102 | output$plt2 <- renderPlot({
103 |
104 |
105 | plot(iris)
106 |
107 | })
108 |
109 |
110 | output$plt3 <- renderPlot({
111 |
112 |
113 | plot(ChickWeight)
114 |
115 |
116 | })
117 |
118 |
119 | }
120 |
121 | shinyApp(ui = ui, server = server)
122 |
123 | ```
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
--------------------------------------------------------------------------------