473,326 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

internal CSS

This is a simple fix, I hope, but I am unsure how to this.

I am using an internal stylesheet, and doing animation of color. The
first 3 rectangles display properly using hexcodes in the code below.
But I want to use internal stylesheet attribute name/values
for the 4'th animateColor below, which is incorrect.

Can someone fix and tell me what to do for the "from", "to" attributes
in the 4'th <rect> element in the code below.

Thank you.

- Andrew M. Neiderer
US Army Research Laboratory

-------------------------------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<svg xmlns='http://www.w3.org/2000/svg'
xmlns:xlink='http://www.w3.org/1999/xlink'
preserveAspectRatio='none'>

<title>
<!-- -->
</title>

<desc>
<!-- -->
<!-- by Andrew M. Neiderer, 17 Feb 2006. -->
</desc>

<defs>

<!-- style sheet -->

<style type='text/css'>
<![CDATA[
.strongBlue {fill:#151B8D}
.mediumBlue {fill:#2B60DE}
.weakBlue {fill:#3BB9FF}
.strongRed {fill:#FFFFFF}
.strongRedFrom {from:#FFFFFF}
.mediumRed {fill:#F62817}
.weakRed {fill:#F75D59;to:#F75D59}
.green {fill:#00FF00}
]]>
</style>

<!-- scripting definitions -->

<script type='text/ecmascript'>
<![CDATA[
<!-- member data -->

var rect = document.getElementById('r0c0');

<!-- member functions -->

function changeColor(rect)
{
if ( rect != null ) {
rect.setAttribute('class','strongRed');

var animate =
rect.getElementsByTagNameNS('http://www.w3.org/2000/svg','animate').item(0);

if ( animate != null ) {
animate.setAttribute('to','0.20');
}
else
alert("animate == null");
}
else
alert("rect == null");
}
]]>
</script>
</defs>

<rect id='r0c0' x='0.0' y='0.0' width='92.1875' height='49.609375'>
<animateColor attributeName="fill" from="#FF0000" to="#FFFFFF" dur="5s" fill="freeze"/>
</rect>
<rect id='r1c0' x='0.0' y='50.0' width='92.1875' height='49.609375'>
<animateColor attributeName="fill" from="#FFFFFF" to="#00FF00" dur="10s" fill="freeze"/>
</rect>
<rect id='r2c0' x='0.0' y='100.0' width='92.1875' height='49.609375'>
<animateColor attributeName="fill" from="#0000FF" to="#FFFFFF" dur="15s" fill="freeze"/>
</rect>
<rect id='r3c0' x='0.0' y='150.0' width='92.1875' height='49.609375'>
<animateColor attributeName="fill" class="strongRedFrom"
from="strongRedFrom" to="#F75D59"
dur="20s" fill="freeze"/>
</rect>

</svg>
Feb 23 '06 #1
1 1337


Andrew Neiderer wrote:

Can someone fix and tell me what to do for the "from", "to" attributes
in the 4'th <rect> element in the code below.
If you want to animate the fill attribute then you need a valid fill
value. I think you can animate the class attribute as well e.g.

<animate attributeName="class" from="strongRedFrom"
to="strongRed"
dur="20s" fill="freeze"/>
.strongRedFrom {from:#FFFFFF}


but obviously you need to check then if you have other rules for that
class definining other CSS properties (as the animation). And that
animation above would mean class being strongRedFrom for 20s and then
change to strongRed.

I don't know of a way to have an animateColor refer to some color values
defined in CSS stylesheets, you might want to ask on the SVG developers
list whether someone knows more.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Feb 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: qazmlp | last post by:
const has internal linkage in C++, but external linkage in C. Am I right ? But, linker reports multiply-defined error if the following header is included in multiple .cpp files. //...
8
by: Carlos J. Quintero | last post by:
Hi, As you know the current keywords "protected internal" (C#) or "Protected Friend" (VB.Net) means "Protected Or internal" (C#) or "Protected Or Friend" (VB.Net), that is, the member is...
1
by: Ayende Rahien | last post by:
reparing resources... Updating references... Performing main compilation... error CS0583: Internal Compiler Error (0xc0000005 at address 53168B12): likely culprit is 'BIND'. An internal...
4
by: David Sworder | last post by:
Consider the following line of code (it's not important what it does): resp.DocItem=Relations.SelectDocItems_BySearchString(req.SearchPhrase); It turns out that this line is in error. The...
2
by: Chien Lau | last post by:
I frequently define internal UserControl-derived classes in my WinForms apps: internal class MyUserControl:UserControl{ ... } I'll often need to embed these controls in a Form, whose class...
2
by: Kolozs, Áron | last post by:
Hi everybody, The C# compiler reports a Compiler Error CS0052 in the following situation: I declared a type marked as "internal": namespace MyNamespace { internal class MyInteralClass
3
by: al.cpwn | last post by:
do static and inline functions or members have internal linkage? I have been reading this newsgroup on google and found conflicting ideas. Can someone please help me understand why in some places...
9
by: JT | last post by:
Here is the overall structure I will be referring to: End-program ProvideWorkFlow.dll Forms and methods that properly manipulate calls to methods in AccessUtils AccessUtils (a web service)...
13
by: Clive Dixon | last post by:
I am refactoring some code to move some base classes into a separate assembly. One of these base classes has a member property which is 'protected internal'. However when I move these base classes...
9
by: dylan.miller | last post by:
I'm having trouble understanding the internal access modifier. There are many classes in my assembly that should not be accessible outside of the assembly. I've used the internal access modifier...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.