Android 铃铛简单摇摆动画

RotateAnimation rotateAnimation = new RotateAnimation(0, 15, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0f);
//以图片的顶边中点为中心,进行左右摆动
        rotateAnimation.setInterpolator
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
您可以使用C3.js库中的transition动画函数实现摇铃铛效果。以下是一个实现的示例代码: ```html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>C3.js 摇铃铛效果</title> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/c3/0.7.18/c3.min.css"> </head> <body> <div id="chart"></div> <script src="https://d3js.org/d3.v5.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/c3/0.7.18/c3.min.js"></script> <script> var chart = c3.generate({ bindto: '#chart', data: { columns: [ ['data', 30] ], type: 'gauge' }, gauge: { width: 15, min: 0, max: 100, units: 'value', label: { show: false } }, color: { pattern: ['#FF0000', '#F97600', '#F6C600', '#60B044'], threshold: { values: [30, 60, 90, 100] } } }); function shakeBell() { chart.load({ columns: [ ['data', 30] ], type: 'gauge', done: function() { chart.internal.config.gauge_label_show = false; d3.select('.c3-gauge-value') .transition() .duration(500) .ease(d3.easeElasticOut) .attr('transform', 'translate(0, 10)') .transition() .duration(500) .ease(d3.easeElasticOut) .attr('transform', 'translate(0, -10)') .transition() .duration(500) .ease(d3.easeElasticOut) .attr('transform', 'translate(0, 0)'); } }); } setInterval(shakeBell, 3000); </script> </body> </html> ``` 在此示例中,我们使用了C3.js的仪表图(gauge)类型,然后通过定时调用shakeBell()函数来实现摇铃铛的效果。在shakeBell()函数中,我们先重新加载了一个值为30的数据列,并通过transition函数来实现振动动画效果。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值