The group you are posting to is a
Usenet group . Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
From:
Vez <vezq... @gmail.com>
Date: Thu, 10 Jul 2008 16:48:23 -0700 (PDT)
Local: Thurs, Jul 10 2008 7:48 pm
Subject: SVG animation question
I am the amazing jQuery SVG plugin with the animation extension for a
browser-based game.
When the character walks around, the camera follows him. Right now I
just pan the in huge chunks with this code:
svg.configure({viewBox: x+' '+y+' '+width+' '+height})
So I need to make a custom animation. Here's what I have so far.
jQuery.fx.step.panX = function(fx)
{
fx.elem.setAttribute('viewBox', fx.now+' '+y+' '+width+' '+height)
}
svg.animate({panX: x}, 100)
As you can see, it only works for the x-axis. How do I animate more
than one variable at a time?
Thanks for the help.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Vez <vezq... @gmail.com>
Date: Thu, 10 Jul 2008 20:24:15 -0700 (PDT)
Local: Thurs, Jul 10 2008 11:24 pm
Subject: Re: SVG animation question
I have made some progress, but now I get this zoom in effect every
time I try to pan.
jQuery.fx.step.pan = function(fx)
{
if(fx.state == 0)
{
fx.end = fx.options.curAnim.pan
fx.start =
fx.elem.attributes.getNamedItem('viewBox').nodeValue.split(' ')
fx.dist = fx.end.map(function(val, i){ return val - fx.start[i] })
status(fx.dist)
}
fx.elem.setAttribute('viewBox', fx.dist.map(function(val){ return
fx.pos * val }).join(' '))
}
pan = [x, y, map.view.width, map.view.height].map(
function(val){ return val * map.tile })
$('svg').animate({pan: pan}, {duration: 1000})
On Jul 10, 4:48 pm, Vez <vezq... @gmail.com> wrote:
> I am the amazing jQuery SVG plugin with the animation extension for a
> browser-based game.
> When the character walks around, the camera follows him. Right now I
> just pan the in huge chunks with this code:
> svg.configure({viewBox: x+' '+y+' '+width+' '+height})
> So I need to make a custom animation. Here's what I have so far.
> jQuery.fx.step.panX = function(fx)
> {
> fx.elem.setAttribute('viewBox', fx.now+' '+y+' '+width+' '+height)
> }
> svg.animate({panX: x}, 100)
> As you can see, it only works for the x-axis. How do I animate more
> than one variable at a time?
> Thanks for the help.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Vez <vezq... @gmail.com>
Date: Thu, 10 Jul 2008 21:10:43 -0700 (PDT)
Local: Fri, Jul 11 2008 12:10 am
Subject: Re: SVG animation question
Hey, guys. I'd just like to let you know that I solved the problem and
it's working perfectly now! The previous version had two bugs. The
values in fx.start were strings and not numbers, so they are now
converted with parseFloat. The other problem was that I forgot to add
in the starting values when setting the attribute. Here is the final
extension.
jQuery.fx.step.pan = function(fx)
{
if(fx.state == 0)
{
fx.end = fx.options.curAnim.pan
fx.start =
fx.elem.attributes.getNamedItem('viewBox').nodeValue.split('
').map(parseFloat)
fx.dist = fx.end.map(function(val, i){ return val - fx.start[i] })
}
fx.elem.setAttribute('viewBox', fx.dist.map(function(val, i){ return
(fx.start[i] + fx.pos * val) }).join(' '))
}
Vez wrote:
> I am the amazing jQuery SVG plugin with the animation extension for a
> browser-based game.
> When the character walks around, the camera follows him. Right now I
> just pan the in huge chunks with this code:
> svg.configure({viewBox: x+' '+y+' '+width+' '+height})
> So I need to make a custom animation. Here's what I have so far.
> jQuery.fx.step.panX = function(fx)
> {
> fx.elem.setAttribute('viewBox', fx.now+' '+y+' '+width+' '+height)
> }
> svg.animate({panX: x}, 100)
> As you can see, it only works for the x-axis. How do I animate more
> than one variable at a time?
> Thanks for the help.
You must
Sign in before you can post messages.
You do not have the permission required to post.