Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
timebars
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nesstar
timebars
Commits
29f27700
Commit
29f27700
authored
Apr 07, 2014
by
Kjetil Thuen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use requestAnimFrame
This should give smoother animations and lessen power usage
parent
9a34acb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
src/app/timebars.coffee
src/app/timebars.coffee
+16
-15
No files found.
src/app/timebars.coffee
View file @
29f27700
require
(
'./rAF'
)
()
require
(
'./rAF'
)
d3
=
require
'd3-browserify'
lodash
=
require
'lodash'
dragDealer
=
require
(
'dragdealer'
).
Dragdealer
...
...
@@ -21,7 +21,7 @@ horizMargin = (chartId) ->
vertMargin
=
(
chartId
)
->
25
speed
=
->
20
0
fps
=
->
1
0
barThickness
=
(
chartId
)
->
Math
.
floor
(
chartHeight
(
chartId
)
/
numBars
(
chartId
))
-
2
...
...
@@ -361,28 +361,29 @@ setFrame = (chartId, frame) ->
chartState
[
chartId
].
currentFrame
=
frame
chartState
[
chartId
].
slider
.
setStep
(
frame
,
0
,
snap
=
true
)
stopAnim
=
(
chartId
)
->
clearInterval
chartState
[
chartId
].
timeBarAnim
chartState
[
chartId
].
timeBarAnim
=
undefined
document
.
getElementById
(
chartId
+
"playBtn"
)
.
innerHTML
=
"<i class='fa fa-play'></i>"
startAnim
=
(
chartId
)
->
chartState
[
chartId
].
timeBarAnim
=
setInterval
->
nextFrame
chartId
,
speed
()
chartState
[
chartId
].
animActive
=
true
document
.
getElementById
(
chartId
+
"playBtn"
)
.
innerHTML
=
"<i class='fa fa-pause'></i>"
animloop
chartId
stopAnim
=
(
chartId
)
->
chartState
[
chartId
].
animActive
=
false
document
.
getElementById
(
chartId
+
"playBtn"
)
.
innerHTML
=
"<i class='fa fa-play'></i>"
toggleAnim
=
(
chartId
)
->
if
chartState
[
chartId
].
timeBarAnim
?
if
chartState
[
chartId
].
animActive
stopAnim
chartId
else
startAnim
chartId
animloop
=
()
->
requestAnimFrame
animloop
render
()
animloop
=
(
chartId
)
->
if
chartState
[
chartId
].
animActive
setTimeout
()
->
window
.
requestAnimationFrame
->
animloop
chartId
nextFrame
chartId
,
1000
/
fps
()
displayPoster
=
(
chartId
,
icon
,
header
,
message
)
->
container
=
d3
.
select
"#"
+
chartId
...
...
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