diff --git a/DESCRIPTION b/DESCRIPTION index 4950a2b..096d4f2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: fireworks Title: Fireworks for your 'Shiny' application -Version: 0.1.0 +Version: 0.1.1 Authors@R: person("Veerle", "van Leemput", , "veerle@hypebright.nl", role = c("aut", "cre")) Description: 'fireworks' is a wrapper around the 'fireworks-js' library that contains diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..6376aae --- /dev/null +++ b/NEWS.md @@ -0,0 +1,4 @@ +# fireworks 0.1.1 + +* Added a `fadeOut` argument to the `stop` method to control whether the fireworks fade out or disappear instantly. The effects lasts 2000 ms to remove the fireworks in a natural manner. Thanks to @laresbernardo for the suggestion in issue #1. Example can be found in `inst/examples/02-fireworks-on-demand.R`. +* Added a `NEWS.md` file to track changes to the package. diff --git a/R/fireworks.R b/R/fireworks.R index 7ea9eb7..fb4004a 100644 --- a/R/fireworks.R +++ b/R/fireworks.R @@ -59,7 +59,7 @@ fireworks <- function(id, width = "100%", height = "400px", options = list()) { #' @import R6 #' @export Fireworks <- R6::R6Class( - "fireworks", + "Fireworks", public = list( #' @details #' Create fireworks. @@ -94,12 +94,15 @@ Fireworks <- R6::R6Class( }, #' @details #' Stop the fireworks - stop = function(){ + #' @param fadeOut Whether to fade out the fireworks before stopping. Note that + #' this will take 2000ms to complete. + stop = function(fadeOut = FALSE){ if (is.null(private$.id)) { - private$.session$sendCustomMessage("fireworks-stop", list()) + private$.session$sendCustomMessage("fireworks-stop", list(fadeOut = fadeOut)) } else { for (i in 1:length(private$.id)) { - private$.session$sendCustomMessage("fireworks-stop", list(id = private$.id[[i]])) + private$.session$sendCustomMessage("fireworks-stop", list(id = private$.id[[i]], + fadeOut = fadeOut)) } } invisible(self) diff --git a/README.md b/README.md index 8252def..2152d5e 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,18 @@ fw <- Fireworks$new(options = list(hue = list(min = 0, max = 45), traceSpeed = 5)) ``` +### Natural stop effect + +By default, fireworks are removed immediately when `stop` is called. You can add a natural stop effect by setting `fadeOut = TRUE`: + +```r +fw$stop(fadeOut = TRUE) +``` + +The effects takes 2000ms and changes the intensity of the fireworks to `1`: + +![](./inst/images/fireworks-fadeout.gif) + ## Acknowledgements As this is a wrapper around an existing library, I want to give credit to the original authors: diff --git a/inst/examples/02-fireworks-on-demand.R b/inst/examples/02-fireworks-on-demand.R index 10fe6f7..d58e4e1 100644 --- a/inst/examples/02-fireworks-on-demand.R +++ b/inst/examples/02-fireworks-on-demand.R @@ -22,7 +22,7 @@ server <- function(input, output, session) { }) |> bindEvent(input$launch) observe({ - fw$stop() + fw$stop(fadeOut = TRUE) }) |> bindEvent(input$stop) } diff --git a/inst/fireworks-0.1.0/dist/fireworks.min.css.map b/inst/fireworks-0.1.0/dist/fireworks.min.css.map index 5a9275b..df006fa 100644 --- a/inst/fireworks-0.1.0/dist/fireworks.min.css.map +++ b/inst/fireworks-0.1.0/dist/fireworks.min.css.map @@ -1,6 +1,6 @@ { "version": 3, - "sources": ["../../../styles/Users/veerlevanleemput/Documents/Hypebright BV/lab/fireworks/styles/main.scss", "../../../styles/%3Cinput%20css%20doEH9u%3E"], + "sources": ["../../../styles/Users/veerlevanleemput/Documents/Hypebright BV/lab/fireworks/styles/main.scss", "../../../styles/%3Cinput%20css%20926ZRK%3E"], "sourcesContent": [".fireworks-overlay {\n position: absolute;\n left: 0;\n width: 100%;\n z-index: 9999; // Ensure it's on top of other elements\n pointer-events: none; // Allows pointer events to pass through\n}\n\n.fireworks-full-screen {\n top: 0;\n height: 100%;\n}\n", ".fireworks-overlay {\n position: absolute;\n left: 0;\n width: 100%;\n z-index: 9999;\n pointer-events: none;\n}\n\n.fireworks-full-screen {\n top: 0;\n height: 100%;\n}\n/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiL1VzZXJzL3ZlZXJsZXZhbmxlZW1wdXQvRG9jdW1lbnRzL0h5cGVicmlnaHQgQlYvbGFiL2ZpcmV3b3Jrcy9zdHlsZXMiLCJzb3VyY2VzIjpbIm1haW4uc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtFQUNFO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7OztBQUdGO0VBQ0U7RUFDQSIsInNvdXJjZXNDb250ZW50IjpbIi5maXJld29ya3Mtb3ZlcmxheSB7XG4gIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgbGVmdDogMDtcbiAgd2lkdGg6IDEwMCU7XG4gIHotaW5kZXg6IDk5OTk7IC8vIEVuc3VyZSBpdCdzIG9uIHRvcCBvZiBvdGhlciBlbGVtZW50c1xuICBwb2ludGVyLWV2ZW50czogbm9uZTsgLy8gQWxsb3dzIHBvaW50ZXIgZXZlbnRzIHRvIHBhc3MgdGhyb3VnaFxufVxuXG4uZmlyZXdvcmtzLWZ1bGwtc2NyZWVuIHtcbiAgdG9wOiAwO1xuICBoZWlnaHQ6IDEwMCU7XG59XG4iXX0= */"], "mappings": "AAAA,CAAA,kBACE,SAAA,SACA,KAAA,EACA,MAAA,KACA,QAAA,KACA,eAAA,ICCF,CDEA,CAAA,sBACE,IAAA,EACA,OAAA,ICCF", "names": [] diff --git a/inst/fireworks-0.1.0/dist/fireworks.min.js b/inst/fireworks-0.1.0/dist/fireworks.min.js index aadf5d0..cbbc025 100644 --- a/inst/fireworks-0.1.0/dist/fireworks.min.js +++ b/inst/fireworks-0.1.0/dist/fireworks.min.js @@ -1 +1 @@ -(function(o,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(o=typeof globalThis<"u"?globalThis:o||self,h(o.Fireworks={}))})(void 0,function(o){"use strict";function h(e){return Math.abs(Math.floor(e))}function r(e,t){return Math.random()*(t-e)+e}function a(e,t){return Math.floor(r(e,t+1))}function g(e,t,i,s){let n=Math.pow;return Math.sqrt(n(e-i,2)+n(t-s,2))}function x(e,t,i=1){if(e>360||e<0)throw new Error(`Expected hue 0-360 range, got \`${e}\``);if(t>100||t<0)throw new Error(`Expected lightness 0-100 range, got \`${t}\``);if(i>1||i<0)throw new Error(`Expected alpha 0-1 range, got \`${i}\``);return`hsla(${e}, 100%, ${t}%, ${i})`}let b=e=>{if(typeof e=="object"&&e!==null){if(typeof Object.getPrototypeOf=="function"){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}return Object.prototype.toString.call(e)==="[object Object]"}return!1},v=["__proto__","constructor","prototype"],y=(...e)=>e.reduce((t,i)=>(Object.keys(i).forEach(s=>{v.includes(s)||(Array.isArray(t[s])&&Array.isArray(i[s])?t[s]=i[s]:b(t[s])&&b(i[s])?t[s]=y(t[s],i[s]):t[s]=i[s])}),t),{});function V(e,t){let i;return(...s)=>{i&&clearTimeout(i),i=setTimeout(()=>e(...s),t)}}class W{x;y;ctx;hue;friction;gravity;flickering;lineWidth;explosionLength;angle;speed;brightness;coordinates=[];decay;alpha=1;constructor({x:t,y:i,ctx:s,hue:n,decay:c,gravity:l,friction:d,brightness:u,flickering:p,lineWidth:m,explosionLength:f}){for(this.x=t,this.y=i,this.ctx=s,this.hue=n,this.gravity=l,this.friction=d,this.flickering=p,this.lineWidth=m,this.explosionLength=f,this.angle=r(0,Math.PI*2),this.speed=a(1,10),this.brightness=a(u.min,u.max),this.decay=r(c.min,c.max);this.explosionLength--;)this.coordinates.push([t,i])}update(t){this.coordinates.pop(),this.coordinates.unshift([this.x,this.y]),this.speed*=this.friction,this.x+=Math.cos(this.angle)*this.speed,this.y+=Math.sin(this.angle)*this.speed+this.gravity,this.alpha-=this.decay,this.alpha<=this.decay&&t()}draw(){let t=this.coordinates.length-1;this.ctx.beginPath(),this.ctx.lineWidth=this.lineWidth,this.ctx.fillStyle=x(this.hue,this.brightness,this.alpha),this.ctx.moveTo(this.coordinates[t][0],this.coordinates[t][1]),this.ctx.lineTo(this.x,this.y),this.ctx.strokeStyle=x(this.hue,this.flickering?r(0,this.brightness):this.brightness,this.alpha),this.ctx.stroke()}}class k{constructor(t,i){this.options=t,this.canvas=i,this.pointerDown=this.pointerDown.bind(this),this.pointerUp=this.pointerUp.bind(this),this.pointerMove=this.pointerMove.bind(this)}active=!1;x;y;get mouseOptions(){return this.options.mouse}mount(){this.canvas.addEventListener("pointerdown",this.pointerDown),this.canvas.addEventListener("pointerup",this.pointerUp),this.canvas.addEventListener("pointermove",this.pointerMove)}unmount(){this.canvas.removeEventListener("pointerdown",this.pointerDown),this.canvas.removeEventListener("pointerup",this.pointerUp),this.canvas.removeEventListener("pointermove",this.pointerMove)}usePointer(t,i){let{click:s,move:n}=this.mouseOptions;(s||n)&&(this.x=t.pageX-this.canvas.offsetLeft,this.y=t.pageY-this.canvas.offsetTop,this.active=i)}pointerDown(t){this.usePointer(t,this.mouseOptions.click)}pointerUp(t){this.usePointer(t,!1)}pointerMove(t){this.usePointer(t,this.active)}}class R{hue;rocketsPoint;opacity;acceleration;friction;gravity;particles;explosion;mouse;boundaries;sound;delay;brightness;decay;flickering;intensity;traceLength;traceSpeed;lineWidth;lineStyle;autoresize;constructor(){this.autoresize=!0,this.lineStyle="round",this.flickering=50,this.traceLength=3,this.traceSpeed=10,this.intensity=30,this.explosion=5,this.gravity=1.5,this.opacity=.5,this.particles=50,this.friction=.95,this.acceleration=1.05,this.hue={min:0,max:360},this.rocketsPoint={min:50,max:50},this.lineWidth={explosion:{min:1,max:3},trace:{min:1,max:2}},this.mouse={click:!1,move:!1,max:1},this.delay={min:30,max:60},this.brightness={min:50,max:80},this.decay={min:.015,max:.03},this.sound={enabled:!1,files:["explosion0.mp3","explosion1.mp3","explosion2.mp3"],volume:{min:4,max:8}},this.boundaries={debug:!1,height:0,width:0,x:50,y:50}}update(t){Object.assign(this,y(this,t))}}class M{constructor(t,i){this.options=t,this.render=i}tick=0;rafId=0;fps=60;tolerance=.1;now;mount(){this.now=performance.now();let t=1e3/this.fps,i=s=>{this.rafId=requestAnimationFrame(i);let n=s-this.now;n>=t-this.tolerance&&(this.render(),this.now=s-n%t,this.tick+=n*(this.options.intensity*Math.PI)/1e3)};this.rafId=requestAnimationFrame(i)}unmount(){cancelAnimationFrame(this.rafId)}}class z{constructor(t,i,s){this.options=t,this.updateSize=i,this.container=s}resizer;mount(){if(!this.resizer){let t=V(()=>this.updateSize(),100);this.resizer=new ResizeObserver(t)}this.options.autoresize&&this.resizer.observe(this.container)}unmount(){this.resizer&&this.resizer.unobserve(this.container)}}class I{constructor(t){this.options=t,this.init()}buffers=[];audioContext;onInit=!1;get isEnabled(){return this.options.sound.enabled}get soundOptions(){return this.options.sound}init(){!this.onInit&&this.isEnabled&&(this.onInit=!0,this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.loadSounds())}async loadSounds(){for(let t of this.soundOptions.files){let i=await(await fetch(t)).arrayBuffer();this.audioContext.decodeAudioData(i).then(s=>{this.buffers.push(s)}).catch(s=>{throw s})}}play(){if(this.isEnabled&&this.buffers.length){let t=this.audioContext.createBufferSource(),i=this.buffers[a(0,this.buffers.length-1)],s=this.audioContext.createGain();t.buffer=i,s.gain.value=r(this.soundOptions.volume.min/100,this.soundOptions.volume.max/100),s.connect(this.audioContext.destination),t.connect(s),t.start(0)}else this.init()}}class S{x;y;sx;sy;dx;dy;ctx;hue;speed;acceleration;traceLength;totalDistance;angle;brightness;coordinates=[];currentDistance=0;constructor({x:t,y:i,dx:s,dy:n,ctx:c,hue:l,speed:d,traceLength:u,acceleration:p}){for(this.x=t,this.y=i,this.sx=t,this.sy=i,this.dx=s,this.dy=n,this.ctx=c,this.hue=l,this.speed=d,this.traceLength=u,this.acceleration=p,this.totalDistance=g(t,i,s,n),this.angle=Math.atan2(n-i,s-t),this.brightness=a(50,70);this.traceLength--;)this.coordinates.push([t,i])}update(t){this.coordinates.pop(),this.coordinates.unshift([this.x,this.y]),this.speed*=this.acceleration;let i=Math.cos(this.angle)*this.speed,s=Math.sin(this.angle)*this.speed;this.currentDistance=g(this.sx,this.sy,this.x+i,this.y+s),this.currentDistance>=this.totalDistance?t(this.dx,this.dy,this.hue):(this.x+=i,this.y+=s)}draw(){let t=this.coordinates.length-1;this.ctx.beginPath(),this.ctx.moveTo(this.coordinates[t][0],this.coordinates[t][1]),this.ctx.lineTo(this.x,this.y),this.ctx.strokeStyle=x(this.hue,this.brightness),this.ctx.stroke()}}class w{target;container;canvas;ctx;width;height;traces=[];explosions=[];waitStopRaf;running=!1;opts;sound;resize;mouse;raf;constructor(t,i={}){this.target=t,this.container=t,this.opts=new R,this.createCanvas(this.target),this.updateOptions(i),this.sound=new I(this.opts),this.resize=new z(this.opts,this.updateSize.bind(this),this.container),this.mouse=new k(this.opts,this.canvas),this.raf=new M(this.opts,this.render.bind(this))}get isRunning(){return this.running}get version(){return"2.10.7"}get currentOptions(){return this.opts}start(){this.running||(this.canvas.isConnected||this.createCanvas(this.target),this.running=!0,this.resize.mount(),this.mouse.mount(),this.raf.mount())}stop(t=!1){!this.running||(this.running=!1,this.resize.unmount(),this.mouse.unmount(),this.raf.unmount(),this.clear(),t&&this.canvas.remove())}async waitStop(t){if(this.running)return new Promise(i=>{this.waitStopRaf=()=>{!this.waitStopRaf||(requestAnimationFrame(this.waitStopRaf),!this.traces.length&&!this.explosions.length&&(this.waitStopRaf=null,this.stop(t),i()))},this.waitStopRaf()})}pause(){this.running=!this.running,this.running?this.raf.mount():this.raf.unmount()}clear(){!this.ctx||(this.traces=[],this.explosions=[],this.ctx.clearRect(0,0,this.width,this.height))}launch(t=1){for(let i=0;ia(t.min,t.max)||this.mouse.active&&i.max>this.traces.length)&&(this.createTrace(),this.raf.tick=0)}drawTrace(){let t=this.traces.length;for(;t--;)this.traces[t].draw(),this.traces[t].update((i,s,n)=>{this.initExplosion(i,s,n),this.sound.play(),this.traces.splice(t,1)})}initExplosion(t,i,s){let{particles:n,flickering:c,lineWidth:l,explosion:d,brightness:u,friction:p,gravity:m,decay:f}=this.opts,J=h(n);for(;J--;)this.explosions.push(new W({x:t,y:i,ctx:this.ctx,hue:s,friction:p,gravity:m,flickering:a(0,100)<=c,lineWidth:r(l.explosion.min,l.explosion.max),explosionLength:h(d),brightness:u,decay:f}))}drawExplosion(){let t=this.explosions.length;for(;t--;)this.explosions[t].draw(),this.explosions[t].update(()=>{this.explosions.splice(t,1)})}}o.Fireworks=w,o.default=w,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});Shiny.addCustomMessageHandler("fireworks-start",function(o){let h,r;o.id==null?(h=document.createElement("div"),h.classList.add("fireworks-overlay","fireworks-full-screen"),document.body.appendChild(h),r="full-screen"):(h=document.getElementById(o.id),r=o.id);let a=new Fireworks.default(h,o.options);o.id!=null&&a.canvas.classList.add("fireworks-overlay"),a.start(),window[`fireworks-${r}`]=a});Shiny.addCustomMessageHandler("fireworks-stop",function(o){let h=o.id==null?"full-screen":o.id;window[`fireworks-${h}`].stop(),o.id==null&&document.body.removeChild(document.querySelector(".fireworks-full-screen"))}); +(function(o,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(o=typeof globalThis<"u"?globalThis:o||self,h(o.Fireworks={}))})(void 0,function(o){"use strict";function h(e){return Math.abs(Math.floor(e))}function r(e,t){return Math.random()*(t-e)+e}function a(e,t){return Math.floor(r(e,t+1))}function g(e,t,i,s){let n=Math.pow;return Math.sqrt(n(e-i,2)+n(t-s,2))}function x(e,t,i=1){if(e>360||e<0)throw new Error(`Expected hue 0-360 range, got \`${e}\``);if(t>100||t<0)throw new Error(`Expected lightness 0-100 range, got \`${t}\``);if(i>1||i<0)throw new Error(`Expected alpha 0-1 range, got \`${i}\``);return`hsla(${e}, 100%, ${t}%, ${i})`}let b=e=>{if(typeof e=="object"&&e!==null){if(typeof Object.getPrototypeOf=="function"){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}return Object.prototype.toString.call(e)==="[object Object]"}return!1},v=["__proto__","constructor","prototype"],y=(...e)=>e.reduce((t,i)=>(Object.keys(i).forEach(s=>{v.includes(s)||(Array.isArray(t[s])&&Array.isArray(i[s])?t[s]=i[s]:b(t[s])&&b(i[s])?t[s]=y(t[s],i[s]):t[s]=i[s])}),t),{});function V(e,t){let i;return(...s)=>{i&&clearTimeout(i),i=setTimeout(()=>e(...s),t)}}class k{x;y;ctx;hue;friction;gravity;flickering;lineWidth;explosionLength;angle;speed;brightness;coordinates=[];decay;alpha=1;constructor({x:t,y:i,ctx:s,hue:n,decay:c,gravity:l,friction:d,brightness:u,flickering:p,lineWidth:m,explosionLength:f}){for(this.x=t,this.y=i,this.ctx=s,this.hue=n,this.gravity=l,this.friction=d,this.flickering=p,this.lineWidth=m,this.explosionLength=f,this.angle=r(0,Math.PI*2),this.speed=a(1,10),this.brightness=a(u.min,u.max),this.decay=r(c.min,c.max);this.explosionLength--;)this.coordinates.push([t,i])}update(t){this.coordinates.pop(),this.coordinates.unshift([this.x,this.y]),this.speed*=this.friction,this.x+=Math.cos(this.angle)*this.speed,this.y+=Math.sin(this.angle)*this.speed+this.gravity,this.alpha-=this.decay,this.alpha<=this.decay&&t()}draw(){let t=this.coordinates.length-1;this.ctx.beginPath(),this.ctx.lineWidth=this.lineWidth,this.ctx.fillStyle=x(this.hue,this.brightness,this.alpha),this.ctx.moveTo(this.coordinates[t][0],this.coordinates[t][1]),this.ctx.lineTo(this.x,this.y),this.ctx.strokeStyle=x(this.hue,this.flickering?r(0,this.brightness):this.brightness,this.alpha),this.ctx.stroke()}}class W{constructor(t,i){this.options=t,this.canvas=i,this.pointerDown=this.pointerDown.bind(this),this.pointerUp=this.pointerUp.bind(this),this.pointerMove=this.pointerMove.bind(this)}active=!1;x;y;get mouseOptions(){return this.options.mouse}mount(){this.canvas.addEventListener("pointerdown",this.pointerDown),this.canvas.addEventListener("pointerup",this.pointerUp),this.canvas.addEventListener("pointermove",this.pointerMove)}unmount(){this.canvas.removeEventListener("pointerdown",this.pointerDown),this.canvas.removeEventListener("pointerup",this.pointerUp),this.canvas.removeEventListener("pointermove",this.pointerMove)}usePointer(t,i){let{click:s,move:n}=this.mouseOptions;(s||n)&&(this.x=t.pageX-this.canvas.offsetLeft,this.y=t.pageY-this.canvas.offsetTop,this.active=i)}pointerDown(t){this.usePointer(t,this.mouseOptions.click)}pointerUp(t){this.usePointer(t,!1)}pointerMove(t){this.usePointer(t,this.active)}}class R{hue;rocketsPoint;opacity;acceleration;friction;gravity;particles;explosion;mouse;boundaries;sound;delay;brightness;decay;flickering;intensity;traceLength;traceSpeed;lineWidth;lineStyle;autoresize;constructor(){this.autoresize=!0,this.lineStyle="round",this.flickering=50,this.traceLength=3,this.traceSpeed=10,this.intensity=30,this.explosion=5,this.gravity=1.5,this.opacity=.5,this.particles=50,this.friction=.95,this.acceleration=1.05,this.hue={min:0,max:360},this.rocketsPoint={min:50,max:50},this.lineWidth={explosion:{min:1,max:3},trace:{min:1,max:2}},this.mouse={click:!1,move:!1,max:1},this.delay={min:30,max:60},this.brightness={min:50,max:80},this.decay={min:.015,max:.03},this.sound={enabled:!1,files:["explosion0.mp3","explosion1.mp3","explosion2.mp3"],volume:{min:4,max:8}},this.boundaries={debug:!1,height:0,width:0,x:50,y:50}}update(t){Object.assign(this,y(this,t))}}class M{constructor(t,i){this.options=t,this.render=i}tick=0;rafId=0;fps=60;tolerance=.1;now;mount(){this.now=performance.now();let t=1e3/this.fps,i=s=>{this.rafId=requestAnimationFrame(i);let n=s-this.now;n>=t-this.tolerance&&(this.render(),this.now=s-n%t,this.tick+=n*(this.options.intensity*Math.PI)/1e3)};this.rafId=requestAnimationFrame(i)}unmount(){cancelAnimationFrame(this.rafId)}}class I{constructor(t,i,s){this.options=t,this.updateSize=i,this.container=s}resizer;mount(){if(!this.resizer){let t=V(()=>this.updateSize(),100);this.resizer=new ResizeObserver(t)}this.options.autoresize&&this.resizer.observe(this.container)}unmount(){this.resizer&&this.resizer.unobserve(this.container)}}class z{constructor(t){this.options=t,this.init()}buffers=[];audioContext;onInit=!1;get isEnabled(){return this.options.sound.enabled}get soundOptions(){return this.options.sound}init(){!this.onInit&&this.isEnabled&&(this.onInit=!0,this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.loadSounds())}async loadSounds(){for(let t of this.soundOptions.files){let i=await(await fetch(t)).arrayBuffer();this.audioContext.decodeAudioData(i).then(s=>{this.buffers.push(s)}).catch(s=>{throw s})}}play(){if(this.isEnabled&&this.buffers.length){let t=this.audioContext.createBufferSource(),i=this.buffers[a(0,this.buffers.length-1)],s=this.audioContext.createGain();t.buffer=i,s.gain.value=r(this.soundOptions.volume.min/100,this.soundOptions.volume.max/100),s.connect(this.audioContext.destination),t.connect(s),t.start(0)}else this.init()}}class O{x;y;sx;sy;dx;dy;ctx;hue;speed;acceleration;traceLength;totalDistance;angle;brightness;coordinates=[];currentDistance=0;constructor({x:t,y:i,dx:s,dy:n,ctx:c,hue:l,speed:d,traceLength:u,acceleration:p}){for(this.x=t,this.y=i,this.sx=t,this.sy=i,this.dx=s,this.dy=n,this.ctx=c,this.hue=l,this.speed=d,this.traceLength=u,this.acceleration=p,this.totalDistance=g(t,i,s,n),this.angle=Math.atan2(n-i,s-t),this.brightness=a(50,70);this.traceLength--;)this.coordinates.push([t,i])}update(t){this.coordinates.pop(),this.coordinates.unshift([this.x,this.y]),this.speed*=this.acceleration;let i=Math.cos(this.angle)*this.speed,s=Math.sin(this.angle)*this.speed;this.currentDistance=g(this.sx,this.sy,this.x+i,this.y+s),this.currentDistance>=this.totalDistance?t(this.dx,this.dy,this.hue):(this.x+=i,this.y+=s)}draw(){let t=this.coordinates.length-1;this.ctx.beginPath(),this.ctx.moveTo(this.coordinates[t][0],this.coordinates[t][1]),this.ctx.lineTo(this.x,this.y),this.ctx.strokeStyle=x(this.hue,this.brightness),this.ctx.stroke()}}class w{target;container;canvas;ctx;width;height;traces=[];explosions=[];waitStopRaf;running=!1;opts;sound;resize;mouse;raf;constructor(t,i={}){this.target=t,this.container=t,this.opts=new R,this.createCanvas(this.target),this.updateOptions(i),this.sound=new z(this.opts),this.resize=new I(this.opts,this.updateSize.bind(this),this.container),this.mouse=new W(this.opts,this.canvas),this.raf=new M(this.opts,this.render.bind(this))}get isRunning(){return this.running}get version(){return"2.10.7"}get currentOptions(){return this.opts}start(){this.running||(this.canvas.isConnected||this.createCanvas(this.target),this.running=!0,this.resize.mount(),this.mouse.mount(),this.raf.mount())}stop(t=!1){!this.running||(this.running=!1,this.resize.unmount(),this.mouse.unmount(),this.raf.unmount(),this.clear(),t&&this.canvas.remove())}async waitStop(t){if(this.running)return new Promise(i=>{this.waitStopRaf=()=>{!this.waitStopRaf||(requestAnimationFrame(this.waitStopRaf),!this.traces.length&&!this.explosions.length&&(this.waitStopRaf=null,this.stop(t),i()))},this.waitStopRaf()})}pause(){this.running=!this.running,this.running?this.raf.mount():this.raf.unmount()}clear(){!this.ctx||(this.traces=[],this.explosions=[],this.ctx.clearRect(0,0,this.width,this.height))}launch(t=1){for(let i=0;ia(t.min,t.max)||this.mouse.active&&i.max>this.traces.length)&&(this.createTrace(),this.raf.tick=0)}drawTrace(){let t=this.traces.length;for(;t--;)this.traces[t].draw(),this.traces[t].update((i,s,n)=>{this.initExplosion(i,s,n),this.sound.play(),this.traces.splice(t,1)})}initExplosion(t,i,s){let{particles:n,flickering:c,lineWidth:l,explosion:d,brightness:u,friction:p,gravity:m,decay:f}=this.opts,J=h(n);for(;J--;)this.explosions.push(new k({x:t,y:i,ctx:this.ctx,hue:s,friction:p,gravity:m,flickering:a(0,100)<=c,lineWidth:r(l.explosion.min,l.explosion.max),explosionLength:h(d),brightness:u,decay:f}))}drawExplosion(){let t=this.explosions.length;for(;t--;)this.explosions[t].draw(),this.explosions[t].update(()=>{this.explosions.splice(t,1)})}}o.Fireworks=w,o.default=w,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});Shiny.addCustomMessageHandler("fireworks-start",function(o){let h,r;o.id==null?(h=document.createElement("div"),h.classList.add("fireworks-overlay","fireworks-full-screen"),document.body.appendChild(h),r="full-screen"):(h=document.getElementById(o.id),r=o.id);let a=new Fireworks.default(h,o.options);o.id!=null&&a.canvas.classList.add("fireworks-overlay"),a.start(),window[`fireworks-${r}`]=a});Shiny.addCustomMessageHandler("fireworks-stop",function(o){let h=o.id==null?"full-screen":o.id,r=window[`fireworks-${h}`].currentOptions,a=()=>{window[`fireworks-${h}`].stop(),o.id==null&&document.body.removeChild(document.querySelector(".fireworks-full-screen"))};o.fadeOut?(window[`fireworks-${h}`].updateOptions({...r,intensity:1}),setTimeout(()=>{a()},2e3)):a()}); diff --git a/inst/fireworks-0.1.0/dist/fireworks.min.js.map b/inst/fireworks-0.1.0/dist/fireworks.min.js.map index 8682745..f41750e 100644 --- a/inst/fireworks-0.1.0/dist/fireworks.min.js.map +++ b/inst/fireworks-0.1.0/dist/fireworks.min.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../../../node_modules/fireworks-js/dist/index.umd.js", "../../../srcjs/main.js"], - "sourcesContent": ["/**\n * name: fireworks-js\n * version: 2.10.7\n * author: Vitalij Ryndin (https://crashmax.ru)\n * homepage: https://fireworks.js.org\n * license MIT\n */\n(function(c,u){typeof exports==\"object\"&&typeof module<\"u\"?u(exports):typeof define==\"function\"&&define.amd?define([\"exports\"],u):(c=typeof globalThis<\"u\"?globalThis:c||self,u(c.Fireworks={}))})(this,function(c){\"use strict\";function u(e){return Math.abs(Math.floor(e))}function p(e,t){return Math.random()*(t-e)+e}function o(e,t){return Math.floor(p(e,t+1))}function g(e,t,i,s){const n=Math.pow;return Math.sqrt(n(e-i,2)+n(t-s,2))}function f(e,t,i=1){if(e>360||e<0)throw new Error(`Expected hue 0-360 range, got \\`${e}\\``);if(t>100||t<0)throw new Error(`Expected lightness 0-100 range, got \\`${t}\\``);if(i>1||i<0)throw new Error(`Expected alpha 0-1 range, got \\`${i}\\``);return`hsla(${e}, 100%, ${t}%, ${i})`}const v=e=>{if(typeof e==\"object\"&&e!==null){if(typeof Object.getPrototypeOf==\"function\"){const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}return Object.prototype.toString.call(e)===\"[object Object]\"}return!1},b=[\"__proto__\",\"constructor\",\"prototype\"],w=(...e)=>e.reduce((t,i)=>(Object.keys(i).forEach(s=>{b.includes(s)||(Array.isArray(t[s])&&Array.isArray(i[s])?t[s]=i[s]:v(t[s])&&v(i[s])?t[s]=w(t[s],i[s]):t[s]=i[s])}),t),{});function S(e,t){let i;return(...s)=>{i&&clearTimeout(i),i=setTimeout(()=>e(...s),t)}}class O{x;y;ctx;hue;friction;gravity;flickering;lineWidth;explosionLength;angle;speed;brightness;coordinates=[];decay;alpha=1;constructor({x:t,y:i,ctx:s,hue:n,decay:h,gravity:a,friction:r,brightness:l,flickering:d,lineWidth:x,explosionLength:m}){for(this.x=t,this.y=i,this.ctx=s,this.hue=n,this.gravity=a,this.friction=r,this.flickering=d,this.lineWidth=x,this.explosionLength=m,this.angle=p(0,Math.PI*2),this.speed=o(1,10),this.brightness=o(l.min,l.max),this.decay=p(h.min,h.max);this.explosionLength--;)this.coordinates.push([t,i])}update(t){this.coordinates.pop(),this.coordinates.unshift([this.x,this.y]),this.speed*=this.friction,this.x+=Math.cos(this.angle)*this.speed,this.y+=Math.sin(this.angle)*this.speed+this.gravity,this.alpha-=this.decay,this.alpha<=this.decay&&t()}draw(){const t=this.coordinates.length-1;this.ctx.beginPath(),this.ctx.lineWidth=this.lineWidth,this.ctx.fillStyle=f(this.hue,this.brightness,this.alpha),this.ctx.moveTo(this.coordinates[t][0],this.coordinates[t][1]),this.ctx.lineTo(this.x,this.y),this.ctx.strokeStyle=f(this.hue,this.flickering?p(0,this.brightness):this.brightness,this.alpha),this.ctx.stroke()}}class E{constructor(t,i){this.options=t,this.canvas=i,this.pointerDown=this.pointerDown.bind(this),this.pointerUp=this.pointerUp.bind(this),this.pointerMove=this.pointerMove.bind(this)}active=!1;x;y;get mouseOptions(){return this.options.mouse}mount(){this.canvas.addEventListener(\"pointerdown\",this.pointerDown),this.canvas.addEventListener(\"pointerup\",this.pointerUp),this.canvas.addEventListener(\"pointermove\",this.pointerMove)}unmount(){this.canvas.removeEventListener(\"pointerdown\",this.pointerDown),this.canvas.removeEventListener(\"pointerup\",this.pointerUp),this.canvas.removeEventListener(\"pointermove\",this.pointerMove)}usePointer(t,i){const{click:s,move:n}=this.mouseOptions;(s||n)&&(this.x=t.pageX-this.canvas.offsetLeft,this.y=t.pageY-this.canvas.offsetTop,this.active=i)}pointerDown(t){this.usePointer(t,this.mouseOptions.click)}pointerUp(t){this.usePointer(t,!1)}pointerMove(t){this.usePointer(t,this.active)}}class M{hue;rocketsPoint;opacity;acceleration;friction;gravity;particles;explosion;mouse;boundaries;sound;delay;brightness;decay;flickering;intensity;traceLength;traceSpeed;lineWidth;lineStyle;autoresize;constructor(){this.autoresize=!0,this.lineStyle=\"round\",this.flickering=50,this.traceLength=3,this.traceSpeed=10,this.intensity=30,this.explosion=5,this.gravity=1.5,this.opacity=.5,this.particles=50,this.friction=.95,this.acceleration=1.05,this.hue={min:0,max:360},this.rocketsPoint={min:50,max:50},this.lineWidth={explosion:{min:1,max:3},trace:{min:1,max:2}},this.mouse={click:!1,move:!1,max:1},this.delay={min:30,max:60},this.brightness={min:50,max:80},this.decay={min:.015,max:.03},this.sound={enabled:!1,files:[\"explosion0.mp3\",\"explosion1.mp3\",\"explosion2.mp3\"],volume:{min:4,max:8}},this.boundaries={debug:!1,height:0,width:0,x:50,y:50}}update(t){Object.assign(this,w(this,t))}}class z{constructor(t,i){this.options=t,this.render=i}tick=0;rafId=0;fps=60;tolerance=.1;now;mount(){this.now=performance.now();const t=1e3/this.fps,i=s=>{this.rafId=requestAnimationFrame(i);const n=s-this.now;n>=t-this.tolerance&&(this.render(),this.now=s-n%t,this.tick+=n*(this.options.intensity*Math.PI)/1e3)};this.rafId=requestAnimationFrame(i)}unmount(){cancelAnimationFrame(this.rafId)}}class L{constructor(t,i,s){this.options=t,this.updateSize=i,this.container=s}resizer;mount(){if(!this.resizer){const t=S(()=>this.updateSize(),100);this.resizer=new ResizeObserver(t)}this.options.autoresize&&this.resizer.observe(this.container)}unmount(){this.resizer&&this.resizer.unobserve(this.container)}}class T{constructor(t){this.options=t,this.init()}buffers=[];audioContext;onInit=!1;get isEnabled(){return this.options.sound.enabled}get soundOptions(){return this.options.sound}init(){!this.onInit&&this.isEnabled&&(this.onInit=!0,this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.loadSounds())}async loadSounds(){for(const t of this.soundOptions.files){const i=await(await fetch(t)).arrayBuffer();this.audioContext.decodeAudioData(i).then(s=>{this.buffers.push(s)}).catch(s=>{throw s})}}play(){if(this.isEnabled&&this.buffers.length){const t=this.audioContext.createBufferSource(),i=this.buffers[o(0,this.buffers.length-1)],s=this.audioContext.createGain();t.buffer=i,s.gain.value=p(this.soundOptions.volume.min/100,this.soundOptions.volume.max/100),s.connect(this.audioContext.destination),t.connect(s),t.start(0)}else this.init()}}class C{x;y;sx;sy;dx;dy;ctx;hue;speed;acceleration;traceLength;totalDistance;angle;brightness;coordinates=[];currentDistance=0;constructor({x:t,y:i,dx:s,dy:n,ctx:h,hue:a,speed:r,traceLength:l,acceleration:d}){for(this.x=t,this.y=i,this.sx=t,this.sy=i,this.dx=s,this.dy=n,this.ctx=h,this.hue=a,this.speed=r,this.traceLength=l,this.acceleration=d,this.totalDistance=g(t,i,s,n),this.angle=Math.atan2(n-i,s-t),this.brightness=o(50,70);this.traceLength--;)this.coordinates.push([t,i])}update(t){this.coordinates.pop(),this.coordinates.unshift([this.x,this.y]),this.speed*=this.acceleration;const i=Math.cos(this.angle)*this.speed,s=Math.sin(this.angle)*this.speed;this.currentDistance=g(this.sx,this.sy,this.x+i,this.y+s),this.currentDistance>=this.totalDistance?t(this.dx,this.dy,this.hue):(this.x+=i,this.y+=s)}draw(){const t=this.coordinates.length-1;this.ctx.beginPath(),this.ctx.moveTo(this.coordinates[t][0],this.coordinates[t][1]),this.ctx.lineTo(this.x,this.y),this.ctx.strokeStyle=f(this.hue,this.brightness),this.ctx.stroke()}}class y{target;container;canvas;ctx;width;height;traces=[];explosions=[];waitStopRaf;running=!1;opts;sound;resize;mouse;raf;constructor(t,i={}){this.target=t,this.container=t,this.opts=new M,this.createCanvas(this.target),this.updateOptions(i),this.sound=new T(this.opts),this.resize=new L(this.opts,this.updateSize.bind(this),this.container),this.mouse=new E(this.opts,this.canvas),this.raf=new z(this.opts,this.render.bind(this))}get isRunning(){return this.running}get version(){return\"2.10.7\"}get currentOptions(){return this.opts}start(){this.running||(this.canvas.isConnected||this.createCanvas(this.target),this.running=!0,this.resize.mount(),this.mouse.mount(),this.raf.mount())}stop(t=!1){!this.running||(this.running=!1,this.resize.unmount(),this.mouse.unmount(),this.raf.unmount(),this.clear(),t&&this.canvas.remove())}async waitStop(t){if(!!this.running)return new Promise(i=>{this.waitStopRaf=()=>{!this.waitStopRaf||(requestAnimationFrame(this.waitStopRaf),!this.traces.length&&!this.explosions.length&&(this.waitStopRaf=null,this.stop(t),i()))},this.waitStopRaf()})}pause(){this.running=!this.running,this.running?this.raf.mount():this.raf.unmount()}clear(){!this.ctx||(this.traces=[],this.explosions=[],this.ctx.clearRect(0,0,this.width,this.height))}launch(t=1){for(let i=0;io(t.min,t.max)||this.mouse.active&&i.max>this.traces.length)&&(this.createTrace(),this.raf.tick=0)}drawTrace(){let t=this.traces.length;for(;t--;)this.traces[t].draw(),this.traces[t].update((i,s,n)=>{this.initExplosion(i,s,n),this.sound.play(),this.traces.splice(t,1)})}initExplosion(t,i,s){const{particles:n,flickering:h,lineWidth:a,explosion:r,brightness:l,friction:d,gravity:x,decay:m}=this.opts;let P=u(n);for(;P--;)this.explosions.push(new O({x:t,y:i,ctx:this.ctx,hue:s,friction:d,gravity:x,flickering:o(0,100)<=h,lineWidth:p(a.explosion.min,a.explosion.max),explosionLength:u(r),brightness:l,decay:m}))}drawExplosion(){let t=this.explosions.length;for(;t--;)this.explosions[t].draw(),this.explosions[t].update(()=>{this.explosions.splice(t,1)})}}c.Fireworks=y,c.default=y,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:\"Module\"}})});\n", "import \"../node_modules/fireworks-js/dist/index.umd.js\";\nimport \"../styles/main.scss\";\n\nShiny.addCustomMessageHandler(\"fireworks-start\", function(message) {\n let container;\n let identifier;\n\n if (message.id == null) {\n container = document.createElement(\"div\");\n container.classList.add(\"fireworks-overlay\", \"fireworks-full-screen\");\n // append container to document\n document.body.appendChild(container);\n identifier = \"full-screen\";\n } else {\n container = document.getElementById(message.id);\n identifier = message.id;\n }\n\n const fireworks = new Fireworks.default(container, message.options);\n\n // if fireworks are on id, add fireworks-overlay class to canvas tag\n if (message.id != null) {\n fireworks.canvas.classList.add(\"fireworks-overlay\");\n }\n\n fireworks.start();\n\n // make fireworks available outside of this function\n window[`fireworks-${identifier}`] = fireworks;\n});\n\nShiny.addCustomMessageHandler(\"fireworks-stop\", function(message) {\n const identifier = message.id == null ? \"full-screen\" : message.id;\n window[`fireworks-${identifier}`].stop();\n\n if (message.id == null) {\n document.body.removeChild(document.querySelector(\".fireworks-full-screen\"));\n }\n});\n\n"], - "mappings": "CAOC,SAASA,EAAEC,EAAE,CAAC,OAAO,SAAS,UAAU,OAAO,OAAO,IAAIA,EAAE,OAAO,EAAE,OAAO,QAAQ,YAAY,OAAO,IAAI,OAAO,CAAC,SAAS,EAAEA,CAAC,GAAGD,EAAE,OAAO,WAAW,IAAI,WAAWA,GAAG,KAAKC,EAAED,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,OAAK,SAASA,EAAE,CAAC,aAAa,SAASC,EAAE,EAAE,CAAC,OAAO,KAAK,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,SAASC,EAAE,EAAE,EAAE,CAAC,OAAO,KAAK,OAAO,GAAG,EAAE,GAAG,CAAC,CAAC,SAASC,EAAE,EAAE,EAAE,CAAC,OAAO,KAAK,MAAMD,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAM,EAAE,KAAK,IA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AChE,IAAME,EAAaF,EAAQ,IAAM,KAAO,cAAgBA,EAAQ,GAChE,OAAO,aAAaE,CAAU,EAAE,EAAE,KAAK,EAEnCF,EAAQ,IAAM,MAChB,SAAS,KAAK,YAAY,SAAS,cAAc,wBAAwB,CAAC,CAE9E,CAAC", - "names": ["c", "u", "p", "o", "f", "v", "b", "w", "S", "O", "h", "a", "r", "l", "d", "x", "m", "E", "M", "z", "L", "T", "C", "y", "P", "message", "container", "identifier", "fireworks"] + "sourcesContent": ["/**\n * name: fireworks-js\n * version: 2.10.7\n * author: Vitalij Ryndin (https://crashmax.ru)\n * homepage: https://fireworks.js.org\n * license MIT\n */\n(function(c,u){typeof exports==\"object\"&&typeof module<\"u\"?u(exports):typeof define==\"function\"&&define.amd?define([\"exports\"],u):(c=typeof globalThis<\"u\"?globalThis:c||self,u(c.Fireworks={}))})(this,function(c){\"use strict\";function u(e){return Math.abs(Math.floor(e))}function p(e,t){return Math.random()*(t-e)+e}function o(e,t){return Math.floor(p(e,t+1))}function g(e,t,i,s){const n=Math.pow;return Math.sqrt(n(e-i,2)+n(t-s,2))}function f(e,t,i=1){if(e>360||e<0)throw new Error(`Expected hue 0-360 range, got \\`${e}\\``);if(t>100||t<0)throw new Error(`Expected lightness 0-100 range, got \\`${t}\\``);if(i>1||i<0)throw new Error(`Expected alpha 0-1 range, got \\`${i}\\``);return`hsla(${e}, 100%, ${t}%, ${i})`}const v=e=>{if(typeof e==\"object\"&&e!==null){if(typeof Object.getPrototypeOf==\"function\"){const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}return Object.prototype.toString.call(e)===\"[object Object]\"}return!1},b=[\"__proto__\",\"constructor\",\"prototype\"],w=(...e)=>e.reduce((t,i)=>(Object.keys(i).forEach(s=>{b.includes(s)||(Array.isArray(t[s])&&Array.isArray(i[s])?t[s]=i[s]:v(t[s])&&v(i[s])?t[s]=w(t[s],i[s]):t[s]=i[s])}),t),{});function S(e,t){let i;return(...s)=>{i&&clearTimeout(i),i=setTimeout(()=>e(...s),t)}}class O{x;y;ctx;hue;friction;gravity;flickering;lineWidth;explosionLength;angle;speed;brightness;coordinates=[];decay;alpha=1;constructor({x:t,y:i,ctx:s,hue:n,decay:h,gravity:a,friction:r,brightness:l,flickering:d,lineWidth:x,explosionLength:m}){for(this.x=t,this.y=i,this.ctx=s,this.hue=n,this.gravity=a,this.friction=r,this.flickering=d,this.lineWidth=x,this.explosionLength=m,this.angle=p(0,Math.PI*2),this.speed=o(1,10),this.brightness=o(l.min,l.max),this.decay=p(h.min,h.max);this.explosionLength--;)this.coordinates.push([t,i])}update(t){this.coordinates.pop(),this.coordinates.unshift([this.x,this.y]),this.speed*=this.friction,this.x+=Math.cos(this.angle)*this.speed,this.y+=Math.sin(this.angle)*this.speed+this.gravity,this.alpha-=this.decay,this.alpha<=this.decay&&t()}draw(){const t=this.coordinates.length-1;this.ctx.beginPath(),this.ctx.lineWidth=this.lineWidth,this.ctx.fillStyle=f(this.hue,this.brightness,this.alpha),this.ctx.moveTo(this.coordinates[t][0],this.coordinates[t][1]),this.ctx.lineTo(this.x,this.y),this.ctx.strokeStyle=f(this.hue,this.flickering?p(0,this.brightness):this.brightness,this.alpha),this.ctx.stroke()}}class E{constructor(t,i){this.options=t,this.canvas=i,this.pointerDown=this.pointerDown.bind(this),this.pointerUp=this.pointerUp.bind(this),this.pointerMove=this.pointerMove.bind(this)}active=!1;x;y;get mouseOptions(){return this.options.mouse}mount(){this.canvas.addEventListener(\"pointerdown\",this.pointerDown),this.canvas.addEventListener(\"pointerup\",this.pointerUp),this.canvas.addEventListener(\"pointermove\",this.pointerMove)}unmount(){this.canvas.removeEventListener(\"pointerdown\",this.pointerDown),this.canvas.removeEventListener(\"pointerup\",this.pointerUp),this.canvas.removeEventListener(\"pointermove\",this.pointerMove)}usePointer(t,i){const{click:s,move:n}=this.mouseOptions;(s||n)&&(this.x=t.pageX-this.canvas.offsetLeft,this.y=t.pageY-this.canvas.offsetTop,this.active=i)}pointerDown(t){this.usePointer(t,this.mouseOptions.click)}pointerUp(t){this.usePointer(t,!1)}pointerMove(t){this.usePointer(t,this.active)}}class M{hue;rocketsPoint;opacity;acceleration;friction;gravity;particles;explosion;mouse;boundaries;sound;delay;brightness;decay;flickering;intensity;traceLength;traceSpeed;lineWidth;lineStyle;autoresize;constructor(){this.autoresize=!0,this.lineStyle=\"round\",this.flickering=50,this.traceLength=3,this.traceSpeed=10,this.intensity=30,this.explosion=5,this.gravity=1.5,this.opacity=.5,this.particles=50,this.friction=.95,this.acceleration=1.05,this.hue={min:0,max:360},this.rocketsPoint={min:50,max:50},this.lineWidth={explosion:{min:1,max:3},trace:{min:1,max:2}},this.mouse={click:!1,move:!1,max:1},this.delay={min:30,max:60},this.brightness={min:50,max:80},this.decay={min:.015,max:.03},this.sound={enabled:!1,files:[\"explosion0.mp3\",\"explosion1.mp3\",\"explosion2.mp3\"],volume:{min:4,max:8}},this.boundaries={debug:!1,height:0,width:0,x:50,y:50}}update(t){Object.assign(this,w(this,t))}}class z{constructor(t,i){this.options=t,this.render=i}tick=0;rafId=0;fps=60;tolerance=.1;now;mount(){this.now=performance.now();const t=1e3/this.fps,i=s=>{this.rafId=requestAnimationFrame(i);const n=s-this.now;n>=t-this.tolerance&&(this.render(),this.now=s-n%t,this.tick+=n*(this.options.intensity*Math.PI)/1e3)};this.rafId=requestAnimationFrame(i)}unmount(){cancelAnimationFrame(this.rafId)}}class L{constructor(t,i,s){this.options=t,this.updateSize=i,this.container=s}resizer;mount(){if(!this.resizer){const t=S(()=>this.updateSize(),100);this.resizer=new ResizeObserver(t)}this.options.autoresize&&this.resizer.observe(this.container)}unmount(){this.resizer&&this.resizer.unobserve(this.container)}}class T{constructor(t){this.options=t,this.init()}buffers=[];audioContext;onInit=!1;get isEnabled(){return this.options.sound.enabled}get soundOptions(){return this.options.sound}init(){!this.onInit&&this.isEnabled&&(this.onInit=!0,this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.loadSounds())}async loadSounds(){for(const t of this.soundOptions.files){const i=await(await fetch(t)).arrayBuffer();this.audioContext.decodeAudioData(i).then(s=>{this.buffers.push(s)}).catch(s=>{throw s})}}play(){if(this.isEnabled&&this.buffers.length){const t=this.audioContext.createBufferSource(),i=this.buffers[o(0,this.buffers.length-1)],s=this.audioContext.createGain();t.buffer=i,s.gain.value=p(this.soundOptions.volume.min/100,this.soundOptions.volume.max/100),s.connect(this.audioContext.destination),t.connect(s),t.start(0)}else this.init()}}class C{x;y;sx;sy;dx;dy;ctx;hue;speed;acceleration;traceLength;totalDistance;angle;brightness;coordinates=[];currentDistance=0;constructor({x:t,y:i,dx:s,dy:n,ctx:h,hue:a,speed:r,traceLength:l,acceleration:d}){for(this.x=t,this.y=i,this.sx=t,this.sy=i,this.dx=s,this.dy=n,this.ctx=h,this.hue=a,this.speed=r,this.traceLength=l,this.acceleration=d,this.totalDistance=g(t,i,s,n),this.angle=Math.atan2(n-i,s-t),this.brightness=o(50,70);this.traceLength--;)this.coordinates.push([t,i])}update(t){this.coordinates.pop(),this.coordinates.unshift([this.x,this.y]),this.speed*=this.acceleration;const i=Math.cos(this.angle)*this.speed,s=Math.sin(this.angle)*this.speed;this.currentDistance=g(this.sx,this.sy,this.x+i,this.y+s),this.currentDistance>=this.totalDistance?t(this.dx,this.dy,this.hue):(this.x+=i,this.y+=s)}draw(){const t=this.coordinates.length-1;this.ctx.beginPath(),this.ctx.moveTo(this.coordinates[t][0],this.coordinates[t][1]),this.ctx.lineTo(this.x,this.y),this.ctx.strokeStyle=f(this.hue,this.brightness),this.ctx.stroke()}}class y{target;container;canvas;ctx;width;height;traces=[];explosions=[];waitStopRaf;running=!1;opts;sound;resize;mouse;raf;constructor(t,i={}){this.target=t,this.container=t,this.opts=new M,this.createCanvas(this.target),this.updateOptions(i),this.sound=new T(this.opts),this.resize=new L(this.opts,this.updateSize.bind(this),this.container),this.mouse=new E(this.opts,this.canvas),this.raf=new z(this.opts,this.render.bind(this))}get isRunning(){return this.running}get version(){return\"2.10.7\"}get currentOptions(){return this.opts}start(){this.running||(this.canvas.isConnected||this.createCanvas(this.target),this.running=!0,this.resize.mount(),this.mouse.mount(),this.raf.mount())}stop(t=!1){!this.running||(this.running=!1,this.resize.unmount(),this.mouse.unmount(),this.raf.unmount(),this.clear(),t&&this.canvas.remove())}async waitStop(t){if(!!this.running)return new Promise(i=>{this.waitStopRaf=()=>{!this.waitStopRaf||(requestAnimationFrame(this.waitStopRaf),!this.traces.length&&!this.explosions.length&&(this.waitStopRaf=null,this.stop(t),i()))},this.waitStopRaf()})}pause(){this.running=!this.running,this.running?this.raf.mount():this.raf.unmount()}clear(){!this.ctx||(this.traces=[],this.explosions=[],this.ctx.clearRect(0,0,this.width,this.height))}launch(t=1){for(let i=0;io(t.min,t.max)||this.mouse.active&&i.max>this.traces.length)&&(this.createTrace(),this.raf.tick=0)}drawTrace(){let t=this.traces.length;for(;t--;)this.traces[t].draw(),this.traces[t].update((i,s,n)=>{this.initExplosion(i,s,n),this.sound.play(),this.traces.splice(t,1)})}initExplosion(t,i,s){const{particles:n,flickering:h,lineWidth:a,explosion:r,brightness:l,friction:d,gravity:x,decay:m}=this.opts;let P=u(n);for(;P--;)this.explosions.push(new O({x:t,y:i,ctx:this.ctx,hue:s,friction:d,gravity:x,flickering:o(0,100)<=h,lineWidth:p(a.explosion.min,a.explosion.max),explosionLength:u(r),brightness:l,decay:m}))}drawExplosion(){let t=this.explosions.length;for(;t--;)this.explosions[t].draw(),this.explosions[t].update(()=>{this.explosions.splice(t,1)})}}c.Fireworks=y,c.default=y,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:\"Module\"}})});\n", "import \"../node_modules/fireworks-js/dist/index.umd.js\";\nimport \"../styles/main.scss\";\n\nShiny.addCustomMessageHandler(\"fireworks-start\", function(message) {\n let container;\n let identifier;\n\n if (message.id == null) {\n container = document.createElement(\"div\");\n container.classList.add(\"fireworks-overlay\", \"fireworks-full-screen\");\n // append container to document\n document.body.appendChild(container);\n identifier = \"full-screen\";\n } else {\n container = document.getElementById(message.id);\n identifier = message.id;\n }\n\n const fireworks = new Fireworks.default(container, message.options);\n\n // if fireworks are on id, add fireworks-overlay class to canvas tag\n if (message.id != null) {\n fireworks.canvas.classList.add(\"fireworks-overlay\");\n }\n\n fireworks.start();\n\n // make fireworks available outside of this function\n window[`fireworks-${identifier}`] = fireworks;\n});\n\nShiny.addCustomMessageHandler(\"fireworks-stop\", function(message) {\n const identifier = message.id == null ? \"full-screen\" : message.id;\n const currentOpts = window[`fireworks-${identifier}`].currentOptions;\n\n const stopFireworks = () => {\n window[`fireworks-${identifier}`].stop();\n if (message.id == null) {\n document.body.removeChild(\n document.querySelector(\".fireworks-full-screen\")\n );\n }\n };\n\n if (message.fadeOut) {\n window[`fireworks-${identifier}`].updateOptions({\n ...currentOpts,\n intensity: 1\n });\n // add 2000 ms delay to allow fireworks to fade out\n setTimeout(() => {\n stopFireworks();\n }, 2000);\n } else {\n stopFireworks();\n }\n});\n\n"], + "mappings": "CAOC,SAASA,EAAEC,EAAE,CAAC,OAAO,SAAS,UAAU,OAAO,OAAO,IAAIA,EAAE,OAAO,EAAE,OAAO,QAAQ,YAAY,OAAO,IAAI,OAAO,CAAC,SAAS,EAAEA,CAAC,GAAGD,EAAE,OAAO,WAAW,IAAI,WAAWA,GAAG,KAAKC,EAAED,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,OAAK,SAASA,EAAE,CAAC,aAAa,SAASC,EAAE,EAAE,CAAC,OAAO,KAAK,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,SAASC,EAAE,EAAE,EAAE,CAAC,OAAO,KAAK,OAAO,GAAG,EAAE,GAAG,CAAC,CAAC,SAASC,EAAE,EAAE,EAAE,CAAC,OAAO,KAAK,MAAMD,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,IAAM,EAAE,KAAK,IAAI,OAAO,KAAK,KAAK,EAAE,EAAE,EAAE,CA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BA,EAAQ,GAC1DI,EAAc,OAAO,aAAaF,CAAU,EAAE,EAAE,eAEhDG,EAAgB,IAAM,CAC1B,OAAO,aAAaH,CAAU,EAAE,EAAE,KAAK,EACnCF,EAAQ,IAAM,MAChB,SAAS,KAAK,YACZ,SAAS,cAAc,wBAAwB,CACjD,CAEJ,EAEIA,EAAQ,SACV,OAAO,aAAaE,CAAU,EAAE,EAAE,cAAc,CAC9C,GAAGE,EACH,UAAW,CACb,CAAC,EAED,WAAW,IAAM,CACfC,EAAc,CAChB,EAAG,GAAI,GAEPA,EAAc,CAElB,CAAC", + "names": ["c", "u", "p", "o", "f", "v", "b", "w", "S", "O", "h", "a", "r", "l", "d", "x", "m", "E", "M", "z", "L", "T", "C", "y", "P", "message", "container", "identifier", "fireworks", "currentOpts", "stopFireworks"] } diff --git a/inst/images/fireworks-fadeout.gif b/inst/images/fireworks-fadeout.gif new file mode 100644 index 0000000..c8f8861 Binary files /dev/null and b/inst/images/fireworks-fadeout.gif differ diff --git a/man/fireworksClass.Rd b/man/fireworksClass.Rd index f771f9b..aaaa612 100644 --- a/man/fireworksClass.Rd +++ b/man/fireworksClass.Rd @@ -23,15 +23,15 @@ the fireworks show, and \code{stop} the fireworks show. \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-fireworks-new}{\code{Fireworks$new()}} -\item \href{#method-fireworks-start}{\code{Fireworks$start()}} -\item \href{#method-fireworks-stop}{\code{Fireworks$stop()}} -\item \href{#method-fireworks-clone}{\code{Fireworks$clone()}} +\item \href{#method-Fireworks-new}{\code{Fireworks$new()}} +\item \href{#method-Fireworks-start}{\code{Fireworks$start()}} +\item \href{#method-Fireworks-stop}{\code{Fireworks$stop()}} +\item \href{#method-Fireworks-clone}{\code{Fireworks$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-fireworks-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Fireworks-new}{}}} \subsection{Method \code{new()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Fireworks$new( @@ -67,8 +67,8 @@ Create fireworks. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-fireworks-start}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Fireworks-start}{}}} \subsection{Method \code{start()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{Fireworks$start()}\if{html}{\out{
}} @@ -80,21 +80,29 @@ Start fireworks. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-fireworks-stop}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Fireworks-stop}{}}} \subsection{Method \code{stop()}}{ \subsection{Usage}{ -\if{html}{\out{
}}\preformatted{Fireworks$stop()}\if{html}{\out{
}} +\if{html}{\out{
}}\preformatted{Fireworks$stop(fadeOut = FALSE)}\if{html}{\out{
}} } +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{fadeOut}}{Whether to fade out the fireworks before stopping. Note that +this will take 2000ms to complete.} +} +\if{html}{\out{
}} +} \subsection{Details}{ Stop the fireworks } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-fireworks-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-Fireworks-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/srcjs/main.js b/srcjs/main.js index 7dcc028..2049001 100644 --- a/srcjs/main.js +++ b/srcjs/main.js @@ -31,10 +31,28 @@ Shiny.addCustomMessageHandler("fireworks-start", function(message) { Shiny.addCustomMessageHandler("fireworks-stop", function(message) { const identifier = message.id == null ? "full-screen" : message.id; - window[`fireworks-${identifier}`].stop(); - - if (message.id == null) { - document.body.removeChild(document.querySelector(".fireworks-full-screen")); + const currentOpts = window[`fireworks-${identifier}`].currentOptions; + + const stopFireworks = () => { + window[`fireworks-${identifier}`].stop(); + if (message.id == null) { + document.body.removeChild( + document.querySelector(".fireworks-full-screen") + ); + } + }; + + if (message.fadeOut) { + window[`fireworks-${identifier}`].updateOptions({ + ...currentOpts, + intensity: 1 + }); + // add 2000 ms delay to allow fireworks to fade out + setTimeout(() => { + stopFireworks(); + }, 2000); + } else { + stopFireworks(); } });