Commit 6feab7b4 authored by rockyl's avatar rockyl

修改tween,增加host

parent 542cf045
...@@ -17,7 +17,7 @@ export default class BounceZoom extends ScillaComponent { ...@@ -17,7 +17,7 @@ export default class BounceZoom extends ScillaComponent {
onAwake() { onAwake() {
super.onAwake(); super.onAwake();
this._tween = createTween(this.transform, false, this._tween = createTween(this, this.transform, false,
{clazz: Vector2D, fields: ['x', 'y'], autoPlay: false} {clazz: Vector2D, fields: ['x', 'y'], autoPlay: false}
) )
.to({scale: this.targetScale.clone()}, this.duration * 0.5) .to({scale: this.targetScale.clone()}, this.duration * 0.5)
......
...@@ -23,7 +23,7 @@ export default class Rotation extends ScillaComponent { ...@@ -23,7 +23,7 @@ export default class Rotation extends ScillaComponent {
super.onAwake(); super.onAwake();
if(!this._tween){ if(!this._tween){
this._tween = createTween(this.transform, false, {autoPlay: this.autoPlay, loop: this.loop, initFields: ['_rotation']}) this._tween = createTween(this, this.transform, false, {autoPlay: this.autoPlay, loop: this.loop, initFields: ['_rotation']})
.to({rotation: 360}, this.duration) .to({rotation: 360}, this.duration)
.call(()=>{ .call(()=>{
this.onComplete.invoke(); this.onComplete.invoke();
......
...@@ -27,10 +27,10 @@ export default class TouchZoom extends InteractComponent { ...@@ -27,10 +27,10 @@ export default class TouchZoom extends InteractComponent {
const scaleFrom = transform.scale.clone(); const scaleFrom = transform.scale.clone();
const scaleTo = transform.scale.clone().add(scaleOffset); const scaleTo = transform.scale.clone().add(scaleOffset);
this._zoomIn = createTween(transform, false, {autoPlay: false, clazz: Vector2D, fields: ['x', 'y']}) this._zoomIn = createTween(this, transform, false, {autoPlay: false, clazz: Vector2D, fields: ['x', 'y']})
.to({scale: scaleTo}, duration, easeFunc); .to({scale: scaleTo}, duration, easeFunc);
this._zoomOut = createTween(transform, false, {autoPlay: false, clazz: Vector2D, fields: ['x', 'y']}) this._zoomOut = createTween(this, transform, false, {autoPlay: false, clazz: Vector2D, fields: ['x', 'y']})
.to({scale: scaleFrom}, duration, easeFunc); .to({scale: scaleFrom}, duration, easeFunc);
} }
} }
......
...@@ -90,7 +90,7 @@ export default class ProgressBar extends ScillaComponent { ...@@ -90,7 +90,7 @@ export default class ProgressBar extends ScillaComponent {
const width = percentage * _thumbSize.width; const width = percentage * _thumbSize.width;
//this._mask.width = width; //this._mask.width = width;
createTween(this._mask, true) createTween(this, this._mask, true)
.to({width}, 300, ease.cubicOut); .to({width}, 300, ease.cubicOut);
if(this._widgetTransform){ if(this._widgetTransform){
......
...@@ -132,7 +132,7 @@ export default class ScrollView extends InteractComponent { ...@@ -132,7 +132,7 @@ export default class ScrollView extends InteractComponent {
const targetPos = createVector2D(tx, ty); const targetPos = createVector2D(tx, ty);
const duration = Math.min(500, Math.max(targetPos.distance(position), 200)); const duration = Math.min(500, Math.max(targetPos.distance(position), 200));
createTween(this._contentTransform, true, {clazz: Vector2D, fields: ['x', 'y']}) createTween(this, this._contentTransform, true, {clazz: Vector2D, fields: ['x', 'y']})
.to({position: targetPos}, duration, ease.cubicOut); .to({position: targetPos}, duration, ease.cubicOut);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment