API rewrite
mitchelloharawild opened this issue · 4 comments
cc: @earowang, @emitanaka
Rewrite of the interface to introduce support for user defined icon libraries, and extensibility support (hopefully improving anicon). Along with the rewrite, the package will convert from icon fonts to SVG icons.
I imagine that anicon may be better suited as a general purpose animation library for rmarkdown documents. This is something I'd like to work on later this month.
Icon styling
modify(icon, colour = "red", rotate = 90)
Icon stacking
icon1 + icon2
Icon animation
animate(icon, animation)
New icon library
my_icon <- new_icon(svgfolder)
my_icon$icon_name(...)
my_icon(icon_name)
Example implementation of functions with $
methods
my_icon <- structure(function(...){
return(..1)
}, class = "icon")
`$.icon` <- function(lib, icon){
return(deparse(icon))
}
my_icon$rocket
my_icon("rocket")
Yes, I like this! Will be piping compatible! Was thinking of something similar so good to see we are on the same page :) Icon stacking needs a bit more thinking. I'm fine with the API but under the hoods will be a pain.
Piping is the idea 😄
It is also nice because the animation and styles are not necessarily specific to icons. We could also have the modify and animation functionality work on text (perhaps better suited to a separate package).
I'm happy to think more about icon stacking, it may be better to have it in a more pipe-able UI. For example:
fa$moon %>%
stack(
fa$rocket %>%
modify(size = 0.5)
)
That's one idea. I do like the icon1 + icon2
style. Reminds of patchwork. I'll think more about it too before I see you in person!
PS: nice user2018 talk!
Resolved by #31