Onrepeat设计(on repeat)
repeat用法
repeat用法:
一:形容词
回头客的,再次光顾的。
We tender you our best thanks for your kind order, and hope to receive your repeat order.
对于本次订购,我们深表感谢,望再次订购。
二:名词
1、再次发生;重复(的事物)。
There were fears that there might be a repeat of last year's campaign of strikes.
有人担心去年的罢工运动可能再次发生。
2、重播,重演
There's nothing except sport and repeats on TV.
除了体育节目和重播节目外,电视上没什么新鲜内容。
三:动词
1、重复,复制,重复发生;重写;重做
Am I expected to repeat it?
要不要我重复一遍?
2、复述,转述,反复说,背诵
Repeat your lesson.
背诵你的功课。
3、【美】(在选举中违法)重复投票
In order to avoid repeating all voters have to be registered in the district.
为了防止重复投票,所有选民都要在区里进行登记。
扩展资料:
词义辨析
cite, quote, repeat这些动词均含“引用,复述”之意。区别在于:
1、cite指引经据典以示证明或凭据。
2、quote指不加剪裁的直接引用原文或原话。
3、repeat仅强调口头或笔头重复别人的话或字句,并不必指明出处。
单曲这个词汇在英文当中如何表达?
英语口语里地道表达是这样的:
put (a song) on repeat,或者 put (a song) on a loop,意思都是循环播放某首歌曲。
例如:
I really like this song. Put it on repeat/on a loop, please. 我喜欢这首歌,把它单曲循环吧。
此外,举例说下多首歌循环的表达:I'm gonna put my favorite songs on a loop.
在Vue中使用GSAP完成动画(三)动画事件
动画时间都有回调函数,回调函数参数,作用域三种,本文着重讲第一种,后面的不再赘述
在动画结束时触发此回调函数
传递给 onComplete 回调函数的参数数组
如果想传递动画对象本身,可以使用 {self}
定义 onComplete 函数的作用域,即函数内this的指向
当动画开始渲染时执行此事件函数, 有可能会被执行多次 ,因为动画是可以 重复开始 的
当动画发生改变时(动画进行中的每一帧) 不停 的触发此事件
当一个补间动画被另外一个补间动画覆盖时发生的事件
获取或者设置事件,例如"onComplete", "onUpdate", "onStart", "onReverseComplete" , "onRepeat" (onRepeat 只应用在 TweenMax 或者 TimelineMax 实例),以及应传递给该回调的任何参数
下面两种方式等同
每个动画实例的每个回调类型只能有一个(一个onComplete, 一个onUpdate, 一个onStart, 等等),新建则会覆盖掉之前的。
可以通过设置null来删除掉回调函数
可用于链式操作同时绑定多种事件
Android开发中,长按事件怎么获得屏幕坐标点
对于很多游戏使用屏幕控制一般需要考虑长按事件,比如在动作类的游戏中需要长按发射武器,结合Android Button模型,我们实现一个带图片的Button的长按,为了更清晰的显示原理,Android开发网这里使用ImageButton作为基类.
public class RepeatingImageButton extends ImageButton {
private long mStartTime; //记录长按开始
private int mRepeatCount; //重复次数计数
private RepeatListener mListener;
private long mInterval = 500; //Timer触发间隔,即每0.5秒算一次按下
public RepeatingImageButton(Context context) {
this(context, null);
}
public RepeatingImageButton(Context context, AttributeSet attrs) {
this(context, attrs, android.R.attr.imageButtonStyle);
}
public RepeatingImageButton(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setFocusable(true); //允许获得焦点
setLongClickable(true); //启用长按事件
}
public void setRepeatListener(RepeatListener l, long interval) { //实现重复按下事件listener
mListener = l;
mInterval = interval;
}
@Override
public boolean performLongClick() {
mStartTime = SystemClock.elapsedRealtime();
mRepeatCount = 0;
post(mRepeater);
return true;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) { // 本方法原理同onKeyUp的一样,这里处理屏幕事件,下面的onKeyUp处理Android手机上的物理按键事件
removeCallbacks(mRepeater);
if (mStartTime != 0) {
doRepeat(true);
mStartTime = 0;
}
}
return super.onTouchEvent(event);
}
//处理导航键事件的中键或轨迹球按下事件
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_ENTER:
super.onKeyDown(keyCode, event);
return true;
}
return super.onKeyDown(keyCode, event);
}
//当按键弹起通知长按结束
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_ENTER:
removeCallbacks(mRepeater); //取消重复listener捕获
if (mStartTime != 0) {
doRepeat(true); //如果长按事件累计时间不为0则说明长按了
mStartTime = 0; //重置长按计时器
}
}
return super.onKeyUp(keyCode, event);
}
private Runnable mRepeater = new Runnable() { //在线程中判断重复
public void run() {
doRepeat(false);
if (isPressed()) {
postDelayed(this, mInterval); //计算长按后延迟下一次累加
}
}
};
private void doRepeat(boolean last) {
long now = SystemClock.elapsedRealtime();
if (mListener != null) {
mListener.onRepeat(this, now - mStartTime, last ? -1 : mRepeatCount++);
}
}
下面是重复Button Listener接口的定义,调用时在Button中先使用setRepeatListener()方法实现RepeatListener接口
public interface RepeatListener {
void onRepeat(View v, long duration, int repeatcount); //参数一为用户传入的Button对象,参数二为延迟的毫秒数,第三位重复次数回调。
}
}
本类大家可以直接在自己的View中implements实现RepeatListener接口即可.
tweenmax改变css3属性么
可以,TweenMax内置的CSSPlugin可以制作CSS动画,改变CSS属性,其中包括2d transform和3d transform的简略方法,如x:水平方向移动,相当于CSS3的translateX。rotation:旋转,相当于rotate。skewX:斜切,相当于skew。此外还有很多。你也可以不用简略方法而直接设置CSS3属性来进行动画,例如:TweenMax.to(element, 3, {transform:’rotate(30deg)’})
css tween
基于css3 animation和transition的动画类库,可以方便的使用js来调用。
不过因为所有实现均基于css3,所以不能像tweenmax那样使用到其他对象,只能作用于dom对象的css属性(可以查阅animation和transition可使用的css属性)。
API
CT.get(target, param);
CT.set(target, params);
CT.fromTo(target, duration, fromParams, toParams);
CT.from(target, duration, fromParams);
CT.to(target, duration, toParams);
CT.kill(target);
CT.killAll();
param为字符串,
Params为数组,
以下是所有配置属性:
type设置为'a'使用animation,不设置则使用transition(transiton动画的创建效率高于animation,但没有animation那样丰富的功能和回调)
ease设置缓动,
delay设置延时时间,
onEnd设置运动完成的返回函数,
onEndParams设置返回函数的参数,
只有当type:'a'时以下属性才能起作用
repeat设置重复次数,
yoyo设置重复时反向,
onStart设置运动开始的返回函数,
onStartParams设置开始返回函数的参数,
onRepeat设置运动循环中每个运动完成的返回函数,
onRepeatParams设置运动完成返回函数的参数,
缓动类
CT.Linear
CT.Quad
CT.Quart
CT.Back
除了CT.Linear只有None一项,其他均有In,InOut,Out三项选择。
以上方法和参数均是参考TweenMax的方式,有使用经验了会很容易上手。
!DOCTYPE HTML
head
script src="../csstween.js"/script
style
body{
background: #000;
font-size: 14px;
}
.b1{
width: 100%;
height: 100%;
}
.box{
width: 100px;
height: 100px;
}
#box1{
background: #f00;
margin-left: 100px;
}
#box2{
background: #0f0;
margin-left: 200px;
}
#box3{
background: #00f;
}
/style
/head
body
div class="b1"
div id="box1" class="box"
/div
div id="box2" class="box"
/div
div id="box3" class="box"
/div
/div
script
setTimeout(function(){console.log('start');
CT.to('.b1 #box2', 1, {marginTop:300, opacity:1, ease:CT.Quad.InOut, onEnd:function(){
console.log("complete1");
CT.from('.b1 #box2', 1, {marginTop:100, opacity:0.5, ease:CT.Quad.Out, onEnd:function(){
console.log("complete2");
CT.fromTo('.b1 #box2', 2, {marginLeft:500, opacity:0.5}, {marginLeft:400, opacity:1, ease:CT.Quad.Out, onEnd:function(n){
console.log("complete3", this, n);
}, onEndParams:[50]});
}});
}});
}, 500);
CT.fromTo('.b1 #box1', 1, {
marginLeft:300,
transform:'rotate(80deg)',
opacity:0
}, {
type:'a',
marginLeft:200,
transform:'rotate(300deg)',
opacity:0.5,
repeat:5,
yoyo:true,
delay:1,
ease:CT.Quart.Out,
onStart:function(){
console.log("start");
},
onIteration:function(){
console.log("iteration");
},
onEnd:function(){
console.log("complete");
}
});
/script
/body
/html