View Full Version : Jackson Pollocks paint drip
vulcanpimp
10-02-2003, 09:22 AM
Since my other challenge attracted so much interest I've decided to start a new one. This is based on the simple script of paint drips. This can be however simple or complicated as you wish.
In mine I've tried to include an element of velocity. paint drips off a brush depending on the speed you move the brush. If the brush is not moving the paint will drip directly underneath it.
Also note that if you click the mouse the color will change.
Ps its not as easy as it seems to make a masterpiece like the great post modernist painter Jackson Pollock.
The code can be downloaded from my site here as a text file
http://www.geocities.com/hairybobby2000/fxpaintspray.html
or you can mesh about copying the code from the browser here
leafcolor = [0x111833, 0xffffff, 0xff3204, 0x74dfff];
indy = 2;
_root.createEmptyMovieClip("grad", 1);
var oldpos = {x:_root._xmouse, y:_root._ymouse};
var average = {xx:_root._xmouse-oldpos.x, yy:(average.yy*.9)+((_root._xmouse-oldpos.y)*0.1)};
_root.grad.onMouseDown = function() {
indy = indy+1;
if (indy == 3) {
indy = 0;
}
};
_root.grad.onEnterFrame = function() {
average.xx = (average.xx*0.3)+((_root._xmouse-oldpos.x)*0.7);
average.yy = (average.yy*0.3)+((_root._ymouse-oldpos.y)*0.7);
xx = _root._xmouse+(oldaveragex*1.4);
yy = _root._ymouse+(oldaveragey*1.4);
if (oldaveragex-average.xx < 0 || oldaveragey-average.yy<0) {
average.xx = average.xx*0.7;
average.yy = average.yy*0.7;
rando = random(2);
size = random(36)+3;
for (i=0; i<Math.abs(average.xx)/3; i++) {
size = random(14);
xxx = random(20)-10+_root._xmouse+(oldaveragex*(0.1*random(20)));
yyy = random(20)-10+_root._ymouse+(oldaveragey*(0.1*random(20)));
grad.lineStyle(size, (leafcolor[indy]), 10*random(10));
grad.moveTo(xxx-1, yyy-1);
grad.lineTo(xxx+1, yyy+1);
}
} else {
rando = random(116);
size = random(5);
}
if (rando == 1) {
grad.lineStyle(size, (leafcolor[indy]), 20);
grad.moveTo(xx-1, yy-1);
grad.lineTo(xx+1, yy+1);
}
oldaveragex = average.xx;
oldaveragey = average.yy;
oldpos.x = _root._xmouse;
oldpos.y = _root._ymouse;
};
senocular
10-02-2003, 10:19 AM
disable smilies ;)
vulcanpimp
10-03-2003, 09:36 AM
have just recoded it so it moves
leafcolor = [0x111833, 0xffffff, 0xff3204, 0x74dfff];
indy = 2;
deptha = 0;
var oldpos = {x:_root._xmouse, y:_root._ymouse};
var average = {xx:_root._xmouse-oldpos.x, yy:(average.yy*.9)+((_root._xmouse-oldpos.y)*0.1)};
_root.onMouseDown = function() {
indy = indy+1;
if (indy == 3) {
indy = 0;
}
};
_root.onEnterFrame = function() {
average.xx = (average.xx*0.3)+((_root._xmouse-oldpos.x)*0.7);
average.yy = (average.yy*0.3)+((_root._ymouse-oldpos.y)*0.7);
xx = _root._xmouse+(oldaveragex*1.4);
yy = _root._ymouse+(oldaveragey*1.4);
if (oldaveragex-average.xx<0 || oldaveragey-average.yy<0) {
average.xx = average.xx*0.7;
average.yy = average.yy*0.7;
rando = random(2);
size = random(36)+3;
for (i=0; i<Math.abs(average.xx)/3; i++) {
deptha += 1;
size = random(14);
xxx = random(20)-10+_root._xmouse+(oldaveragex*(0.1*random(20)));
yyy = random(20)-10+_root._ymouse+(oldaveragey*(0.1*random(20)));
createsplash(xxx, yyy, size, leafcolor[indy], deptha);
}
} else {
rando = random(116);
size = random(5);
}
if (rando == 1) {
xxx = random(20)-10+_root._xmouse+(oldaveragex*(0.1*random(20)));
yyy = random(20)-10+_root._ymouse+(oldaveragey*(0.1*random(20)));
createsplash(xxx, yyy, size, leafcolor[indy], deptha);
}
oldaveragex = average.xx;
oldaveragey = average.yy;
oldpos.x = _root._xmouse;
oldpos.y = _root._ymouse;
};
function createsplash(xxxx, yyyy, sizer, leafcolors, deptha) {
var splasha = this.createEmptyMovieClip("a"+deptha, deptha);
splasha.endy = yyyy;
splasha.endx = xxxx;
splasha.lineStyle(sizer, leafcolors, 10*random(10));
splasha.moveTo(-1, -1);
splasha.lineTo(1, 1);
splasha._x = _root._xmouse;
splasha._y = _root._ymouse;
splasha.onEnterFrame = function() {
this._x = this._x+((this.endx-this._x)*0.5);
this._y = this._y+((this.endy-this._y)*0.5);
if (Math.abs(this._x-this.endx)<2) {
this.onEnterFrame = undefined;
}
};
}
vulcanpimp
10-04-2003, 08:36 AM
:o
aaah I see, disable smillies , I thought that was some kind of perculiar cryptic message. I didn't realise that the code didn't work because I haven't got flash on the main computer I surf with.
:D :eek: :
Can you post examples of paintings by this guy, vulcanpimp? I'm afraid I've never seen anything he's done *shame*
vulcanpimp
10-06-2003, 07:35 AM
http://www.ibiblio.org/wm/paint/auth/pollock/pollock.number-8.jpg
http://www.nga.gov/feature/pollock/painting1.html
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=jackson+pollock
but I don't think these little jpegs do justice to the real images. At the time he caused quite a stir. People who were not interested in abstract painting suddenly got the buzz. He made paintings by just dripping paint onto a canvas and sold them for shed loads of money. Then everyoe else tried and thought they were going to do the same but no one was quite as good as him.
McGiver
10-06-2003, 01:02 PM
I think I should start painting then... :D (doesn't seems to be a lot of work ;) )
@vulcanpimp:
if this guy sold his images for quite a lot of money, you definately should copyright your engine, because it has to be really worthy then... ;)
vulcanpimp
10-07-2003, 10:01 AM
I could stand all day in the local market and not sell one of my computer generated art pictures. Still its good fun.
Oh POM I forgot to say that the second version is based on one of your programs - your electric challenge on senoculars site. (well the createsplash function is anyway). though I don't think my second version is as good as the first because its tends to hang because of too many clips. But the template for it is yours.
Originally posted by vulcanpimp
Oh POM I forgot to say that the second version is based on one of your programs - your electric challenge on senoculars site.I'm not sure I see what you're talking about but it's cool :D
vulcanpimp
10-09-2003, 11:28 AM
POM
http://www.kirupaforum.com/forums/showthread.php?threadid=34450&perpage=15&pagenumber=2
well it was this example I pinched the template. Its just the code structure I pinched with your createarc function becoming my createsplash function
I wouldn't have mentioned it but you were the first person to reply. :D :eek:
i just saw this great example of what you were trying to do:
http://www.manetas.com/pollock/pollock.swf
click mouse to change color, press C to see copyright and press space to clear :)
darkzak
10-31-2006, 06:13 AM
This seemed like a good challenge to learn how to use the bitmap class on so here is my first attempt at using the bitmap class rather than movieclips to draw. Moving the mouse causes the "paint" to splatter in the direction of the motion and clicking the mouse changes the color.
import flash.display.BitmapData;
import flash.geom.Point;
/*list of colors to use*/
var colors:Array = [0xE5E5D9, 0xF5DAAF, 0x252122, 0xFEA610];
/*the current color to draw with*/
var colorIndex:Number = 0;
/*the bitmap to hold the drawing*/
var bm:BitmapData = new BitmapData(500, 500, false, 0x000000);
/*the old position of the mouse pointer*/
var oldPoint:Point = new Point(_xmouse, _ymouse);
/*draw every time the mouse moves*/
_root.onMouseMove = function() {
var newPoint:Point = new Point(_xmouse, _ymouse);
var dist:Number = Point.distance(oldPoint, newPoint);
/*only draw if the mouse pointer has moved far enough*/
if (dist>.1) {
/*draw a larger point if the mouse has not moved very far */
var radius = 18-Math.min(16, dist);
/*draw splotch under mouse pointer*/
drawSpot(_xmouse, _ymouse, radius);
/*get the velocity of the mouse */
var dx = new Point(_xmouse, oldPoint.y).subtract(oldPoint).x;
var dy = new Point(oldPoint.x, _ymouse).subtract(oldPoint).y;
/*move the point away from the mouse pointer based on the velocity of the mouse*/
/*draw splatter*/
for (var i = 0; i<20; i++) {
drawSpot(_xmouse+(dx*4)*Math.random(), _ymouse+(dy*4)*Math.random(), radius*Math.random());
}
_root.attachBitmap(bm, 1);
oldPoint = newPoint;
updateAfterEvent();
}
};
/*change the color when the mouse is pressed*/
_root.onMouseDown = function() {
colorIndex = ++colorIndex<colors.length ? colorIndex : 0;
};
/*Draw a spot by looping through the radius in the x and y and drawing */
/*points that fall within the radius of the circle.*/
function drawSpot(x:Number, y:Number, radius:Number, color:Number) {
for (var i = -radius/2; i<radius/2; i++) {
for (var j = -radius/2; j<radius/2; j++) {
/*check if the point is within the circle*/
if (Math.sqrt(i*i+j*j)<radius/2) {
bm.setPixel(x+i, y+j, colors[colorIndex]);
}
}
}
}
emergency_pants
11-29-2006, 11:58 PM
Here's another version for my starter
var brushXspeed = 0;
var brushYspeed = 0;
var brushVelocity = 0.01;
var brushElastic = 0.93;
var dripNum:Number = 0;
var thickness:Number = 0;
var dripColour:Number = Math.round(Math.random()*0xFFFFFF);
var mouseListener:Object = new Object();
var mousePressed:Boolean = false;
var drawInterval:Number;
Mouse.addListener(mouseListener);
this.createEmptyMovieClip("painting", this.getNextHighestDepth());
//create crosshair for brush:
this.createEmptyMovieClip("brush", this.getNextHighestDepth());
brush.beginFill(0x0000FF, 30);
brush.lineStyle(2, 0x000000, 100);
brush.moveTo(0, 0);
brush.lineTo(10, 0);
brush.moveTo(0, 0);
brush.lineTo(-10, 0);
brush.moveTo(0, 0);
brush.lineTo(0, 10);
brush.moveTo(0, 0);
brush.lineTo(0, -10);
brush.endFill();
//************************************************** **************
mouseListener.onMouseDown = function() {
mousePressed = true;
dripColour = Math.round(Math.random()*0xFFFFFF);
thickness = 1;
widenLine = true;
trace("***");
};
mouseListener.onMouseUp = function() {
mousePressed = false;
};
//************************************************** **************
function drip() {
//set brush position
brushXspeed = ((_root._xmouse-brush._x)*brushVelocity)+(brushXspeed*brushElastic );
brushYspeed = ((_root._ymouse-brush._y)*brushVelocity)+(brushYspeed*brushElastic );
// add the speed to the current position of the ball
brush._x += brushXspeed;
brush._y += brushYspeed;
//
if (mousePressed) {
if (thickness<15) {
thickness += 0.25;
}
} else {
if (thickness>0) {
thickness -= 0.5;
}
}
dripNum++;
if (thickness>0) {
painting.createEmptyMovieClip("drip"+dripNum, painting.getNextHighestDepth());
var curDrip:MovieClip = painting["drip"+dripNum];
curDrip.cacheAsBitmap = true;
}
var r:Number = thickness;
var x:Number = brush._x+Math.random()*10-5;
var y:Number = brush._y+Math.random()*10-5;
var A:Number = Math.tan(22.5*Math.PI/180);
var endx:Number;
var endy:Number;
var cx:Number;
var cy:Number;
curDrip.beginGradientFill("radial", [dripColour, dripColour], [80, 100], [128, 255], {matrixType:"box", x:0, y:0, w:430, h:150, r:0});
curDrip.moveTo(x+r, y);
for (var angle:Number = 45; angle<=360; angle += 45) {
endx = r*Math.cos(angle*Math.PI/180);
endy = r*Math.sin(angle*Math.PI/180);
cx = endx+r*A*Math.cos((angle-90)*Math.PI/180);
cy = endy+r*A*Math.sin((angle-90)*Math.PI/180);
if (thickness>0) {
curDrip.curveTo(cx+x, cy+y, endx+x, endy+y);
}
}
curDrip.endFill();
updateAfterEvent();
}
//************************************************** **************
drawInterval = setInterval(drip, 15);
Simon
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.