Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fps-tester
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
wildfirecode13
fps-tester
Commits
61844664
Commit
61844664
authored
Mar 20, 2018
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
+61
-0
index.html
index.html
+22
-0
index.js
index.js
+39
-0
No files found.
index.html
0 → 100644
View file @
61844664
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<title>
Document
</title>
</head>
<body>
<script
src=
"index.js"
></script>
<script>
window
.
__fpscallback__
=
(
fps
)
=>
{
console
.
log
(
`fps=
${
fps
}
`
)
}
__startFpsFunc__
()
</script>
</body>
</html>
\ No newline at end of file
index.js
0 → 100644
View file @
61844664
"use strict"
;
(
function
()
{
var
beginTime
=
(
performance
||
Date
).
now
();
var
prevTime
=
beginTime
;
var
frames
=
0
;
var
MAX
=
2
;
var
count
=
MAX
;
var
totalFrames
=
0
;
var
begin
=
function
()
{
beginTime
=
(
performance
||
Date
).
now
();
};
var
end
=
function
()
{
frames
++
;
var
time
=
(
performance
||
Date
).
now
();
if
(
time
>=
prevTime
+
1000
)
{
console
.
log
(
frames
);
totalFrames
+=
frames
;
count
--
;
prevTime
=
time
;
frames
=
0
;
}
return
count
;
};
var
animate
=
function
()
{
begin
();
var
count
=
end
();
if
(
count
==
0
)
{
var
fps
=
Math
.
floor
(
totalFrames
/
MAX
);
window
[
'__fpscallback__'
]
&&
window
[
'__fpscallback__'
](
fps
);
return
;
}
requestAnimationFrame
(
animate
);
};
window
[
'__startFpsFunc__'
]
=
function
()
{
beginTime
=
(
performance
||
Date
).
now
();
prevTime
=
beginTime
;
animate
();
};
})();
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