spiritedaway
Programmer
new type of menu, have anyone seen a menu like this or has it been done before? i would appricate a URL. please comment about this menu
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
// [onClipEvent of sprite 1 in frame 1]
onClipEvent (load) {
message = "Click, Drag, and Go";
}
// [onClipEvent of sprite 2 in frame 1]
onClipEvent (load) {
leader = 0;
halfwidth = _parent.menuwidth[leader] / 2 + _parent.buffer;
}
onClipEvent (mouseMove) {
current_leader = _parent.get_leader();
if (current_leader != leader) {
if (covered) {
name = eval("_parent.menu" + leader);
colorful = new Color(name);
colorful.setRGB(_parent.regular_colour);
covered = false;
}
leader = current_leader;
sized = false;
halfwidth = _parent.menuwidth[leader] / 2 + _parent.buffer;
trace(_parent.menuwidth[leader]);
}
else if (covered) {
_parent.cursor._x = _parent.point[leader][3];
_parent.cursor._y = _parent.point[leader][4];
}
}
onClipEvent (enterFrame) {
if (sized) {
_parent.change_width(leader, halfwidth);
}
if (covered) {
_parent.ease_position(leader);
_parent.check_close(leader);
}
}
// [onClipEvent of sprite 2 in frame 1]
onClipEvent (load) {
scale = 0.010000;
}
onClipEvent (mouseMove) {
if (dragging) {
xpower = _parent._xmouse - xlast;
ypower = _parent._ymouse - ylast;
xlast = _parent._xmouse;
ylast = _parent._ymouse;
xpower = xpower * scale;
ypower = ypower * scale;
_parent.rotate(ypower, xpower, 0);
_parent.rotate_shadow();
_parent.plot_label();
_parent.draw_menu_shadow();
updateAfterEvent();
}
}
// [Action in Frame 1]
number_of_points = 8;
number_of_lines = 12;
function rotate(xrotate, yrotate) {
xrotate_cosine = Math.cos(xrotate);
xrotate_sine = Math.sin(xrotate);
yrotate_cosine = Math.cos(yrotate);
yrotate_sine = Math.sin(yrotate);
for (i = 0; i < number_of_points; i++) {
rotate_xaxis(i, xrotate_cosine, xrotate_sine);
rotate_yaxis(i, yrotate_cosine, yrotate_sine);
get_perspective_ratio(i);
get_xreal(i);
get_yreal(i);
}
plot();
}
function rotate_xaxis(what, cosine, sine) {
ytemp = point[what][1];
ztemp = point[what][2];
point[what][1] = ytemp * cosine - ztemp * sine;
point[what][2] = ztemp * cosine + ytemp * sine;
}
function rotate_yaxis(what, cosine, sine) {
xtemp = point[what][0];
ztemp = point[what][2];
point[what][0] = xtemp * cosine - ztemp * sine;
point[what][2] = ztemp * cosine + xtemp * sine;
}
function rotate_zaxis(what, cosine, sine) {
xtemp = point[what][0];
ytemp = point[what][1];
point[what][0] = xtemp * cosine - ytemp;
point[what][1] = ytemp * cosine + xtemp;
}
function get_perspective_ratio(what) {
point[what][5] = d / (zcenter + point[what][2] + d);
}
function get_xreal(what) {
point[what][3] = point[what][0] * point[what][5];
}
function get_yreal(what) {
point[what][4] = point[what][1] * point[what][5];
}
function plot() {
draw_line(0, 1, 0);
draw_line(1, 2, 1);
draw_line(2, 3, 2);
draw_line(3, 0, 3);
draw_line(0, 4, 4);
draw_line(1, 5, 5);
draw_line(2, 6, 6);
draw_line(3, 7, 7);
draw_line(4, 5, 8);
draw_line(5, 6, 9);
draw_line(6, 7, 10);
draw_line(7, 4, 11);
}
function draw_line(pt1, pt2, line) {
name = eval("line" + line);
x1 = point[pt1][3];
y1 = point[pt1][4];
x2 = point[pt2][3];
y2 = point[pt2][4];
name._x = x1;
name._y = y1;
name._xscale = x2 - x1;
name._yscale = y2 - y1;
}
d = 1000;
side = 200;
halfside = side / 2;
zcenter = 1000;
point0 = [-halfside, -halfside, -halfside];
point1 = [halfside, -halfside, -halfside];
point2 = [halfside, -halfside, halfside];
point3 = [-halfside, -halfside, halfside];
point4 = [-halfside, halfside, -halfside];
point5 = [halfside, halfside, -halfside];
point6 = [halfside, halfside, halfside];
point7 = [-halfside, halfside, halfside];
for (i = 0; i < number_of_points; i++) {
name = eval("point" + i);
name.push(0);
name.push(0);
name.push(0);
}
point = new Array();
for (i = 0; i < number_of_points; i++) {
name = eval("point" + i);
point.push(name);
ratio = get_perspective_ratio(i);
get_xreal(i, ratio);
get_yreal(i, ratio);
}
for (i = 1; i < number_of_lines; i++) {
duplicateMovieClip(line0, "line" + i, 16384 + -i);
}
rotate(0, 0);
function plot_label() {
get_property();
i = 0;
if (i < number_of_points) {
name = eval("menu" + i);
name._x = point[i][3];
name._y = point[i][4];
name._xscale = menu_point[i][0];
name._yscale = menu_point[i][1];
name._alpha = menu_point[i][2];
i++;
}
}
function get_property() {
i = 0;
if (i < number_of_points) {
menu_point[i][0] = point[i][5] * 200;
menu_point[i][1] = point[i][5] * 200;
menu_point[i][2] = (-point[i][2] + halfrange) / range * rangefade + minfade;
i++;
}
}
halfrange = Math.sqrt(Math.pow(halfside, 2) * 3);
range = 2 * halfrange;
maxfade = 100;
minfade = 5;
rangefade = maxfade - minfade;
menuwidth = new Array();
for (i = 0; i < number_of_points; i++) {
name = eval("menu" + i);
menuwidth.push(name._width);
}
menu_point = new Array();
for (i = 0; i < number_of_points; i++) {
name = eval("menu_point" + i);
name = new Array();
name.push(0);
name.push(0);
name.push(0);
menu_point.push(name);
}
plot_label();
function rotate_shadow() {
for (i = 0; i < number_of_points; i++) {
ratio = get_shadow_ratio(i);
get_shadow_xreal(i, ratio);
get_shadow_yreal(i, ratio);
}
plot_shadow();
}
function get_shadow_ratio(what) {
perp_ratio = d / (zcenter + point[what][2] + d);
return(perp_ratio);
}
function get_shadow_xreal(what, perp_ratio) {
shadowpoint[what][0] = point[what][0] * perp_ratio;
}
function get_shadow_yreal(what, perp_ratio) {
shadowpoint[what][1] = bottom * perp_ratio;
}
function plot_shadow() {
draw_shadowline(0, 1, 0);
draw_shadowline(1, 2, 1);
draw_shadowline(2, 3, 2);
draw_shadowline(3, 0, 3);
draw_shadowline(0, 4, 4);
draw_shadowline(1, 5, 5);
draw_shadowline(2, 6, 6);
draw_shadowline(3, 7, 7);
draw_shadowline(4, 5, 8);
draw_shadowline(5, 6, 9);
draw_shadowline(6, 7, 10);
draw_shadowline(7, 4, 11);
}
function draw_shadowline(pt1, pt2, line) {
name = eval("shadow" + line);
x1 = shadowpoint[pt1][0];
y1 = shadowpoint[pt1][1];
x2 = shadowpoint[pt2][0];
y2 = shadowpoint[pt2][1];
name._x = x1;
name._y = y1;
name._xscale = x2 - x1;
name._yscale = y2 - y1;
}
function draw_menu_shadow() {
i = 0;
if (i < number_of_points) {
name = eval("menu_shadow" + i);
name._width = menu_point[i][1];
name._alpha = menu_point[i][2];
name._x = shadowpoint[i][0];
name._y = shadowpoint[i][1];
i++;
}
}
bottom = 250;
for (i = 1; i < number_of_points; i++) {
duplicateMovieClip(menu_shadow0, "menu_shadow" + i, 16384 + (-i - number_of_points - 3));
}
for (i = 1; i < number_of_lines; i++) {
duplicateMovieClip(shadow0, "shadow" + i, 16384 + (-i - (number_of_points + 3) * 2));
}
shadow1.swapDepths(-number_of_lines);
shadowpoint = new Array();
for (i = 0; i < number_of_points; i++) {
name = eval("shadowpoint" + i);
name = new Array();
name.push(0);
name.push(0);
shadowpoint.push(name);
}
rotate_shadow();
draw_menu_shadow();
function get_leader() {
closest = 0;
for (i = 1; i < number_of_points; i++) {
if (point[i][2] < point[closest][2]) {
closest = i;
}
}
return(closest);
}
function ease_position(leader) {
cursor._x = cursor._x + (point[leader][3] - cursor._x) / ease_distance;
cursor._y = cursor._y + (point[leader][4] - cursor._y) / ease_distance;
}
function check_close(leader) {
xtopow2 = point[leader][3] - cursor._x;
xtopow2 = xtopow2 * xtopow2;
ytopow2 = point[leader][4] - cursor._y;
ytopow2 = ytopow2 * ytopow2;
distance = Math.sqrt(xtopow2 + ytopow2);
if (distance < snapto) {
name = eval("menu" + leader);
colorful = new Color(name);
colorful.setRGB(highlight_colour);
name.swapDepths(number_of_points);
cursor_controller.covered = true;
cursor._x = point[leader][3];
cursor._y = point[leader][4];
}
}
function change_width(leader, halfwidth) {
cursor.left._x = cursor.left._x + -(halfwidth + cursor.left._x) / ease_width;
cursor.right._x = cursor.right._x + (halfwidth - cursor.right._x) / ease_width;
distance = Math.abs(cursor.left._x - halfwidth);
if (distance < snapto) {
cursor_controller.sized = true;
cursor.left._x = -halfwidth;
cursor.right._x = halfwidth;
}
}
ease_distance = 1.750000;
ease_width = 4;
snapto = 3;
buffer = 6;
regular_colour = 16763904;
highlight_colour = 13056;
for (i = 0; i < number_of_points; i++) {
name = eval("menu" + i);
colorful = new Color(name);
colorful.setRGB(regular_colour);
}