Skip to main content
Home Forums General Silverlight Getting Started using animated gif or png sequences in silverlight
14 replies. Latest Post by neopocott on June 21, 2009.
(0)
rbunn83815
Member
156 points
73 Posts
06-17-2007 1:26 AM |
Hello Everyone,
Could anyone explain how I can incorporate a gif animation or a png sequence animation in silverlight? A short snippet of code would be best since for some reason I can't get it to work. Thanks in advance.
Robert
Bill Reiss
Contributor
4836 points
917 Posts
06-17-2007 8:17 AM |
I haven't done this, but I've done something that may give you a similar effect. If you have a single png with multiple frames in it, lined up side by side, you can set a clip area in a parent canvas that is the size of a single frame and then set canvas.left on the image so that the appropriate frame is inside the clip area. All of the other frames will be clipped out.
WynApse
Star
8426 points
342 Posts
06-19-2007 12:48 PM |
Hi Robert...
I saw this link this morning from back in April. This is for WPF, but there may be some concepts in this video that would be helpful to you.
http://www.contentpresenter.com/
It's the latest one: "Incorporating PNG Sequences into WPF"
Hope this is useful!
-Dave
06-19-2007 4:31 PM |
Yes, this video is where I got the idea to do this, but apparently I don't know everything that is different in silverlight. Lets try this another way, what would the code be to insert a simple gif image onto your canvas? Maybe if I can make sure the basics are working all right I can move on. Thanks in advance.
06-22-2007 9:25 AM |
I didn't see this yesterday, my host was experiencing a Denial Of Service attack :(
Inserting an image is pretty straightforward... here's a sample from a live xaml file on my site:
<Image Source="images/gear_large.png" Canvas.Left="75" Canvas.Top="20">
As always, keep asking questions until you get the help you need !
heuertk
Participant
1386 points
423 Posts
06-22-2007 2:05 PM |
GIFs are not supported in current silverlight builds and sequences in PNG i don't think are rendered as sequences...but definitely no GIFs
06-22-2007 2:13 PM |
Well alrighty then... I could swear I saw somewhere that in the Beta 01 GIFs were usable, so I tried... sorry Tim.. had to try :)
Of course it didn't work... but you'll notice my snippet used a PNG :) ... and I didn't even know PNGs could HAVE sequences... lol
swirling...
1348 points
385 Posts
06-22-2007 4:11 PM |
You're not imagining things. From http://msdn2.microsoft.com/en-us/library/bb188343.aspx, "The Source property can be used to display an images, such as GIF, JPG, and PNG format files."
06-22-2007 4:16 PM |
Okay, all this information is great, but now I am lost on what the answer to the question is. Could someone please clarify what the answer is for me? Thanks for helping everyone.
06-22-2007 4:37 PM |
Even though the online docs say you can use a gif, I tried one and it doesn't work.
I started using PNG with WPF/E CTP, and have just continued that.
My couple lines of code above work correctly for a png file, but it won't display a PNG that has multiple images... if it will display one of them would have to be tested.
Animating a bunch of individual PNGs would be a code issue and that's what the link to the video was all about, although it is for WPF, it might prove useful.
I think that's it.. :)
Keep asking questions though...
06-22-2007 5:03 PM |
Okay then, I am amazed at all the limitations I am finding with Silverlight right now. But I don't doubt that Microsoft is working hard to remove every limitation they can as we speak. I guess a little patience and a lot of work-arounds are in order, at least for now. Thanks for everyones help. It saves me hours of work trying to debug something that can't work in the first place.
GearWorld
840 points
1,101 Posts
10-11-2007 7:33 AM |
I'm personaly looking for a way to put animation effect. You know those like in Valve PORTAL ?
So I could add a transparent animation effect and a video behind !
A video tutorial would be nice to see how this can be achieved.
justintoth
161 points
106 Posts
06-20-2009 11:50 PM |
I see the last post was in 2007, is there any update on this in Silverlight 3? I wanted to show a progress animation when doing async operations.
ksleung
5352 points
1,025 Posts
06-21-2009 12:04 AM |
Nope. This is one of those "nice to have, not enough justification to incorporate, but doable as a Codeplex project" project.
neopocott
368 points
82 Posts
06-21-2009 6:03 AM |
Speaking of a codeplex project, there is a .NET Image Tools library that does actually support animated GIF files with Silverlight 3.
There is no release yet but the source code is available and the author is looking for help contributions.
http://imagetools.codeplex.com/