canvas实现数字燃烧火焰交互动画效果代码
代码语言:html
所属分类:动画
代码描述:canvas实现数字燃烧火焰交互动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> /* global */ *, *::before, *::after { margin: 0; padding: 0; border: 0; box-sizing: border-box; } *:focus { outline: none; } body { height: 100vh; overflow: hidden; } canvas { touch-action: none; } </style> </head> <body translate="no"> <script> const imageSrc = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAyAAAAJYCAMAAACtqHJCAAAAolBMVEUAAAAHBwejo6N/f3+JiYkLCwumpqagoKAODg5AQEASEhJnZ2dHR0ciIiKWlpaPj49iYmI3NzeFhYWdnZ1UVFQWFhYZGRmTk5NQUFAzMzMwMDA9PT1ERER0dHRubm4mJiaLi4tbW1upqal8fHxLS0t5eXkfHx86OjqCgoIkJCRra2ssLCxxcXFfX18cHBwqKipYWFiYmJiamppNTU12dnbx8fFoixjQAAAgq0lEQVR42uzBgQAAAACAoP2pF6kCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGB26NwEQBgAAKBiI2hhYeFDDCGkk1TZfzYLV7CSuxEOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgO/0Y437OW9rWqY7tJKHVy4tXNOS1m0+j1jHvvs7Ezzs3Qd6m0AQhuF/V4CoAlXUUe/Ndu5/tjyOIhIncWyLQdpF8x7hM4OXFeU3oplU/fFmXovrZSkrxnS4b/fWQdDCWSsIjr1GNJzWKlLK57g2iBr9TlDAw4NLsD8OiKNz2r3+tePd7IDP2o6ndVkPp9GsszBRCFyCvSXcre+tKrI+6OFKQRTKuuH5W1frMyiXYH8QrWpjEMv45CIzMY5fT7qJnufPgpewnWFJW0PHxj3Yx5dvT3JaBaF+WDb2HRd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nSAsac+SsZBoUq8ZvA7DzvTtHSOqZ0T1nzwVyb4cECrztxpBkUqsSvjEGqew4ejuYskeS7x19FEs3GA40077yTalCoEr+iYtZhKeGRZiyajKUr8RPf+12vwEMEHZYspJpmqhJ/M4YT73HXyCLqbmPp5lZ/3jSazEbVKNWynjwTblXiA9ag9Nh0haqZrj5vSbFG8Qlj6LtsguoUU+aVQylnmarEOyF6DV2fEKpi2ey4rcXV8V2wsCOWBqiAGenL3lDSCYUq8S4qTLup674F0Sxf1zvlIqzN1fGdNZh09OMBIrWaLNq2Vk/fg1IlbsMds1wemXcwIMhoyrod33RqFuIHvhrZma6nK9zPsV09Ss9Dq2b3CVXiDxQOZ/bSZWzZC3GHsZ+xbpb2FvIt3l05NMzJ1GV6YuJGNEp0Fk3L1r4uswlV4jMUjOO+Pc1OjHlpb4ArWKbfYazrzf1zu6jnB8dfyNqbh7RzZCxbtyx81bCfuJoeLdODOa7p7VKV+BDf7ePZxE6W2VFnGjtl09Tu9eOh43BcOJu41bOTpadrTHezRlr2zWEh/8LE1SjYL2aT9bTpdpnGvGVi98w4XjnOjz87jtOOe/624Z0YYyevk9iH1mD1SgNClXgHD53NIB6de5PSXqfJ23za+Gk6T7Zruzz0Z2Z74wQv8pnxEQqcTduc9Q+lnabbS4zpfP6WpLY/6c1G8WAcGq87HFQJRVEURVEURVEURVEURVEURVEU5T/24EAAAAAAAMj/tRFUVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVaU9OCQAAAAAEPT/tS9MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALwCaQyY8c50kmUAAAAASUVORK5CYII='; ; </script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/Stats-16.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/dat.gui-min.js"></script> <script> //--- 'use strict'; //--- console.clear(); //--- let w = 0; let h = 0; let animationFrame = null; let isTouchDevice = false; const canvas = document.createElement('canvas'); const context = canvas.getContext('2d', { willReadFrequently: false, alpha: false }); let imageData = null; let data = null; const center = { x: w / 2, y: h / 2 }; let pointerPos = { x: center.x, y: center.y }; let pointerPosSave = { x: pointerPos.x, y: pointerPos.y }; let pointerDownButton = -1; //--- const FLAME_COLORS = [ 255, 255, 255, 230, 230, 250, 255, 255, 0, 255, 215, 0, 255, 105, 180, 255, 99, 71, 72, 61, 139, 34, 34, 34, 26, 26, 26, 17, 17, 17]; let flameColorDepth = 39; let flameColorTable = createGradient(FLAME_COLORS, flameColorDepth); let flameColorTableLength = Math.round(flameColorTable.length / 3) - 1; let gridWidth = 0; let gridHeight = 0; let windStrength = 0; let windDirection = 0; let pixelSize = 2; let pixelSizeSquared = pixelSize * pixelSize; let pixelHolderLength = 0; let pixelHolder = null; let pixelBufferHolder = null; let pixelImageBufferHolder = null; let pixelSpreadFrom = null; let pixelSpreadFromLengthPreCalc = 0; const RANDOM_TABLE_SIZE = 512; // Power of 2 const RANDOM_TABLE_MASK = RANDOM_TABLE_SIZE - 1; const randomTable = new Float32Array(RANDOM_TABLE_SIZE); let randomIndex = 0; let gui = null; let stats = null; const ROCKET_PROPS = 4; const ROCKET_COUNT_MIN = 3; const ROCKET_COUNT_MAX = 25; const ROCKETS_PER_PIXEL = 1 / 300; let rocketCount = 0; let rocketHolderLength = 0; let rocketHolder = null; const IMAGE_THRESHOLD = 1; const IMAGE_MARGIN = 15; //--- function init() { isTouchDevice = 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0; //--- if (isTouchDevice === true) { canvas.addEventListener('touchmove', cursorMoveHandler, false); canvas.addEventListener('touchstart', cursorEnterHandler, false); canvas.addEventListener('touchend', cursorLeaveHandler, false); canvas.addEventListener('touchcancel ', cursorLeaveHandler, false); } else { canvas.addEventListener('pointermove', cursorMoveHandler, false); canvas.addEventListener('pointerdown', cursorDownHandler, false); canvas.addEventListener('pointerup', cursorUpHandler, false); canvas.addEventListener('pointerenter', cursorEnterHandler, false); canvas.addEventListener('pointerleave', cursorLeaveHandler, false); } //--- for (let i = 0; i < RANDOM_TABLE_SIZE; i++) { randomTable[i] = Math.random(); } //--- stats = new Stats(); stats.domElement.style.position = 'absolute'; document.body.appendChild(stats.domElement); //--- document.body.appendChild(canvas); window.addEventListener('resize', onResize, false); restart(true); } function onResize(event) { restart(); } function restart(explosion = false) { const innerWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; const innerHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; //--- w = innerWidth; h = innerHeight; //--- canvas.width = w; canvas.height = h; imageD.........完整代码请登录后点击上方下载按钮下载查看
网友评论0