-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintcache
1 lines (1 loc) · 18.5 KB
/
.eslintcache
1
[{"/Users/evgeny/group-calls-animation/src/index.js":"1","/Users/evgeny/group-calls-animation/src/App.js":"2","/Users/evgeny/group-calls-animation/src/reportWebVitals.js":"3","/Users/evgeny/group-calls-animation/src/LineBlobDrawable.js":"4","/Users/evgeny/group-calls-animation/src/TopBar.js":"5","/Users/evgeny/group-calls-animation/src/Button.js":"6","/Users/evgeny/group-calls-animation/src/BlobDrawable.js":"7"},{"size":500,"mtime":1610671041315,"results":"8","hashOfConfig":"9"},{"size":4849,"mtime":1611668434994,"results":"10","hashOfConfig":"9"},{"size":362,"mtime":1610671041316,"results":"11","hashOfConfig":"9"},{"size":3426,"mtime":1611585624505,"results":"12","hashOfConfig":"9"},{"size":9347,"mtime":1611883147367,"results":"13","hashOfConfig":"9"},{"size":31371,"mtime":1611932142045,"results":"14","hashOfConfig":"9"},{"size":5181,"mtime":1611884042349,"results":"15","hashOfConfig":"9"},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"18"},"ks2wau",{"filePath":"19","messages":"20","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"21","usedDeprecatedRules":"18"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"18"},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"18"},{"filePath":"26","messages":"27","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"28","usedDeprecatedRules":"18"},{"filePath":"29","messages":"30","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"18"},"/Users/evgeny/group-calls-animation/src/index.js",[],["33","34"],"/Users/evgeny/group-calls-animation/src/App.js",["35","36","37"],"import logo from './logo.svg';\nimport React from 'react';\nimport Button from './Button';\nimport TopBar, { MUTE_BUTTON_STATE_UNMUTE, MUTE_BUTTON_STATE_MUTE, MUTE_BUTTON_STATE_CONNECTING, MUTE_BUTTON_STATE_MUTED_BY_ADMIN } from './TopBar';\nimport './App.css';\n\nclass App extends React.Component {\n\n constructor(props) {\n super(props);\n\n this.topBarRef = React.createRef();\n this.buttonRef = React.createRef();\n }\n\n componentDidMount() {\n this.setAmplitude(0.0);\n }\n\n setCurrentState = (stateId, animated) => {\n const { current: topBar } = this.topBarRef;\n const { current: button } = this.buttonRef;\n\n topBar.setCurrentState(stateId, animated);\n button.updateMuteButton(stateId, animated);\n };\n\n setAmplitude(value) {\n const { current: topBar } = this.topBarRef;\n const { current: button } = this.buttonRef;\n if (!topBar) return;\n\n topBar.setAmplitude(value);\n button.setAmplitude(value);\n document.getElementById('text').innerHTML = (Math.round(value * 100) / 100).toFixed(2);\n }\n\n handleZeroAmplitude = () => {\n this.setAmplitude(0.0);\n };\n\n handleHalfAmplitude = () => {\n this.setAmplitude(0.5);\n };\n\n handleFullAmplitude = () => {\n this.setAmplitude(1.0);\n };\n\n handleMicrophone = async () => {\n\n if (this.stream) {\n console.log('stop mic');\n this.stream.getAudioTracks().forEach(x => {\n x.stop();\n });\n this.microphone.disconnect();\n this.analyser.disconnect();\n this.javascriptNode.disconnect();\n\n this.stream = null;\n this.microphone = null;\n this.analyser = null\n this.javascriptNode = null;\n return;\n }\n\n console.log('start mic');\n const stream = await navigator.mediaDevices.getUserMedia ({ audio: true, video: false });\n this.stream = stream;\n stream.getTracks().forEach(x => {\n x.onmute = x => {\n\n };\n x.onunmute = x => {\n };\n\n x.enabled = true;\n });\n\n const audioContext = new AudioContext();\n const analyser = audioContext.createAnalyser();\n this.analyser = analyser;\n const microphone = audioContext.createMediaStreamSource(stream);\n this.microphone = microphone;\n const javascriptNode = audioContext.createScriptProcessor(2048, 1, 1);\n this.javascriptNode = javascriptNode;\n\n analyser.smoothingTimeConstant = 0.8;\n analyser.fftSize = 1024;\n\n microphone.connect(analyser);\n analyser.connect(javascriptNode);\n javascriptNode.connect(audioContext.destination);\n javascriptNode.onaudioprocess = event => {\n const array = new Uint8Array(analyser.frequencyBinCount);\n analyser.getByteFrequencyData(array);\n\n const length = array.length;\n let total = 0;\n let total2 = 0;\n for (let i = 0; i < length; i++) {\n total += array[i] * array[i];\n total2 += Math.abs(array[i]);\n }\n\n const rms = Math.sqrt(total / length) / 255;\n const average = total2 / length / 255;\n const first = array[0] / 255;\n\n let value = rms * 2;\n value = Math.min(1, value);\n\n // console.log('', rms, average, value);\n\n this.setAmplitude(value);\n }\n };\n\n handleUnmuted = () => {\n this.setCurrentState(MUTE_BUTTON_STATE_UNMUTE, true);\n }\n\n handleMuted = () => {\n this.setCurrentState(MUTE_BUTTON_STATE_MUTE, true);\n }\n\n handleMutedByAdmin = () => {\n this.setCurrentState(MUTE_BUTTON_STATE_MUTED_BY_ADMIN, true);\n }\n\n handleConnecting = () => {\n this.setCurrentState(MUTE_BUTTON_STATE_CONNECTING, true);\n }\n\n render() {\n return (\n <div className='App'>\n <TopBar ref={this.topBarRef}/>\n <Button ref={this.buttonRef}/>\n <div className='panel'>\n <button onClick={this.handleZeroAmplitude}>0.0</button>\n <button onClick={this.handleHalfAmplitude}>0.5</button>\n <button onClick={this.handleFullAmplitude}>1.0</button>\n <button onClick={this.handleUnmuted}>unmute</button>\n <button onClick={this.handleMuted}>mute</button>\n <button onClick={this.handleMutedByAdmin}>mute by admin</button>\n <button onClick={this.handleConnecting}>connecting</button>\n <button onClick={this.handleMicrophone}>mic</button>\n <div id='text'/>\n </div>\n </div>\n );\n }\n}\n\nexport default App;\n","/Users/evgeny/group-calls-animation/src/reportWebVitals.js",[],"/Users/evgeny/group-calls-animation/src/LineBlobDrawable.js",[],"/Users/evgeny/group-calls-animation/src/TopBar.js",["38","39","40"],"import React from 'react';\nimport PropTypes from 'prop-types';\nimport LineBlobDrawable from './LineBlobDrawable';\n\nexport const MUTE_BUTTON_STATE_UNMUTE = 0;\nexport const MUTE_BUTTON_STATE_MUTE = 1;\nexport const MUTE_BUTTON_STATE_CONNECTING = 2;\nexport const MUTE_BUTTON_STATE_MUTED_BY_ADMIN = 3;\n\nexport class WeavingState {\n constructor(stateId) {\n this.stateId = stateId;\n this.shader = (ctx, left, top, right, bottom) => { };\n this.createGradient(stateId);\n }\n\n createGradient(stateId) {\n this.shader = (ctx, left, top, right, bottom) => {\n ctx.fillStyle = WeavingState.getGradientFromType(ctx, stateId, left, top, right, bottom);\n };\n }\n\n // Android colors\n static getGradientFromType(ctx, type, x0, y0, x1, y1) {\n const gradient = ctx.createLinearGradient(x0, y0, x1, y1);\n if (type === MUTE_BUTTON_STATE_MUTED_BY_ADMIN) {\n gradient.addColorStop(0, '#57A4FE');\n gradient.addColorStop(.6, '#766EE9');\n gradient.addColorStop(1, '#F05459');\n } else if (type === MUTE_BUTTON_STATE_UNMUTE) {\n gradient.addColorStop(0, '#00B1C0');\n gradient.addColorStop(1, '#52CE5D');\n } else if (type === MUTE_BUTTON_STATE_MUTE) {\n gradient.addColorStop(0, '#2BCEFF');\n gradient.addColorStop(1, '#0976E3');\n } else {\n gradient.addColorStop(0, '#8599aa');\n gradient.addColorStop(1, '#8599aa');\n }\n\n return gradient;\n }\n\n update(height, width, dt, amplitude) {\n // TODO: move gradient here\n }\n}\n\nclass TopBar extends React.Component {\n constructor(props) {\n super(props);\n\n this.focused = true;\n this.resizing = false;\n this.lastUpdateTime = new Date();\n this.amplitude = 0;\n this.amplitude2 = 0;\n\n this.states = [\n new WeavingState(MUTE_BUTTON_STATE_UNMUTE),\n new WeavingState(MUTE_BUTTON_STATE_MUTE),\n new WeavingState(MUTE_BUTTON_STATE_CONNECTING),\n new WeavingState(MUTE_BUTTON_STATE_MUTED_BY_ADMIN),\n ];\n this.prevState = null;\n this.currentState = this.states[MUTE_BUTTON_STATE_MUTED_BY_ADMIN];\n this.progressToState = 1.0;\n\n this.scale = window.devicePixelRatio;\n this.left = 0 * this.scale;\n this.top = 20 * this.scale;\n this.right = 1260 * this.scale;\n this.bottom = 63 * this.scale;\n }\n\n componentDidMount() {\n window.addEventListener('blur', this.handleBlur);\n window.addEventListener('focus', this.handleFocus);\n window.addEventListener('resize', this.handleResize);\n this.media = window.matchMedia('screen and (min-resolution: 2dppx)');\n this.media.addEventListener('change', this.handleDevicePixelRatioChanged);\n\n const topBar = document.getElementById('top-bar');\n this.right = topBar.offsetWidth * this.scale;\n this.forceUpdate();\n\n this.canvas = document.getElementById('canvas');\n this.lbd = new LineBlobDrawable(3);\n this.lbd1 = new LineBlobDrawable(7);\n this.lbd2 = new LineBlobDrawable(8);\n this.setAmplitude(this.amplitude);\n\n this.draw();\n }\n\n componentWillUnmount() {\n window.removeEventListener('blur', this.handleBlur);\n window.removeEventListener('focus', this.handleFocus);\n window.removeEventListener('resize', this.handleResize);\n this.media.addEventListener('change', this.handleDevicePixelRatioChanged);\n }\n\n handleDevicePixelRatioChanged = e => {\n this.scale = window.devicePixelRatio;\n this.left = 0 * this.scale;\n this.top = 20 * this.scale;\n this.bottom = 63 * this.scale;\n const topBar = document.getElementById('top-bar');\n this.right = topBar.offsetWidth * this.scale;\n this.forceUpdate();\n }\n\n\n handleResize = () => {\n if (this.resizeHandler) {\n clearTimeout(this.resizeHandler);\n this.resizeHandler = null;\n }\n\n this.resizing = true;\n this.resizeCanvas();\n this.resizeHandler = setTimeout(() => {\n this.resizing = false;\n this.invokeDraw();\n }, 250);\n }\n\n resizeCanvas() {\n const topBar = document.getElementById('top-bar');\n\n this.scale = window.devicePixelRatio;\n this.right = topBar.offsetWidth * this.scale;\n\n this.forceUpdate();\n this.invokeDraw();\n }\n\n handleFocus = () => {\n this.focused = true;\n this.invokeDraw();\n }\n\n handleBlur = () => {\n this.focused = false;\n }\n\n invokeDraw = () => {\n if (this.raf) return;\n\n this.draw();\n }\n\n draw = (force = false) => {\n this.raf = null;\n const { lbd, lbd1, lbd2, scale, left, top, right, bottom, currentState, previousState, focused, resizing } = this;\n if (!focused && !resizing) {\n return;\n }\n\n // console.log('draw', [focused, resizing]);\n\n const newTime = new Date();\n let dt = (newTime - this.lastUpdateTime);\n if (dt > 20) {\n dt = 17;\n }\n\n // console.log('draw start', this.amplitude, this.animateToAmplitude);\n if (this.animateToAmplitude !== this.amplitude) {\n this.amplitude += this.animateAmplitudeDiff * dt;\n if (this.animateAmplitudeDiff > 0) {\n if (this.amplitude > this.animateToAmplitude) {\n this.amplitude = this.animateToAmplitude;\n }\n } else {\n if (this.amplitude < this.animateToAmplitude) {\n this.amplitude = this.animateToAmplitude;\n }\n }\n }\n\n if (this.animateToAmplitude !== this.amplitude2) {\n this.amplitude2 += this.animateAmplitudeDiff2 * dt;\n if (this.animateAmplitudeDiff2 > 0) {\n if (this.amplitude2 > this.animateToAmplitude) {\n this.amplitude2 = this.animateToAmplitude;\n }\n } else {\n if (this.amplitude2 < this.animateToAmplitude) {\n this.amplitude2 = this.animateToAmplitude;\n }\n }\n }\n\n if (previousState) {\n this.progressToState += dt / 250;\n if (this.progressToState > 1) {\n this.progressToState = 1;\n this.previousState = null;\n }\n }\n\n const top1 = 6 * this.amplitude2 * scale;\n const top2 = 6 * this.amplitude2 * scale;\n\n const ctx = this.canvas.getContext('2d');\n ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n lbd.minRadius = 0;\n lbd.maxRadius = (2 + 2 * this.amplitude) * scale;\n lbd1.minRadius = 0;\n lbd1.maxRadius = (3 + 9 * this.amplitude) * scale;\n lbd2.minRadius = 0;\n lbd2.maxRadius = (3 + 9 * this.amplitude) * scale;\n\n lbd.update(this.amplitude, 0.3);\n lbd1.update(this.amplitude, 0.7);\n lbd2.update(this.amplitude, 0.7);\n\n for (let i = 0; i < 2; i++) {\n if (i === 0 && !previousState) {\n continue;\n }\n\n let alpha = 1;\n let state = null;\n if (i === 0) {\n alpha = 1 - this.progressToState;\n state = previousState;\n // previousState.setToPaint(paint);\n } else {\n alpha = previousState ? this.progressToState : 1;\n currentState.update(bottom - top, right - left, dt, this.amplitude);\n state = currentState;\n // currentState.setToPaint(paint);\n }\n\n const paint1 = ctx => {\n ctx.globalAlpha = 0.3 * alpha;\n state.shader(ctx, left, top, right, bottom);\n };\n const paint = ctx => {\n ctx.globalAlpha = i === 0? 1 : alpha;\n state.shader(ctx, left, top, right, bottom);\n };\n\n lbd1.draw(left, top - top1, right, bottom, this.canvas, paint1, top, 1.0);\n lbd2.draw(left, top - top2, right, bottom, this.canvas, paint1, top, 1.0);\n lbd.draw(left, top, right, bottom, this.canvas, paint, top, 1.0);\n }\n\n if (!force) {\n this.raf = requestAnimationFrame(() => this.draw());\n }\n };\n\n setCurrentState = (stateId, animated) => {\n const { currentState, states } = this;\n\n if (currentState && currentState.id === stateId) {\n return;\n }\n\n this.previousState = animated ? currentState : null;\n this.currentState = states[stateId];\n this.progressToState = this.previousState ? 0.0 : 1.0;\n };\n\n setAmplitude(value) {\n this.animateToAmplitude = value;\n this.animateAmplitudeDiff = (value - this.amplitude) / 250;\n this.animateAmplitudeDiff2 = (value - this.amplitude) / 120;\n }\n\n render() {\n const { left, right, top, bottom, scale } = this;\n\n return(\n <div id='top-bar' className='top-bar'>\n <canvas id='canvas' width={right} height={bottom} style={{ width: right / scale, height: bottom / scale }}/>\n </div>\n );\n }\n}\n\nTopBar.propTypes = {};\n\nexport default TopBar;","/Users/evgeny/group-calls-animation/src/Button.js",["41","42","43","44","45"],"/Users/evgeny/group-calls-animation/src/BlobDrawable.js",[],{"ruleId":"46","replacedBy":"47"},{"ruleId":"48","replacedBy":"49"},{"ruleId":"50","severity":1,"message":"51","line":1,"column":8,"nodeType":"52","messageId":"53","endLine":1,"endColumn":12},{"ruleId":"50","severity":1,"message":"54","line":108,"column":19,"nodeType":"52","messageId":"53","endLine":108,"endColumn":26},{"ruleId":"50","severity":1,"message":"55","line":109,"column":19,"nodeType":"52","messageId":"53","endLine":109,"endColumn":24},{"ruleId":"50","severity":1,"message":"56","line":2,"column":8,"nodeType":"52","messageId":"53","endLine":2,"endColumn":17},{"ruleId":"50","severity":1,"message":"57","line":276,"column":17,"nodeType":"52","messageId":"53","endLine":276,"endColumn":21},{"ruleId":"50","severity":1,"message":"58","line":276,"column":30,"nodeType":"52","messageId":"53","endLine":276,"endColumn":33},{"ruleId":"50","severity":1,"message":"56","line":2,"column":8,"nodeType":"52","messageId":"53","endLine":2,"endColumn":17},{"ruleId":"50","severity":1,"message":"59","line":483,"column":15,"nodeType":"52","messageId":"53","endLine":483,"endColumn":16},{"ruleId":"50","severity":1,"message":"60","line":702,"column":25,"nodeType":"52","messageId":"53","endLine":702,"endColumn":37},{"ruleId":"50","severity":1,"message":"57","line":857,"column":17,"nodeType":"52","messageId":"53","endLine":857,"endColumn":21},{"ruleId":"50","severity":1,"message":"58","line":857,"column":30,"nodeType":"52","messageId":"53","endLine":857,"endColumn":33},"no-native-reassign",["61"],"no-negated-in-lhs",["62"],"no-unused-vars","'logo' is defined but never used.","Identifier","unusedVar","'average' is assigned a value but never used.","'first' is assigned a value but never used.","'PropTypes' is defined but never used.","'left' is assigned a value but never used.","'top' is assigned a value but never used.","'a' is assigned a value but never used.","'buttonRadius' is assigned a value but never used.","no-global-assign","no-unsafe-negation"]