|
|
#1 |
|
Member
Join Date: Aug 2002
Posts: 86
|
animated layer script
can someone show me how to edit this script (used in the complex tutorial skin) to trigger an animated layer to start instead of triggering the button to move?
here is the script: code: |
|
|
|
|
|
#2 |
|
Major Dude
|
If I get you correctly, you want a button to control an animated layer similar to the way a button controls a drawer.
This script should work: code: I'm a noob to maki also, so someone correct me if I'm wrong. ![]() Website: Template vbulletin skins by exaltic.com[size=0.75] Skins/Coding: D-Shock, Nebular, Triton [/size] |
|
|
|
|
|
#3 |
|
Member
Join Date: Aug 2002
Posts: 58
|
Another way to do it with a bit more control over it
code: ___________________________________________________________________ #include <lib/std.mi> Function DoAniStuff(AnimatedLayer ToBeAnim, int start, int stop, int speed, int loop); Global Button mybutton; Global AnimatedLayer myanimatedlayer; Global Int ani; System.onScriptLoaded() { //button & layer definations go here. ani = 1; } mybutton.onLeftClick() { if (ani == 1) { DoAniStuff(myanimatedlayer, 0, 10, 50, 1); ani = 0; //this will start at first frame, play to frame 10 at 50 milliseconds a frame & loop continuously //if u want it to play backwards set the start frame lower than the stop frame eg. DoAniStuff(myanimatedlayer, 10, 0, 50, 1); }else { if (ani == 0) { DoAniStuff(myanimatedlayer, 0, 0, 0, 0); ani = 1; //if u dont want it to play set the start & end frames the same } } } DoAniStuff(AnimatedLayer ToBeAnim, int start, int stop, int speed, int loop) { ToBeAnim.setStartFrame(start); ToBeAnim.setEndFrame(stop); ToBeAnim.setAutoReplay(loop); ToBeAnim.setSpeed(speed); ToBeAnim.play(); } ____________________________________ hope this helps |
|
|
|
|
|
#4 |
|
Member
Join Date: Aug 2002
Posts: 86
|
thanks guys, i'll try these out and get back to you
|
|
|
|
|
|
#5 |
|
Member
Join Date: Aug 2002
Posts: 86
|
alright dirtylowmofo, i have been able to use your script exactly the way i want to, but there are a couple things that i dont know how to do, when the animation ends i want the last frame to stay visible instead of disappearing immediately, also where i have changed it to trigger at the onEnterArea class i need to define the area because i need the button to be a ghost but ghost buttons dont pick up hovers, so i need to define the area from coordinates or something but i dont know how (it would be great if i could get a half circle shape area, but just a rectangle will work too) thanks for all your help already!
here is the modified script if anyone else could help me too that would be great code: |
|
|
|
|
|
#6 |
|
Member
Join Date: Aug 2002
Posts: 58
|
not sure but think this should work how u want it (still new at this myself)
code: ______________________________________________________________________ #include "../../../lib/std.mi" Function DoAniStuff(AnimatedLayer ToBeAnim, int start, int stop, int speed, int loop); Global Button mybutton; Global AnimatedLayer myanimatedlayer; System.onScriptLoaded() { group triggerDrawer = getScriptGroup(); mybutton = triggerDrawer.findobject("trigger"); group bubbleDrawer = getScriptGroup(); myanimatedlayer = bubbleDrawer.findobject("bubbleani"); } mybutton.onEnterArea() { DoAniStuff(myanimatedlayer, 10, 0, 100, 0); } mybutton.onLeaveArea() { DoAniStuff(myanimatedlayer, 0, 10, 100, 0); } DoAniStuff(AnimatedLayer ToBeAnim, int start, int stop, int speed, int loop) { ToBeAnim.setStartFrame(start); ToBeAnim.setEndFrame(stop); ToBeAnim.setAutoReplay(loop); ToBeAnim.setSpeed(speed); ToBeAnim.play(); } ______________________________________________________________________ in your xml try this (not checked but should work) code : ______________________________________________________________________ <button id="trigger" action="" x="?" y="?" image="?" downImage="?" ghost="1" rectrgn="1" /> ______________________________________________________________________ fill in the ? with the relevant info ![]() & just to be clear the first frame of the animation is frame 0, so to end on frame 10 u need 11 frames |
|
|
|
|
|
#7 |
|
Member
Join Date: Aug 2002
Posts: 86
|
thanks, i didnt touch the script cause it works fine except for the end frame, and now it works perfect, i still cant seem to get it to recognize mouseover when ghost="1" i put rectrgn="1" in my xml but it didnt change anything, what does it do?
thanks for all your help already, i'll just keep looking for a way to do what i need does anyone know if and how i would use the function "isMouseOver(int x, int y)"? |
|
|
|
|
|
#8 |
|
Member
Join Date: Aug 2002
Posts: 58
|
Not sure why u want a button with ghost="1".
If it's because u dont want the image to change just set the downImage=" " to the same as the image=" " in your xml or change the button to a layer or remove the ghost="1" from the button & put a layer on top of it (with the image u want)& set the layer to ghost="1". |
|
|
|
|
|
#9 |
|
Member
Join Date: Aug 2002
Posts: 86
|
no, actually its kind of complicated and completely unnecessary but i think it looks cool, see i have an animation that slowly covers other buttons, then when you hover the mouse over the animated layer it will open and let you click the hidden buttons underneath
does that make sense? |
|
|
|
|
|
#10 |
|
Member
Join Date: Aug 2002
Posts: 58
|
screenshot might help
|
|
|
|
|
|
#11 |
|
Member
Join Date: Aug 2002
Posts: 86
|
alright, i dont like showing half finished work but here is the area of the skin in question
the greyish colored bars are the play functions (next, back, play etc...) |
|
|
|
|
|
#12 |
|
Member
Join Date: Aug 2002
Posts: 86
|
and in the up position
|
|
|
|
|
|
#13 |
|
Member
Join Date: Aug 2002
Posts: 58
|
try this
code: ______________________________________________________________________ #include "../../../lib/std.mi" Function DoAniStuff(AnimatedLayer ToBeAnim, int start, int stop, int speed, int loop); Global Button mybutton; Global AnimatedLayer myanimatedlayer; Class GuiObject HintObject; Global HintObject playbtn, nextbtn; //add the rest of the buttons that r under the animated layer System.onScriptLoaded() { group triggerDrawer = getScriptGroup(); mybutton = triggerDrawer.findobject("trigger"); group bubbleDrawer = getScriptGroup(); myanimatedlayer = bubbleDrawer.findobject("bubbleani"); playbtn = wherever?.findObject("play"); nextbtn = wherever?.findObject("next"); } myanimatedlayer.onEnterArea() { DoAniStuff(myanimatedlayer, 10, 0, 100, 0); } HintObject.onLeaveArea() { DoAniStuff(myanimatedlayer, 0, 10, 100, 0); } myanimatedlayer.onFrame(int framenum) { if (framenum == 0) { myanimatedlayer.setXmlParam("ghost", "1"); }else { if (framenum == 10) { myanimatedlayer.setXmlParam("ghost", "0"); } } } DoAniStuff(AnimatedLayer ToBeAnim, int start, int stop, int speed, int loop) { ToBeAnim.setStartFrame(start); ToBeAnim.setEndFrame(stop); ToBeAnim.setAutoReplay(loop); ToBeAnim.setSpeed(speed); ToBeAnim.play(); } ____________________________________________________________________ not sure but i think your animatedlayer xml needs to have ghost="0" |
|
|
|
|
|
#14 |
|
Member
Join Date: Aug 2002
Posts: 86
|
no go
![]() thanks though, in this thread you have pretty much taught me how to script lol |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|