Skip to content

Commit 6d0be81

Browse files
committed
v 1.0.1
fixed a bug that caused the resume method to not work if counting down
1 parent 67788e4 commit 6d0be81

File tree

6 files changed

+22
-17
lines changed

6 files changed

+22
-17
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### v 1.0.1 (1/30/14)
4+
5+
- fixed a bug that caused the resume method not to work if counting down
6+
37
### v 1.0.0 (1/23/14)
48

59
- no changes, just officially made it a production version

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "countUp.js",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"main": "countUp.js",
55
"author": "Jamie Perkins",
66
"ignore": [

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "countUp.js",
33
"repo": "inorganik/countUp.js",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"scripts": ["countUp.min.js"],
66
"demo": "http://inorganik.github.io/countUp.js",
77
"author": "Jamie Perkins",

countUp.coffee

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# countUp.js
44
# by @inorganik
5-
# v 1.0.0
5+
# v 1.0.1
66
#
77
# Example:
88
# numAnim = new countUp "SomeElementYouWantToAnimate", 99.99, 2, 1.5
@@ -29,15 +29,15 @@ countUp = (target, startVal, endVal, decimals, duration) ->
2929
@useEasing = true
3030

3131
@doc = document.getElementById target
32-
startVal = Number startVal
32+
@startVal = Number startVal
3333
endVal = Number endVal
3434
@countDown = if (startVal > endVal) then true else false
3535
decimals = Math.max(0, decimals or 0)
3636
@dec = Math.pow(10, decimals)
3737
@duration = duration * 1000 or 2000
3838
@startTime = null
3939
@remaining = null
40-
@frameVal = startVal
40+
@frameVal = @startVal
4141
@rAF = null
4242

4343
# make sure requestAnimationFrame and cancelAnimationFrame are defined
@@ -78,16 +78,16 @@ countUp = (target, startVal, endVal, decimals, duration) ->
7878
# to ease or not to ease is the question
7979
if @useEasing
8080
if @countDown
81-
i = @easeOutExpo progress, 0, startVal - endVal, @duration
82-
@frameVal = startVal - i
81+
i = @easeOutExpo progress, 0, @startVal - endVal, @duration
82+
@frameVal = @startVal - i
8383
else
84-
@frameVal = @easeOutExpo(progress, startVal, endVal - startVal, @duration)
84+
@frameVal = @easeOutExpo(progress, @startVal, endVal - @startVal, @duration)
8585
else
8686
if @countDown
8787
i = (startVal - endVal) * (progress / @duration)
88-
@frameVal = startVal - i
88+
@frameVal = @startVal - i
8989
else
90-
@frameVal = startVal + (endVal - startVal) * (progress / @duration)
90+
@frameVal = @startVal + (endVal - @startVal) * (progress / @duration)
9191

9292
# decimal
9393
@frameVal = Math.round(@frameVal * @dec) / @dec
@@ -121,7 +121,7 @@ countUp = (target, startVal, endVal, decimals, duration) ->
121121

122122
@reset = () ->
123123
cancelAnimationFrame @rAF
124-
@doc.innerHTML = @addCommas startVal.toFixed(decimals)
124+
@doc.innerHTML = @addCommas @startVal.toFixed(decimals)
125125

126126
@resume = () ->
127127
@startTime = null
@@ -142,4 +142,4 @@ countUp = (target, startVal, endVal, decimals, duration) ->
142142
x1 + x2
143143

144144
# format startVal on initialization
145-
@doc.innerHTML = @addCommas startVal.toFixed(decimals)
145+
@doc.innerHTML = @addCommas @startVal.toFixed(decimals)

countUp.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
countUp.js
44
by @inorganik
5-
v 1.0.0
5+
v 1.0.1
66
77
*/
88

@@ -55,7 +55,7 @@ function countUp(target, startVal, endVal, decimals, duration) {
5555
this.startTime = null;
5656
this.timestamp = null;
5757
this.remaining = null;
58-
this.frameVal = startVal;
58+
this.frameVal = self.startVal;
5959
this.rAF = null;
6060

6161
// Robert Penner's easeOutExpo
@@ -75,7 +75,7 @@ function countUp(target, startVal, endVal, decimals, duration) {
7575
if (self.useEasing) {
7676
if (self.countDown) {
7777
var i = self.easeOutExpo(progress, 0, self.startVal - endVal, self.duration);
78-
self.frameVal = startVal - i;
78+
self.frameVal = self.startVal - i;
7979
} else {
8080
self.frameVal = self.easeOutExpo(progress, self.startVal, endVal - self.startVal, self.duration);
8181
}
@@ -148,8 +148,9 @@ function countUp(target, startVal, endVal, decimals, duration) {
148148
// format startVal on initialization
149149
self.d.innerHTML = self.addCommas(startVal.toFixed(decimals));
150150
}
151+
151152
// Example:
152153
// var numAnim = new countUp("SomeElementYouWantToAnimate", 0, 99.99, 2, 1.5);
153154
// numAnim.start();
154-
// with optional callback
155+
// with optional callback:
155156
// numAnim.start(someMethodToCallOnComplete);

countUp.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)