Jump to content

animating paintings - can anyone help me?


You are about to reply to a thread that has been inactive for 3626 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'd like to animate some of my paintings in SL.

I have 5 layers created in photoshop... each as a PNG.... is there a way to apply them in order...with fades in between... so the 5 layers play as looped movie on a canvas in SL?

Do i upload each one as a separate texture and the assemble them in SL? Or do i create the "movie" outside of SL?

Thank you in advance for any help that you can lend    : ))


paula

Link to comment
Share on other sites

If you don't actually want an animated picture (think a .gif) but a canvas that slowly fades from one picture to the next, you should search for 'slide show' on the market place for premade ones where you can just drop your pictures into the contents (after uploading each picture). Or, you could search for a slideshow script to make your own.

Link to comment
Share on other sites

Nope. You animate pictures either by having it as a slideshow, or with a script. With the script you don't use 5 different pictures but have those five pictures on one .png. I used to have some sort of translator that translated a gif into the script but it's been ages @.@ perhaps google can help with that.

Link to comment
Share on other sites

You have much better control if you use a slide viewer than if you use llSetTextureAnim anyway.  You can use higher resolution images and you can control the fade.  The animated texture route is fine for repetitive things like klieg lights and billboard ads, but not if you want good images and subtle transitions.  I posted a simple slide viewer in the LSL Scripting Library a couple of years ago that can be modified easily to get whatever effects you need.

Link to comment
Share on other sites

Hi Paula,

Here's a script I wrote long ago, which seems to work, and gently fades between images in a photo frame I've got hanging on my wall. Like Rolig's script, this one loads new images while they're not visible, so you won't see the load progression, nor the initial blank grey texture (unless lag is bad and it takes longer to load images than the time between them). Just drop your images into the contents folder and they'll be displayed in order.

When you touch the thing, it will throw up a dialog allowing you to manually step through the pictures, set the automatic advance interval, or hold the current picture.

It's not going to be obvious how to set up the prims, so maybe you should just create two cubes, link them together and watch what happens. It should then be clearer what to do with them. If you get stuck, I can send you a copy of the frame in-world.

It's been years since I wrote this, and my comments suggest that I didn't know what I was doing, so caveat emptor.

For the rest of you, feel free to beat me up over the code.

 

