canvas-splash-screen
Advanced tools
@@ -72,3 +72,3 @@ "use strict"; | ||
const maxSize = Math.max(canvasElement.width, canvasElement.height) * 20; | ||
const animationProps = { size, angle: 0, opacity: 1, offsetX: 0, offsetY: 0 }; | ||
const animationProps = { size, angle: 0, opacity: 1, offsetX, offsetY }; | ||
const svgImage = new Image(); | ||
@@ -120,8 +120,5 @@ svgImage.src = svgBase64; | ||
ctx.fillRect(0, 0, canvasElement.width, canvasElement.height); | ||
ctx.translate( | ||
centerX + animationProps.offsetX, | ||
centerY + animationProps.offsetY | ||
); | ||
ctx.translate(centerX, centerY); | ||
ctx.rotate(animationProps.angle * Math.PI / 180); | ||
let scaleFactor = animationProps.size / svgImage.width; | ||
ctx.rotate(animationProps.angle * Math.PI / 180); | ||
ctx.scale(scaleFactor, scaleFactor); | ||
@@ -132,6 +129,3 @@ ctx.globalCompositeOperation = "destination-out"; | ||
ctx.save(); | ||
ctx.translate( | ||
centerX + animationProps.offsetX, | ||
centerY + animationProps.offsetY | ||
); | ||
ctx.translate(centerX, centerY); | ||
ctx.rotate(animationProps.angle * Math.PI / 180); | ||
@@ -138,0 +132,0 @@ ctx.scale(scaleFactor, scaleFactor); |
{ | ||
"name": "canvas-splash-screen", | ||
"author": "Julio Merisio <contatomerisio@gmail.com>", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A canvas splash screen animation", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
28395
-2.54%339
-3.42%