timeit-example.js

total 0
used 0
limit 0
/* title: TimeIt Class Example categories: clock time files: head pointlist point stage mouse fps ../point_src/random.js ../point_src/timeit.js --- The `TimeIt` class helps track time between two calls. This can be used for anything requiring fairly precise timing at a millisecond range. See the [easing-example](./easing-example.js) for another demo. */ class MainStage extends Stage { // canvas = document.getElementById('playspace'); canvas = 'playspace' mounted(){ this.point = new Point({x: 250, y: 150 , radius: 20, rotation: 45}) this.timer = new TimeIt('Clicker') } onClick(ev) { if(this.timer.running == false) { return this.startTime() }; this.stopTime() } startTime(){ console.log('start timer') this.point.x = random.int(100, 700) this.point.y = random.int(100, 700) this.timer.start() return } stopTime(){ this.timer.stop() console.log('Stop click', this.timer.toString()) this.timer.reset() } draw(ctx){ this.clear(ctx) this.point.pen.indicator(ctx) this.fps.drawFPS(ctx) // console.log('draw') } } stage = MainStage.go(/*{ loop: true }*/)
Run
Meta Data
title TimeIt Class Example
imports ()
files ('head', 'pointlist', 'point', 'stage', 'mouse', 'fps', '../point_src/random.js', '../point_src/timeit.js')
unused_keys ()
unknown_keys ('categories',)
categories ['clock', 'time']
filepath_exists True
path timeit-example.js
filepath timeit-example.js
clean_files ('../point_src/core/head.js', '../point_src/pointlistdraw.js', '../point_src/pointlistgradient.js', '../point_src/pointlistshape.js', '../point_src/pointlistgenerator.js', '../point_src/unpack.js', '../point_src/pointlist.js', '../point_src/pointlistpen.js', '../point_src/pointpen.js', '../point_src/compass.js', '../point_src/center.js', '../point_src/point-content.js', '../point_src/pointdraw.js', '../point_src/relative-xy.js', '../point_src/pointcast.js', '../point_src/point.js', '../point_src/stage-resize.js', '../point_src/functions/resolve.js', '../point_src/stage.js', '../point_src/events.js', '../point_src/automouse.js', '../point_src/stage-clock.js', '../point_src/text/alpha.js', '../point_src/smooth-number.js', '../point_src/text/fps.js', '../point_src/random.js', '../point_src/timeit.js')
markdown {'html': '<hr />\n<p>The <code>TimeIt</code> class helps track time between two calls.</p>\n<p>This can be used for anything requiring fairly precise timing at a millisecond range.\nSee the <a href="./easing-example.js">easing-example</a> for another demo.</p>', 'content': 'title: TimeIt Class Example\ncategories: clock\n time\nfiles:\n head\n pointlist\n point\n stage\n mouse\n fps\n ../point_src/random.js\n ../point_src/timeit.js\n\n---\n\nThe `TimeIt` class helps track time between two calls.\n\nThis can be used for anything requiring fairly precise timing at a millisecond range.\nSee the [easing-example](./easing-example.js) for another demo.'}