// Picture frame with fade between images// A Miracle Script by Madelaine McMasters. If it works, it's a miracle.// This script presumes a root prim and a child prim, both cubes squished flat like a canvas.// The root canvas must be located right in front of the back canvas.// The front face of the root canvas fades from opaque to transparent and back again to smoothly// reveal the image on the back canvas.// Images are loaded while invisible, either because they're transparent in the front// or they're in the back and obscured by the opaque front.// You can also add prims after the first two, for use as frames or decorations.// But, the first child must be the "back" canvas.list MENU = ["<< Previous","Hold","Next >>","1 minute","2 minutes","5 minutes","5 seconds","10 seconds","20 seconds"];integer listener;integer numPics = 0;integer index;integer MENU_CHANNEL = -314; // there are better ways to pick a chat channel numberfloat displayTime;			// holds the time for which each picture is displayedkey user;integer fadeSteps = 4;      // sets the number of steps in the fade between pictures, more steps = longer transitionfloat stepTime = 0.2;		// sets time between fade stepsfloat currentFade;          // remember the current opacity of the front prim. if 0 or fadeSteps we wait for displayTime before going the other wayinteger fadeDirection;      // -1 = become transparent, 1 = become opaque// opens menu channel and displays dialogDialog(key id, list menu){    llListenRemove(listener);    listener = llListen(MENU_CHANNEL, "", NULL_KEY, "");    llDialog(id, "\n\nShow each image for: ", menu, MENU_CHANNEL);} default{    on_rez(integer num){        llResetScript();        displayTime=5;      // so they know it's working pretty soon after rezzing        llSetTimerEvent(displayTime);        index=0;        currentFade=1;        fadeDirection=-1;    }     touch_start(integer total_number){        llSetTimerEvent(0);         // stop the timer, somebody's gonna change it        numPics = llGetInventoryNumber(INVENTORY_TEXTURE);  // determine how many photographs we've got        user = llDetectedKey(0);    // remember who was the first to touch us        Dialog(user, MENU);         // give them the menu    }     listen(integer channel, string name, key id, string message) {        if (channel == MENU_CHANNEL) {            llListenRemove(listener);   // stop listening after we recieve the dialog response, cuts down on sim lag                        // for Next, Prev and Hold (which is the default), we stop the timer            // it's not perfect, but for Next and Prev, we display the texture on the front panel only            // this means that going back one picture might not seem right, since the previous picture may have been on the back panel            // but I haven't time to make it perfect            if(message == "Next >>"){                displayTime=0;                if(++index==numPics){                    index=0;                }                llSetAlpha(1,ALL_SIDES);    // make the front picture visible                llSetTexture( llGetInventoryName(INVENTORY_TEXTURE, index) ,0);                Dialog(user, MENU);            }            if(message == "<< Previous"){                displayTime=0;                if(--index==-1){                    index=numPics-1;                }                llSetAlpha(1,ALL_SIDES);    // make the front picture visible                llSetTexture( llGetInventoryName(INVENTORY_TEXTURE, index) ,0);                Dialog(user, MENU);            }                        if(message == "Hold"){                displayTime=0;            }                        // for all the timer settings, just load displayTime with the correct value.            if(message == "5 seconds"){                displayTime=5;            }            if(message == "10 seconds"){                displayTime=10;            }            if(message == "20 seconds"){                displayTime=20;            }            if(message == "1 minute"){                displayTime=60;            }            if(message == "2 minutes"){                displayTime=120;            }            if(message == "5 minutes"){                displayTime=300;            }            // start up the timer with the specified time (which will be zero if Prev, Next or Hold)            llSetTimerEvent(displayTime);        }    }    timer(){        numPics = llGetInventoryNumber(INVENTORY_TEXTURE);  // check on the number of pictures        if(numPics){    // only animate if we have some            if(index>=numPics){ // wrap around when we've gone through them all                index=0;            }            currentFade+=fadeDirection;            llSetAlpha(currentFade/fadeSteps,ALL_SIDES); // set the front picture opacity            if(currentFade<=0){ // front is now transparent, so display the back picture for "displayTime"                currentFade=0;  // don't step below zero                fadeDirection=1;    // when the timer expires, we'll head towards opaque                llSetTexture( llGetInventoryName(INVENTORY_TEXTURE, index++) ,0);   // repaint the front picture while it's invisible                llSetTimerEvent(0); // reset the timer (don't know why this is needed)                llSetTimerEvent(displayTime);   // restart it            }            else if(currentFade>=fadeSteps){ // front is now opaque, repaint the picture behind it                currentFade=fadeSteps;  // don't step past the end                fadeDirection=-1;       // turn around when the timer expires                llSetLinkTexture( 2, llGetInventoryName(INVENTORY_TEXTURE, index++) ,0);   // repaint the back picture                llSetTimerEvent(0);  // reset the timer (still don't know why this is needed)                llSetTimerEvent(displayTime);   // restart it            }            else {                llSetTimerEvent(0.0); // (and yet still don't know why this is needed)                llSetTimerEvent(stepTime); // step through alpha levels            }        }    }} 

 

Link to comment
Share on other sites

Thank you so much Syn Anatine, Mlstah Moose, Rolig Loon, and Madelaine McMasters  : )))

Those were such helpful answers. I'm learning a lot here in SL and kind people like you really make this experience amazing. 

I've seen the slide show canvases, so that might be the easiest way to execute my concept. The animation script is sooo nice Madelaine..... I'm not entirely sure how to implement the script, though I have a frind who might be able to show me how. I'm new to a lot of this.

Thank you again!!!

paula cloudpainter

Link to comment
Share on other sites


paula31atnight wrote:

I'm not entirely sure how to implement the script, though I have a frind who might be able to show me how. I'm new to a lot of this.

Okay, Paula, try this...

  1. Rez two cubes.
  2. Edit one of them, selecting the "Contents" tab of the edit window.
  3. Click "New Script".
  4. Double click the "New Script" and delete all the code in it.
  5. Go to my original post in this thread and copy all the text in the code window.
  6. Paste it into the "New Script" window.
  7. Close the window.
  8. Drag your pictures into the "Contents" folder as well.
  9. Select the other cube.
  10. Hold down the shift key and select the cube you just put the script into.
  11. Select "Link" from the edit window.

You've now linked the two prims together, and the last one you selected (which has the script and pictures in it) becomes the root-prim.

Touch the root prim (if it hasn't gone invisible on ya). Select "5 seconds" from the dialog menu.

You should now see that the root prim has vanished, but will fade back into view shortly. It'll appear for five seconds, then vanish for five. Your pictures should appear on the top faces of the cubes, and if you watch the fading one, you should see that while it's visible, the picture on the other cube changes. Now, if you squish the cubes flat, and place the vanishing one on top of the always visible one, you should see the effect you desire.

I don't recall how items in the contents folder are ordered. I'll presume that the first picture you drop will be the first one displayed, so if you want your pictures to go in a certain order, drag them to "Contents" in that order. If it turns out they get pulled in alphabetical order, rename them.

If you can't get that to work, send me an IM and I'll send you a working demo.

Yes, I'm making you do some work. You won't have that sense of pride when you're finished if you didn't sweat and bleed a li'l along the way.

;-)

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3626 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...