Socket
Socket
Sign inDemoInstall

animates

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

animates - npm Package Compare versions

Comparing version 0.0.1 to 1.0.0

index.html

13

lib/animates.js

@@ -7,7 +7,12 @@ var css = require('./css')

opts = defaults(opts)
el.style.transition = transition(end, opts.speed, opts.easing, opts.delay)
css(el, end)
return setTimeout(function finish () {
el.style.transition = transition(opts.speed, opts.easing, opts.delay)
setTimeout(start, 1)
return setTimeout(finish, opts.speed)
function start () {
css(el, end)
}
function finish () {
el.style.transition = 'none'
}, opts.speed)
}
}
module.exports = function camel (str) {
return str.replace(/[\-_]./g, function (divider) {
return str.replace(/[\-_]./g, camelize)
function camelize (divider) {
return divider.charAt(1).toUpperCase()
})
}
}
var seconds = require('./seconds')
module.exports = function transition (obj, speed, easing, delay) {
var props = []
for (var prop in obj) if (obj.hasOwnProperty(prop)) props.push(tidbit(prop, speed, easing, delay))
return props.join(', ')
module.exports = function transition (speed, easing, delay) {
var str = 'all ' + seconds(speed)
if (easing) str += ' ' + easing
if (delay) str += ' ' + seconds(delay)
return str
}
function tidbit (prop, speed, easing, delay) {
var bits = [prop, seconds(speed)]
if (easing) bits.push(easing)
if (delay) bits.push(seconds(delay))
return bits.join(' ')
}
{
"name": "animates",
"version": "0.0.1",
"description": "A small css3 animation lib inspired by jquery/animate",
"version": "1.0.0",
"description": "A tiny, performant replacement for jquery/animate using css3",
"main": "lib/animates.js",

@@ -10,3 +10,4 @@ "directories": {

"scripts": {
"test": "node_modules/.bin/karma start --single-run && node_modules/.bin/standard"
"test": "node_modules/.bin/karma start --single-run && node_modules/.bin/standard",
"start": "node_modules/.bin/serve -p 1234"
},

@@ -31,2 +32,4 @@ "author": {

"mocha": "^2.4.5",
"require1k": "stuk/require1k",
"serve": "^1.4.0",
"standard": "^6.0.8",

@@ -33,0 +36,0 @@ "webpack": "^1.12.14"

@@ -20,3 +20,3 @@ /* globals describe beforeEach it */

function middle () {
expect(el.style.transition).to.eql('opacity 0.1s')
expect(el.style.transition).to.eql('all 0.1s')
}

@@ -23,0 +23,0 @@

@@ -7,13 +7,9 @@ /* globals describe it */

it('should create transition strings', function () {
expect(transition({ top: 1 }, 100, 'linear', 1000)).to.eq('top 0.1s linear 1s')
expect(transition(100, 'linear', 1000)).to.eq('all 0.1s linear 1s')
})
it('should treat easing and delay as optional', function () {
expect(transition({ top: 1 }, 100)).to.eq('top 0.1s')
expect(transition(100)).to.eq('all 0.1s')
expect(transition(100, 'linear')).to.eq('all 0.1s linear')
expect(transition(100, null, 1000)).to.eq('all 0.1s 1s')
})
it('should support multiple properties', function () {
expect(transition({
width: 1,
height: 2
}, 200, 'linear', 200)).to.eq('width 0.2s linear 0.2s, height 0.2s linear 0.2s')
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc