Go Back   Winamp Forums > Skinning and Design > Modern Skins

Reply
Thread Tools Search this Thread Display Modes
Old 24th August 2002, 07:01   #1
coooooop
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:
// Complex Tutorial Skin - triangle.m MAKI file
// Created by Ken Chen for the official Winamp3 skinning site.

// #include Section
#include "../../../lib/std.mi"
#include "../../../lib/config.mi"
#include "../../../lib/pldir.mi"

// Variable Declaration Section
global Button button_triangle;
global Int moving_triangle;
global String status_triangle;

// System.onScriptUnloading() Section
System.onScriptUnloading(){
}

// System.onScriptLoaded() Section
System.onScriptLoaded(){
group triangleDrawer = getScriptGroup();
button_triangle = triangleDrawer.findobject("complex.circle3.triangle3");
status_triangle = "closed";
moving_triangle = 0;
}

// Your own functions
button_triangle.onEnterArea(){
if( status_triangle == "closed" && moving_triangle != 1 ){
moving_triangle = 1;
button_triangle.setTargetY(60);
button_triangle.setTargetSpeed(0.25);
button_triangle.gototarget();
}else if( status_triangle == "open" && moving_triangle != 1){
moving_triangle = 1;
button_triangle.setTargetY(30);
button_triangle.setTargetSpeed(0.15);
button_triangle.gototarget();
}
}

button_triangle.ontargetreached(){
if( status_triangle == "closed" ){
status_triangle = "open";
moving_triangle = 0;
}else if( status_triangle == "open" ){
status_triangle = "closed";
moving_triangle = 0;
}
}

coooooop is offline   Reply With Quote
Old 24th August 2002, 15:32   #2
Vica
Major Dude
 
Vica's Avatar
 
Join Date: Sep 2001
Location: St. Vincent & the Grenadines
Posts: 872
Send a message via ICQ to Vica Send a message via AIM to Vica Send a message via Yahoo to Vica
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:


#include "../../../lib/std.mi"

Global AnimatedLayer SpinningAnim;
Global Button animcontrol;
Global int AnimOn;

System.onScriptLoaded() {
//button & layer definations go here.

AnimOn = 1;
}

animcontrol.onLeftClick() {
if (AnimOn == 1) {
SpinningAnim.pause();
AnimOn = 0;
}
else {
SpinningAnim.start();
AnimOn = 1;
}
}




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]
Vica is offline   Reply With Quote
Old 24th August 2002, 19:07   #3
DirtyLowMoFo
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
DirtyLowMoFo is offline   Reply With Quote
Old 24th August 2002, 21:36   #4
coooooop
Member
 
Join Date: Aug 2002
Posts: 86
thanks guys, i'll try these out and get back to you
coooooop is offline   Reply With Quote
Old 24th August 2002, 22:55   #5
coooooop
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:

#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() {
group triggerDrawer = getScriptGroup();
mybutton = triggerDrawer.findobject("trigger");
group bubbleDrawer = getScriptGroup();
myanimatedlayer = bubbleDrawer.findobject("bubbleani");


ani = 1;
}

mybutton.onEnterArea() {
if (ani == 1) {
DoAniStuff(myanimatedlayer, 10, 0, 100, 0);
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
}
}
}

mybutton.onLeaveArea() {
if (ani == 0) {
DoAniStuff(myanimatedlayer, 0, 10, 100, 0);
ani = 1;

//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 == 1) {
DoAniStuff(myanimatedlayer, 0, 0, 0, 0);
ani = 0;
//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();
}

coooooop is offline   Reply With Quote
Old 24th August 2002, 23:39   #6
DirtyLowMoFo
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
DirtyLowMoFo is offline   Reply With Quote
Old 25th August 2002, 00:11   #7
coooooop
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)"?
coooooop is offline   Reply With Quote
Old 25th August 2002, 00:38   #8
DirtyLowMoFo
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".
DirtyLowMoFo is offline   Reply With Quote
Old 25th August 2002, 00:52   #9
coooooop
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?
coooooop is offline   Reply With Quote
Old 25th August 2002, 01:07   #10
DirtyLowMoFo
Member
 
Join Date: Aug 2002
Posts: 58
screenshot might help
DirtyLowMoFo is offline   Reply With Quote
Old 25th August 2002, 01:27   #11
coooooop
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...)
Attached Images
File Type: png bubbledown.png (25.0 KB, 63 views)
coooooop is offline   Reply With Quote
Old 25th August 2002, 01:28   #12
coooooop
Member
 
Join Date: Aug 2002
Posts: 86
and in the up position
Attached Images
File Type: png bubbleup.png (28.7 KB, 62 views)
coooooop is offline   Reply With Quote
Old 25th August 2002, 01:50   #13
DirtyLowMoFo
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"
DirtyLowMoFo is offline   Reply With Quote
Old 25th August 2002, 03:26   #14
coooooop
Member
 
Join Date: Aug 2002
Posts: 86
no go



thanks though, in this thread you have pretty much taught me how to script lol
coooooop is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Skinning and Design > Modern Skins

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump