87,910
社区成员
发帖
与我相关
我的任务
分享
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jqueryrotate</title>
</head>
<body>
<div style="width:500px;margin:0 auto">
<h3>演示六、点击旋转一</h3>
<img id="img6" src="http://avatar.csdn.net/B/3/A/1_webyellow.jpg" width="256" height="256"/>
</div>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.6.4/jquery.js"></script>
<script type="text/javascript" src="http://www.jq22.com/demo/choujiang/js/jQueryRotate.2.2.js"></script>
<script>
$(function() {
$("#img6").rotate({
bind:
{
click: function() {
$(this).rotate({
angle: 0,
animateTo: 50,
duration: 1000,
callback: function () {
$("#img6").rotate({angle:48});
}
});
}
}
});
});
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<img src="http://avatar.csdn.net/B/3/A/1_webyellow.jpg" width="256" height="256" id="img" style="margin-top:100px; margin-left:100px;" />
</body>
</html>
<script src="JS/jquery.min.js"></script>
<script src="JS/jquery.easing.min.js"></script>
<script src="JS/jQueryRotate.js"></script>
<script>
$("#img").rotate({
bind: {
click: function () {
$(this).rotate({
angle: 0,
animateTo: 3600,
duration: 6000,
easing: $.easing.easeInOutQuart
})
}
}
});
</script>
真要不行就自己写函数了
click: function () {
$(this).rotate({
angle: 0,
animateTo: 20,
duration: 1000,
easing: $.easing.backout
}),$(this).rotate({
angle: 0,
animateTo: 80,
duration: 1000,
easing: $.easing.backout
});
}
jQuery.extend(jQuery.easing, { backout: function (x, t, b, c, d) { var s = 1.70158; return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b } });
$(function () {
function executeActions(el, actions) {
var config = actions.splice(0, 1)[0];
console.log(config)
if (config) {
config.callback = function () { executeActions(el, actions); }
config.easing= $.easing.backout
el.rotate(config);
}
else {
alert('指令执行完毕!')
el.data('executing', false);
}
}
$("#img6").rotate({
bind:
{
click: function () {
var el = $(this);
if (el.data('executing')) return;//指令未执行完
el.data('executing', true);
executeActions($(this), [{ angle: 0, animateTo: 50, duration: 1000 }, { animateTo: 30, duration: 100 }, {animateTo: 180, duration: 1000 }]);
}
}
});
});
click: function () {
$(this).rotate({
angle: 0,
animateTo: 20,
duration: 1000,
easing: $.easing.backout
}),$(this).rotate({
angle: 0,
animateTo: 80,
duration: 1000,
easing: $.easing.backout
});
}
想要这种,按照顺序执行。setTimeout不行了。传数组怎么设置?
$(this).rotate({
angle: 0,
animateTo: 20,
duration: 1000,
easing: $.easing.backout
});
想在点击时候支持执行多个 $(this).rotate({});
再根据支持次数给填上animateTo 填写上递增的随意数,就成加速的码表了。。。
[/quote]
形成加速,减速效果不就是重写擦除效果就好了。。支持执行多个 $(this).rotate({});是什么意思?并发执行还顺序?
顺序不久构造多少个rotate的配置放入数组中splice第一个执行直到全部执行完毕。。
$(this).rotate({
angle: 0,
animateTo: 20,
duration: 1000,
easing: $.easing.backout
});
想在点击时候支持执行多个 $(this).rotate({});
再根据支持次数给填上animateTo 填写上递增的随意数,就成加速的码表了。。。
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jqueryrotate</title>
</head>
<body>
<div style="width:500px;margin:0 auto">
<h3>演示六、点击旋转一</h3>
<img id="img6" src="http://avatar.csdn.net/B/3/A/1_webyellow.jpg" width="256" height="256" />
</div>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/1.6.4/jquery.js"></script>
<script type="text/javascript" src="http://www.jq22.com/demo/choujiang/js/jQueryRotate.2.2.js"></script>
<script>
jQuery.extend(jQuery.easing, { backout: function (x, t, b, c, d) { var s = 1.70158; return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b } });
</script>
<script>
$(function () {
$("#img6").rotate({
bind:
{
click: function () {
$(this).rotate({
angle: 0,
animateTo: 180,
duration: 1000,
easing: $.easing.backout
});
}
}
});
});
</script>
</body>
</html>