Skip to content

Commit

Permalink
more style formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ded committed Mar 7, 2012
1 parent 1be2be4 commit e32b34d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/morpheus.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
, doc = document
, win = window
, html = doc.documentElement
, thousand = 1000
, rgbOhex = /^rgb\(|#/
, relVal = /^([+\-])=([\d\.]+)/
, numUnit = /^(?:[\+\-]=)?\d+(?:\.\d+)?(%|in|cm|mm|em|ex|pt|pc|px)$/
Expand Down Expand Up @@ -82,7 +83,7 @@

function has(array, elem, i) {
if (Array.prototype.indexOf) return array.indexOf(elem)
for (i=0; i<array.length; ++i) {
for (i = 0; i < array.length; ++i) {
if (array[i] === elem) return i
}
}
Expand Down Expand Up @@ -136,7 +137,7 @@
function toHex(c) {
var m = /rgba?\((\d+),\s*(\d+),\s*(\d+)/.exec(c)
return (m ? rgb(m[1], m[2], m[3]) : c)
.replace(/#(\w)(\w)(\w)$/, '#$1$1$2$2$3$3') // short to long
.replace(/#(\w)(\w)(\w)$/, '#$1$1$2$2$3$3') // short skirt to long jacket
}

// change font-size => fontSize etc.
Expand All @@ -146,6 +147,7 @@
})
}

// aren't we having it?
function fun(f) {
return typeof f == 'function'
}
Expand All @@ -165,7 +167,7 @@
// default to a pleasant-to-the-eye easeOut (like native animations)
return Math.sin(t * Math.PI / 2)
}
var time = duration || 1000
var time = duration || thousand
, self = this
, diff = to - from
, start = +new Date()
Expand Down Expand Up @@ -238,14 +240,14 @@
if (k == 'transform') {
v = {}
for(var t in begin[i][k]) {
v[t] = (t in end[i][k]) ? Math.round(((end[i][k][t] - begin[i][k][t]) * pos + begin[i][k][t]) * 1000) / 1000 : begin[i][k][t]
v[t] = (t in end[i][k]) ? Math.round(((end[i][k][t] - begin[i][k][t]) * pos + begin[i][k][t]) * thousand) / thousand : begin[i][k][t]
}
return v
} else if (typeof begin[i][k] == 'string') {
return nextColor(pos, begin[i][k], end[i][k])
} else {
// round so we don't get crazy long floats
v = Math.round(((end[i][k] - begin[i][k]) * pos + begin[i][k]) * 1000) / 1000
v = Math.round(((end[i][k] - begin[i][k]) * pos + begin[i][k]) * thousand) / thousand
// some css properties don't require a unit (like zIndex, lineHeight, opacity)
if (!(k in unitless)) v += units[i][k] || 'px'
return v
Expand Down

0 comments on commit e32b34d

Please sign in to comment.