animals css,GitHub - luxuriousanimals/jquery.transit: Super-smooth CSS3 transformations and transiti...

Super-smooth CSS3 transformations and transitions for jQuery

jQuery Transit is a plugin for to help you do CSS transformations and

transitions in jQuery.

Refer to the jQuery Transit website for

examples.

Usage

Just include this script after jQuery. Requires jQuery 1.4+.

Transformations

You can set transformations as you would any CSS property in jQuery.

(Note that you cannot $.fn.animate() them, only set them.)

$("#box").css({ x: '30px' }); // Move right

$("#box").css({ y: '60px' }); // Move down

$("#box").css({ translate: [60,30] }); // Move right and down

$("#box").css({ rotate: '30deg' }); // Rotate clockwise

$("#box").css({ scale: 2 }); // Scale up 2x (200%)

$("#box").css({ scale: [2, 1.5] }); // Scale horiz and vertical

$("#box").css({ skewX: '30deg' }); // Skew horizontally

$("#box").css({ skewY: '30deg' }); // Skew vertical

$("#box").css({ perspective: 100, rotateX: 30 }); // Webkit 3d rotation

$("#box").css({ rotateY: 30 });

$("#box").css({ rotate3d: [1, 1, 0, 45] });

Relative values are supported.

$("#box").css({ rotate: '+=30' }); // 30 degrees more

$("#box").css({ rotate: '-=30' }); // 30 degrees less

All units are optional.

$("#box").css({ x: '30px' });

$("#box").css({ x: 30 });

Multiple arguments can be commas or an array.

$("#box").css({ translate: [60,30] });

$("#box").css({ translate: ['60px','30px'] });

$("#box").css({ translate: '60px,30px' });

Getters are supported. (Getting properties with multiple arguments returns

arrays.)

$("#box").css('rotate'); //=> "30deg"

$("#box").css('translate'); //=> ['60px', '30px']

Animating - $.fn.transition

$('...').transition(options, [duration], [easing], [complete])

You can animate with CSS3 transitions using $.fn.transition(). It works

exactly like $.fn.animate(), except it uses CSS3 transitions.

$("#box").transition({ opacity: 0.1, scale: 0.3 });

$("#box").transition({ opacity: 0.1, scale: 0.3 }, 500); // duration

$("#box").transition({ opacity: 0.1, scale: 0.3 }, 'fast'); // easing

$("#box").transition({ opacity: 0.1, scale: 0.3 }, 500, 'in'); // duration+easing

$("#box").transition({ opacity: 0.1, scale: 0.3 }, function() {..}); // callback

$("#box").transition({ opacity: 0.1, scale: 0.3 }, 500, 'in', function() {..}); // everything

You can also pass duration and easing and complete as values in options, just like in $.fn.animate().

$("#box").transition({

opacity: 0.1, scale: 0.3,

duration: 500,

easing: 'in',

complete: function() { /* ... */ }

});

Tests

Since you can't easily programatically test transitions, you'll need to build

the site, open the test suite in your browser, and visually inspect if all

transitions work as they should.

Build the site using rake build, then open site/_output/test.html. This

builds the minified JS and tests it.

Alternatives

Pros: no jQuery dependency, great syntax.

Cons (at time of writing): no iOS support (doesn't use translate3d), some

IE bugs, no 3D transforms, no animation queue.

Pros: transparently overrides $.fn.animate() to provide CSS transitions

support.

Cons: transpalently overrides $.fn.animate(). No transformations support.

Pros: Tons of transformations.

Cons: No CSS transition support; animates via fx.step.

Pros: simply provides rotation.

Cons: simply provides rotation. No transitions support.

Acknowledgements

© 2011, Rico Sta. Cruz. Released under the MIT

License.

jQuery Transit is authored and maintained by Rico Sta. Cruz with help

from it's contributors. It is sponsored by my startup, Sinefunc, Inc.

My website (ricostacruz.com)

Sinefunc, Inc. (sinefunc.com)

Github (@rstacruz)

Twitter (@rstacruz)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
goroutine 342 [running]: sync.fatal({0xbdff5b, 0x20}) D:/Program Files (x86)/Go/src/runtime/panic.go:1031 +0x29 sync.(*RWMutex).Unlock(0x19f96d0) D:/Program Files (x86)/Go/src/sync/rwmutex.go:209 +0x57 go-study/models.sendMsg(0x0, {0x135fe0f0, 0x15, 0x15}) D:/go/go-study/models/Message.go:193 +0x70 go-study/models.Chat({0x12fe4500, 0x13bec360}, 0x130d0380) D:/go/go-study/models/Message.go:82 +0x3a0 go-study/service.SendUserMsg(0x13bec360) D:/go/go-study/service/userBasicService.go:237 +0x54 github.com/gin-gonic/gin.(*Context).Next(...) D:/Program Files (x86)/Go/bin/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 github.com/gin-gonic/gin.CustomRecoveryWithWriter.func1(0x13bec360) D:/Program Files (x86)/Go/bin/pkg/mod/github.com/gin-gonic/gin@v1.9.0/recovery.go:102 +0x89 github.com/gin-gonic/gin.(*Context).Next(...) D:/Program Files (x86)/Go/bin/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 github.com/gin-gonic/gin.LoggerWithConfig.func1(0x13bec360) D:/Program Files (x86)/Go/bin/pkg/mod/github.com/gin-gonic/gin@v1.9.0/logger.go:240 +0xa7 github.com/gin-gonic/gin.(*Context).Next(...) D:/Program Files (x86)/Go/bin/pkg/mod/github.com/gin-gonic/gin@v1.9.0/context.go:174 github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0x13be80e0, 0x13bec360) D:/Program Files (x86)/Go/bin/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:620 +0x51b github.com/gin-gonic/gin.(*Engine).ServeHTTP(0x13be80e0, {0xd04140, 0x13c060a0}, 0x130d0380) D:/Program Files (x86)/Go/bin/pkg/mod/github.com/gin-gonic/gin@v1.9.0/gin.go:576 +0x1c9 net/http.serverHandler.ServeHTTP({0x13d46000}, {0xd04140, 0x13c060a0}, 0x130d0380) D:/Program Files (x86)/Go/src/net/http/server.go:2947 +0x285 net/http.(*conn).serve(0x132d8360, {0xd048a0, 0x132f2738}) D:/Program Files (x86)/Go/src/net/http/server.go:1991 +0x67d created by net/http.(*Server).Serve D:/Program Files (x86)/Go/src/net/http/server.go:3102 +0x498
最新发布
06-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值