Hi list inhabitants,
Here's what I've got so far (it's kinda fun, but not really good)
(really dirty behaviour, needs serious refactoring, and you need an 8-bit
member named "bol", just a black dot fading out at the edges)
Part of the behaviour is a rip of from a behaviour by Dave Mennenoh (I'm pretty
lazy :) ) I ripped the angle-calculation from the follow mouse thing in the
director library.
Here goes:
--Attach this behavior to a bitmap sprite
on GetAngle me, slope
deltaH = slope[1]
deltaV = slope[2]
if deltaH then
slope = float (deltaV) / deltaH
angle = atan (slope)
if deltaH < 0 then
angle = angle + pi
end if
else if deltaV > 0 then
angle = pi / 2
else if deltaV < 0 then
angle = (3 * pi) / 2
else
angle = 0
end if
-- Convert to degrees for .rotation
angle = (angle * 180) / pi
return angle
end GetAngle
on mouseDown me
distRange = 10
shapeke = member("bol").image.duplicate()
newMaskImage = image(distRange, distRange, 8, #grayscale)
newMaskImage.copyPixels(shapeke, newMaskImage.rect, shapeke.rect)
undoImage=sprite(me.spriteNum).member.image.duplicate()
upperLeft=point(sprite(me.spriteNum).left,sprite(me.spriteNum).top)
fromCursor=distRange/2
mPoint=the mouseLoc
memPoint=mPoint-upperLeft
mMinFrom1=memPoint[1]-fromCursor
if mMinFrom1<0 then mMinFrom1=0
mMinFrom2=memPoint[2]-fromCursor
if mMinFrom2<0 then mMinFrom2=0
mPlFrom1=memPoint[1]+fromCursor
if mPlFrom1>sprite(me.spriteNum).member.rect[3] then
mPlFrom1=sprite(me.spriteNum).member.rect[3]
mPlFrom2=memPoint[2]+fromCursor
if mPlFrom2>sprite(me.spriteNum).member.rect[4] then
mPlFrom2=sprite(me.spriteNum).member.rect[4]
mI=sprite(me.spriteNum).member.image
brushImage=image(distRange,distRange,32)
brushImage.copyPixels(mI,brushImage.rect,rect(mMinFrom1,mMinFrom2,mPlFrom1,mPlFrom2))
r1=sprite(me.spriteNum).member.rect
bLevel = 255
xold=the mouseLoc-upperLeft
repeat while the stillDown
x=the mouseLoc-upperLeft --current pos in the member
if x[1]>r1[1] and x[1]<r1[3] and x[2]>r1[2] and x[2]<r1[4] then --it's ok
to transform
slope = the mouseLoc - mPoint
deg = GetAngle (me, slope)
rotRaduis = distRange / 2
p1x = (x[1] - distRange / 2) + cos(deg) * rotRaduis
p1y = (x[2] - distRange / 2) + sin(deg) * rotRaduis
p2x = (x[1] + distRange / 2) + cos(deg + 90) * rotRaduis
p2y = (x[2] - distRange / 2) + sin(deg + 90) * rotRaduis
p3x = (x[1] + distRange / 2) + cos(deg + 180) * rotRaduis
p3y = (x[2] + distRange / 2) + sin(deg + 180) * rotRaduis
p4x = (x[1] - distRange / 2) + cos(deg + 270) * rotRaduis
p4y = (x[2] + distRange / 2) + sin(deg + 270) * rotRaduis
r1Quad=[point(p1x,p1y),point(p2x,p2y),point(p3x,p3y),point(p4x,p4y)]
if bLevel > 0 then
bLevel = bLevel - 0.2
end if
xold = x
sprite(me.spriteNum).member.image.copyPixels(brushImage,r1Quad,brushImage.rect,
[#blendLevel:bLevel, #maskImage:newMaskImage])
updateStage
end if
end repeat
end
Chris.
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[email protected] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]