Add comments and remove extra performance measure
Co-authored-by: Cole Lawrence <cole@colelawrence.com>
This commit is contained in:
parent
62def1e883
commit
fdf268ad43
5 changed files with 28 additions and 13 deletions
|
@ -42,6 +42,7 @@ function Model({url}: {url: string}) {
|
|||
)
|
||||
}
|
||||
|
||||
// Initially, just copied from the shared/dom example
|
||||
const textInterpolate = (left: string, right: string, progression: number) => {
|
||||
if (!left || right.startsWith(left)) {
|
||||
const length = Math.floor(
|
||||
|
@ -52,7 +53,7 @@ const textInterpolate = (left: string, right: string, progression: number) => {
|
|||
return left
|
||||
}
|
||||
|
||||
const boxObjectConfig = {
|
||||
const allPropsObjectConfig = {
|
||||
test: types.string('Typing', {interpolate: textInterpolate}),
|
||||
testLiteral: types.stringLiteral('a', {a: 'Option A', b: 'Option B'}),
|
||||
bool: types.boolean(false),
|
||||
|
@ -77,7 +78,8 @@ function App() {
|
|||
const sheet = project.sheet('Scene')
|
||||
project.ready.then(() => sheet.sequence.play({iterationCount: Infinity}))
|
||||
|
||||
sheet.object('everything', boxObjectConfig)
|
||||
const allPropsObj = sheet.object('All Props Tester', allPropsObjectConfig)
|
||||
console.log('allPropsObj', allPropsObj)
|
||||
|
||||
return (
|
||||
<div
|
||||
|
|
|
@ -12,13 +12,9 @@ ReactDOM.render(<App />, document.getElementById('root'))
|
|||
|
||||
const raf = Ticker.raf
|
||||
|
||||
setInterval(() => {
|
||||
const id = Date.now().toString(36) + '-'
|
||||
performance.mark(id)
|
||||
setTimeout(() => {
|
||||
performance.measure('---', id)
|
||||
}, 2000)
|
||||
}, 2000)
|
||||
// Show "ticks per second" information in performance measurements using the User Timing API
|
||||
// See https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API
|
||||
// See https://web.dev/user-timings/
|
||||
setInterval(() => {
|
||||
const start = {
|
||||
ticks: raf.__ticks,
|
||||
|
@ -29,6 +25,7 @@ setInterval(() => {
|
|||
setTimeout(() => {
|
||||
const ticksPerSec =
|
||||
((raf.__ticks - start.ticks) * 1000) / (Date.now() - start.now)
|
||||
// This shows up in the performance tab of devtools if you record!
|
||||
performance.measure(
|
||||
`${ticksPerSec.toFixed(0)}t/1s - ${(ticksPerSec * 0.5).toFixed(
|
||||
0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue