How do I invert the region under a rect?

Discuss SVG code, accessible via the XML Editor.
Will Pittenger
Posts: 13
Joined: Sun Mar 30, 2008 1:11 pm
Location: Morton, IL

How do I invert the region under a rect?

Postby Will Pittenger » Thu Nov 06, 2008 2:57 pm

This isn't really animation as in the demos I saw. Rather, I want objects to appear when the mouse in inside a region and/or move them up to the top. Take a look at the images in Category:Snaefell mountain course circuit maps. My test image is shown below.. If you look at it, there is a group with the id WestMapBoundary. It is near the bottom of the image Z-order. It contains two objects. One is currently invisible. It has the id WestMapLimits. When the mouse is over WestMapLimits, I want it to appear such that it inverts whatever is under need (effect needed of some sort). I also want the group (WestMapBoundary) to move up to the top of the image Z-order.

I am working on deciding how to do the effect, but need help with the script. Has anyone written scripts like what I had in mind? What is involved in changing elements like that?
SVG Image
Last edited by Will Pittenger on Mon Nov 10, 2008 5:31 pm, edited 2 times in total.
Will Pittenger

Will Pittenger
Posts: 13
Joined: Sun Mar 30, 2008 1:11 pm
Location: Morton, IL

Re: How to use scripts to make objects appear

Postby Will Pittenger » Fri Nov 07, 2008 9:40 am

Well, I never did get the filter above figured out. With Freenode down, I can't ask in the Inkscape channel. (That was Plan A before I decided to start this thread.) I managed to get another filter effect that I wanted working. But not a way to invert the space under a rect. So it looks like I need help with that effect.

As for scripting, I installed Firebug into Firefox so I could see the DOM structure of a SVG file. The Style member of my rect doesn't appear to break the rect's style attributes out into seperate fields. Rather, I see fields that match a normal HTML/XHMTL file. Is this normal or is Firebug's SVG support limited?
Will Pittenger

User avatar
kelan
Posts: 178
Joined: Thu Sep 06, 2007 12:55 am
Location: Unicorn of Open Source
Contact:

Re: How to use scripts to make objects appear

Postby kelan » Sat Nov 08, 2008 1:58 am

Will Pittenger wrote:But not a way to invert the space under a rect. So it looks like I need help with that effect.

A color-inverting filter effect is pretty easy. You can see one I made here:
http://openclipart.org/media/files/kelan/8769

Download the SVG and you can see how it's done. What that filter does when applied to an object is make that object appear as the negative of whatever is underneath it, which sounds like what you want in your first post.

Will Pittenger
Posts: 13
Joined: Sun Mar 30, 2008 1:11 pm
Location: Morton, IL

Re: How do I use scripts to make objects appear?

Postby Will Pittenger » Sat Nov 08, 2008 5:26 am

Something about your image prevents it from working in Firefox 3.0.3. :(
Will Pittenger

Will Pittenger
Posts: 13
Joined: Sun Mar 30, 2008 1:11 pm
Location: Morton, IL

Re: How to use scripts to make objects appear

Postby Will Pittenger » Sat Nov 08, 2008 5:33 am

kelan wrote:
Will Pittenger wrote:But not a way to invert the space under a rect. So it looks like I need help with that effect.

A color-inverting filter effect is pretty easy. You can see one I made here:
http://openclipart.org/media/files/kelan/8769

Download the SVG and you can see how it's done. What that filter does when applied to an object is make that object appear as the negative of whatever is underneath it, which sounds like what you want in your first post.

I am unable to reproduce the effect in my document even with the same parameters.
Will Pittenger

Will Pittenger
Posts: 13
Joined: Sun Mar 30, 2008 1:11 pm
Location: Morton, IL

Re: How to use scripts to make objects appear

Postby Will Pittenger » Sat Nov 08, 2008 11:55 am

Will Pittenger wrote:
kelan wrote:
Will Pittenger wrote:But not a way to invert the space under a rect. So it looks like I need help with that effect.

A color-inverting filter effect is pretty easy. You can see one I made here:
http://openclipart.org/media/files/kelan/8769

Download the SVG and you can see how it's done. What that filter does when applied to an object is make that object appear as the negative of whatever is underneath it, which sounds like what you want in your first post.

I am unable to reproduce the effect in my document even with the same parameters.

I think I now know why I failed to recreate your effect in my document. The "background image" input ignores the contents of things outside the group the object is in. That makes things awkward at best for me as I need to move WestMapBoundary up from the bottom to the top of the image Z-order.
Will Pittenger

Will Pittenger
Posts: 13
Joined: Sun Mar 30, 2008 1:11 pm
Location: Morton, IL

Re: How do I use scripts to make objects appear?

Postby Will Pittenger » Sat Nov 08, 2008 2:55 pm

This is what happens when I modified your image as described above.

As SVG:
SVG Image

As PNG:
Image
Will Pittenger

Will Pittenger
Posts: 13
Joined: Sun Mar 30, 2008 1:11 pm
Location: Morton, IL

Re: How do I use scripts to make objects appear?

Postby Will Pittenger » Mon Nov 10, 2008 5:30 pm

For the moment, I have a temporary location with the scripts installed. Now all I need is the filter to work.

SVG Image
Will Pittenger


Return to “SVG / XML Code”