[英]How to tween view.center in paper.js
So I'm trying to give the feel of smooth movement when reassigning the paper.view.center
coordinates.所以我试图在重新分配
paper.view.center
坐标时给人一种平稳运动的感觉。 The center
object doesn't have a tweenTo()
method. center
对象没有tweenTo()
方法。 This is what I've tried using Tween.js:这是我使用 Tween.js 尝试过的:
let smooth = new TWEEN.Tween(paper.view.center).to({
x: 650,
y: 270
}, 900).easing(TWEEN.Easing.Cubic.Out).start();
Since it's a Point
object reassigning the x
and y
values don't actually change the coordinates, because the proper way of reassiging it is to use another Point
object ( new paper.Point()
).由于它是一个
Point
对象,重新分配x
和y
值实际上不会改变坐标,因为重新分配它的正确方法是使用另一个Point
对象( new paper.Point()
)。 How could I tween the continuously new creation of a Point
object?我怎样才能对
Point
对象的不断新创建进行补间?
I think that a simple way of achieving what you want is animating the active layer position.我认为实现您想要的一种简单方法是为活动层位置设置动画。
Here's a sketch demonstrating a possible implementation.这是一个演示可能实现的草图。
const circle = new Path.Circle({
center: view.center,
radius: 50,
fillColor: 'orange'
});
circle.clone().translate(100)
project.activeLayer.tweenTo(
{ position: { x: 50, y: 50 } },
{ duration: 700, easing: 'easeInOutQuad' }
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.