Follow object

  1. 6 years ago

    I am a new user of Pubcoder, and love that program.
    A question: Is there any way to make one object (image) follow another, with a little delay? (like a Mousetrail)

    Thanks.

  2. Edited 6 years ago by Adenio F

    I found a temporary solution

    1- Put the Javascript code bellow on top of the Script:
    // define variables
    var seguirFreq = 1000; // delay
    var tipoMov = "swing"; // movement type ("linear"?)

    2- And the code bellow into the "$(window).load(function(){" section:

    setInterval(function(){
    var c = $("#obj1178"); // Object to follow
    $("#obj1198").animate({"left":c.css("left"), "top":c.css("top")}, seguirFreq, tipoMov); // Follower object
    },seguirFreq);

  3. Hi Adenio F,

    If I have understood your need :

    • You can drop the two images (A and B) on your workspace; let's say B on top of A
    • You hide B by default (using the Selection-properties- pannel on the right side of the workspace)
    • On the Interactivity pannel, on the event "Load/Show" of the object A, you can choose the plan the actions below :
    • - HideObject Self (A)
    • - Wait (1 sec)
    • - Show Object B

    You have many other options (you can put the image B outside the workspace and use a moveObject action to bring to the workspace, etc.) according to your needs and constraints (if you want to loop this sequence for example).

    The cool thing in Pubcoder is to avoid to code as much as you can :-)

 

or Sign Up to reply!