tween relative distance?

  • I need to tween a plugin's position to a relative distance from its current (not always known) position. For example, to move it 200 pixels more or less from where it currently is (either x,y or even both).

    It is not readily apparent to me from the documentation how to implement this?

  • Well, I figured out how to use the new math functions to mostly get what I needed-

    Code
    add(dst,plugin[lcorner].x,300);
    tween(plugin[lcorner].x, $dst, distance(300, .5), linear);

    I still don't know yet how I could apply this same thing using percentage values for instances when I want things to move relative to previous position and relative to screen/window size?

  • Hi,

    Quote

    I still don't know yet how I could apply this same thing using percentage values for instances when I want things to move relative to previous position and relative to screen/window size?

    what do you what to do?
    maybe tweening to the center or a edge of the screen?

    here would help the changeorigin() action,
    see for for changeorigin:
    https://krpano.com/docu/xml/#plugin

    it changes the "origin" (=align) of the plugin but KEEPS the current position,
    that means the x/y values were recalculated to keep it,

    e.g. to move a plugin from an edge to the middle of the screen:

    Code
    plugin[xyz].changeorigin(center,center);
    tween(plugin[xyz].x,0);
    tween(plugin[xyz].y,0);


    best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!