svelte-gestures
Advanced tools
Comparing version 5.1.0-beta.3 to 5.1.0-beta.4
@@ -1083,3 +1083,3 @@ const DEFAULT_DELAY = 300; // ms | ||
let canvas = undefined; | ||
let ctx; | ||
let ctx = null; | ||
let offScreenCanvas = undefined; | ||
@@ -1094,9 +1094,10 @@ let offScreenCtx; | ||
function animate() { | ||
const fadeTime = options.fadeTime ?? fallbacks.fadeTime; | ||
const now = Date.now(); | ||
const deltaTime = now - animationStepTime; | ||
if (deltaTime > 100) { | ||
if (deltaTime > fadeTime / 20) { | ||
if (ctx && offScreenCanvas && offScreenCtx && canvas) { | ||
offScreenCtx.drawImage(canvas, 0, 0); | ||
ctx.clearRect(0, 0, canvas.width, canvas.height); | ||
ctx.globalAlpha = 1 - deltaTime * 3 / (options.fadeTime ?? fallbacks.fadeTime); | ||
ctx.globalAlpha = 1 - deltaTime * 3 / fadeTime; | ||
ctx.drawImage(offScreenCanvas, 0, 0); | ||
@@ -1103,0 +1104,0 @@ ctx.globalAlpha = 1; |
@@ -1084,3 +1084,3 @@ 'use strict'; | ||
let canvas = undefined; | ||
let ctx; | ||
let ctx = null; | ||
let offScreenCanvas = undefined; | ||
@@ -1095,10 +1095,11 @@ let offScreenCtx; | ||
function animate() { | ||
var _options$fadeTime; | ||
const fadeTime = (_options$fadeTime = options.fadeTime) !== null && _options$fadeTime !== void 0 ? _options$fadeTime : fallbacks.fadeTime; | ||
const now = Date.now(); | ||
const deltaTime = now - animationStepTime; | ||
if (deltaTime > 100) { | ||
if (deltaTime > fadeTime / 20) { | ||
if (ctx && offScreenCanvas && offScreenCtx && canvas) { | ||
var _options$fadeTime; | ||
offScreenCtx.drawImage(canvas, 0, 0); | ||
ctx.clearRect(0, 0, canvas.width, canvas.height); | ||
ctx.globalAlpha = 1 - deltaTime * 3 / ((_options$fadeTime = options.fadeTime) !== null && _options$fadeTime !== void 0 ? _options$fadeTime : fallbacks.fadeTime); | ||
ctx.globalAlpha = 1 - deltaTime * 3 / fadeTime; | ||
ctx.drawImage(offScreenCanvas, 0, 0); | ||
@@ -1105,0 +1106,0 @@ ctx.globalAlpha = 1; |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "5.1.0-beta.3", | ||
"version": "5.1.0-beta.4", | ||
"main": "dist/index.svelte.js", | ||
@@ -9,0 +9,0 @@ "module": "dist/index.esm.svelte.js", |
100820
2423