 |
#1
Help required converting ActionScript to Swish MAX Script
|
| |
|
|
01-16-2010, 01:33 PM
|
|
|
|
I am trying to convert the following script. Any help would be gratefully received.
Code:
hsize = 400;
vsize = 400;
rotate1 = true;
rotate2 = false;
rotate3 = false;
flip = true;
slices = 12;
nudge = 9.03;
rotspeed1 = 4.03;
sclfact = 0;
rot = 0;
r = 0;
r2 = 0;
sh1 = 0;
sh2 = 0;
scl = 1;
function onEnterFrame()
{
r = r + rotspeed1;
for (var _loc1 = 0; _loc1 < slices; ++_loc1)
{
m.identity();
m.b = m.b + sh1;
m.c = m.c + sh2;
m.rotate(r2);
m.translate(2 * _xmouse / scl, 2 * _ymouse / scl + _loc1 * sclfact * 10);
m.rotate(r);
m.scale(scl, scl);
slice.clear();
slice.lineStyle();
slice.moveTo(0, 0);
slice.beginBitmapFill(stampImage, m);
slice.lineTo(Math.cos(angle + nudge - 1.570796) * diag, Math.sin(angle + nudge - 1.570796) * diag);
slice.lineTo(Math.cos(-(angle + nudge) - 1.570796) * diag, Math.sin(-(angle + nudge) - 1.570796) * diag);
slice.lineTo(0, 0);
slice.endFill();
m.identity();
if (flip && _loc1 % 2 == 1)
{
m.scale(-1, 1);
}
m.rotate(rot + _loc1 * angle * 2);
m.translate(hsize * 5.01, vsize * 5.01);
map.draw(slice, m, null, "normal", null, true);
}
}
var angle = 3.141593 / slices;
var slice = createEmptyMovieClip("slice", 0);
slice._visible = false;
var diag = Math.sqrt(2 * hsize * hsize) * 6.21;
var map = new flash.display.BitmapData(hsize, vsize, true, 0);
var mapHolder = createEmptyMovieClip("mapHolder", 1);
mapHolder.attachBitmap(map, 0);
var image = flash.display.BitmapData.loadBitmap("image");
var stampImage = new flash.display.BitmapData(image.width, image.height, false);
stampImage.draw(image, new flash.geom.Matrix(5.01, 0, 0, 5.01, 0, 0), null, "normal", null, true);
stampImage.draw(image, new flash.geom.Matrix(-5.01, 0, 0, 5.01, image.width, 0), null, "normal", null, true);
stampImage.draw(image, new flash.geom.Matrix(5.01, 0, 0, -5.01, 0, image.height), null, "normal", null, true);
stampImage.draw(image, new flash.geom.Matrix(-5.01, 0, 0, -5.01, image.width, image.height), null, "normal", null, true);
image.dispose();
var m = new flash.geom.Matrix();
Key.addListener(this);
|
Last edited by nish; 01-20-2010 at 05:00 PM..
|
|
|
|
|
| |
|
|
01-19-2010, 06:41 AM
|
|
nish:
Do you have a link to be viewed as to what this AS1 / AS2 script does?
It would help to see what is going on.
Wayne
|
|
|
|
|
|
| |
|
|
01-20-2010, 11:49 AM
|
|
|
|
Hi Wayne
Thanks for responding.
Here is a link to what it does. Judging by the swish scripts you have shared on this forum I think you are going to like it.
http://megaswf.com/view/820808d2b754...d09bc20e8.html
Big thanks to you for sharing your great swish scripts on here.
|
|
|
|
|
|
#4
kaleidoscope
|
| |
|
|
02-03-2010, 01:02 PM
|
|
I have tried to set up this the way it is scripted, but to no avail. The way swish compiles the finished product the scripting does not work as written.
I like the effect and as I get more time to play with it I will see what I can do to make a Swish file of this.
In the mean time give this a try:
Code:
function onEnterFrame()
{
var img = new flash.display.BitmapData(400, 400, true, 16777215);
img.draw(this);
this.attachBitmap(img, 3, 0, true);
this.filters = [new flash.filters.BlurFilter(3, 3, 2)];
p = Math.min(Math.abs(_xmouse - 200), 200) / 200;
drawShape(this.shape, 200, 200, 200, 50, 3 + Math.min(Math.floor(p * 7), 7), t++);
}
function drawShape(mc, cx, cy, rmax, rmin, corners, rotation)
{
mc.clear();
mc.lineStyle(3, newRgb(t), 100, 0, 0, 0, 0, 0);
mc.moveTo(cx + rmax * Math.abs(Math.sin(t / 20)) * Math.cos(Math.sin(t / 10)), cy + rmax * Math.sin(Math.sin(t / 10)) * Math.abs(Math.sin(t / 20)));
for (var _loc1 = 0; _loc1 <= 6.283185E+000; _loc1 = _loc1 + 6.283185E+000 / corners)
{
mc.lineTo(cx + rmax * Math.abs(Math.sin(t / 20)) * Math.cos(_loc1 + Math.sin(t / 10)), cy + rmax * Math.sin(_loc1 + Math.sin(t / 10)) * Math.abs(Math.sin(t / 20)));
mc.lineTo(cx + rmin * Math.abs(Math.sin(t / 50)) * Math.cos(_loc1 + 6.283185E+000 / corners / 2), cy + rmin * Math.sin(_loc1 + 6.283185E+000 / corners / 2) * Math.abs(Math.sin(t / 50)));
}
mc.filters = [new flash.filters.GlowFilter(newRgb(t + 300), 100, 5, 5, 100)];
}
function newRgb(t)
{
return (Math.floor(256 * Math.abs(Math.sin(t / 30)) << 16) + Math.floor(256 * Math.abs(Math.sin(t / 25)) << 8) + Math.floor(256 * Math.abs(Math.sin(t / 20))));
}
onFrame (1) {
Stage.scaleMode = "noScale";
this.createEmptyMovieClip("shape", 10);
t = 1;
this.createEmptyMovieClip("shape", 10);
t = Math.floor(Math.random() * 100000);
}
a short but nice scripted kaleidoscope effect.
Wayne 
|
|
|
|
|
|
| |
|
|
02-03-2010, 04:39 PM
|
|
I got a new knowledge here,thanks kaleidoscope
|
|
|
|
|
|
| |
|
|
02-06-2010, 01:39 PM
|
|
Hey Wayne, that's another good interact effect you've made there. I really like it!
Many thanks for having a go at converting that actionscript. Much appreciated 
|
|
|
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |
|