Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
eadfcb1a
Commit
eadfcb1a
authored
Jul 05, 2023
by
StyleZhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize recorder animation
parent
e599d699
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
index.tsx
web/app/components/base/voice-input/index.tsx
+6
-2
No files found.
web/app/components/base/voice-input/index.tsx
View file @
eadfcb1a
...
...
@@ -33,7 +33,8 @@ const VoiceInput = ({
drawRecordId
.
current
=
requestAnimationFrame
(
drawRecord
)
const
canvas
=
canvasRef
.
current
!
const
ctx
=
ctxRef
.
current
!
const
dataArray
=
recorder
.
current
.
getRecordAnalyseData
()
const
dataUnit8Array
=
recorder
.
current
.
getRecordAnalyseData
()
const
dataArray
=
[].
slice
.
call
(
dataUnit8Array
)
const
lineLength
=
parseInt
(
`
${
canvas
.
width
/
3
}
`
)
const
gap
=
parseInt
(
`
${
1024
/
lineLength
}
`
)
...
...
@@ -41,7 +42,10 @@ const VoiceInput = ({
ctx
.
beginPath
()
let
x
=
0
for
(
let
i
=
0
;
i
<
lineLength
;
i
++
)
{
let
v
=
dataArray
[
i
*
gap
]
let
v
=
dataArray
.
slice
(
i
*
gap
,
i
*
gap
+
gap
).
reduce
((
prev
:
number
,
next
:
number
)
=>
{
return
prev
+
next
},
0
)
/
gap
if
(
v
<
128
)
v
=
128
if
(
v
>
178
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment