c# - WPF spritesheet animation -
i trying create animated sprite spritesheet in wpf. current technique using breaking down image of containing frames of animation separate images , swapping them out.
however costly on memory , wondering if there way draw section of image (specify source rectangle) rather splitting image up.
you can this. in order supported wpf's built-in animation system need animate dependency property. in case seems want animate sourcerect
property of croppedbitmap
using rectanimationusingkeyframes
discreterectkeyframe
class.
if you're displaying image using image
element set it's source
property croppedbitmap
, cropped bitmap have source
property set bitmapimage
. cropped bitmap wraps standard bitmap , adds cropping functionality.
Comments
Post a Comment