sprite-sheet

SVG & Spritesheets

柔情痞子 提交于 2019-12-02 01:44:31
Is this combination possible? I have a retro-style spritesheet, however I'd like to use SVG with it in order to apply some effects such as shadows, outlines, and other things. Don't question it. I know canvas is an alternative, however for this project I'd prefer to use SVG. One major issue is in the way, however: taking individual sprites from a spritesheet. Additionally, I use 1x1 pixel sprites but enlarge the spritesheet to make them 6x6 via hidden canvas, so I'm also working with an image element as opposed to linking to an image outside of the page. Is it possible to choose regions of the

Divide a 2D array into multiple arrays using a separator

吃可爱长大的小学妹 提交于 2019-12-01 13:11:11
I have converted a JavaScript spritesheet to a 2D integer array, and now I'm trying to split a 2D array of integers into multiple 2D arrays, using 1 as the "separator" number. Is there any way to separate a 2D JavaScript array like the following into multiple arrays using a separator number, as shown below? function separate2DArray(arrToSeparate, separator){ //separate the 2D array into multiple 2D arrays, using a //specific number as the separator } //array to separate: [ [5, 5, 5, 1, 5, 4, 5], [5, 5, 4, 1, 4, 3, 4], [1, 1, 1, 1, 1, 1, 1], //1 is the "separator number", which splits the array

Divide a 2D array into multiple arrays using a separator

江枫思渺然 提交于 2019-12-01 09:42:13
问题 I have converted a JavaScript spritesheet to a 2D integer array, and now I'm trying to split a 2D array of integers into multiple 2D arrays, using 1 as the "separator" number. Is there any way to separate a 2D JavaScript array like the following into multiple arrays using a separator number, as shown below? function separate2DArray(arrToSeparate, separator){ //separate the 2D array into multiple 2D arrays, using a //specific number as the separator } //array to separate: [ [5, 5, 5, 1, 5, 4,

PySide: Separating a spritesheet / Separating an image into contiguous regions of color

可紊 提交于 2019-12-01 06:50:27
问题 I'm working on a program in which I need to separate spritesheets , or in other words, separate an image into contiguous regions of color. I've never done any image processing before, so I'm wondering how I would go about this. What would I do after I test for pixel color? What's the best way to determine which pixel goes with each sprite? All the input images have uniform backgrounds, and an alpha channel different from that of the background counts as color. The order of the output images

Animated .GIF vs Spritesheet + JS/CSS

霸气de小男生 提交于 2019-11-30 10:33:50
问题 Which will scale best for performance, file-size, (and my sanity): Animated .gif s or a spritesheet with animations using CSS (and JS when need be)? Filesize So, I'm honestly not sure which will be better here since I don't understand the compression of frames in .gif . My guess would be that they would end up about equal if I can swing it right, but if this is wrong, or if this is a factor for a different reason let me know. The main advantage here, in my mind, goes to Spritesheets as I

Spritesheet in Silverlight

梦想的初衷 提交于 2019-11-29 02:14:12
Does anyone have an example of using a spritesheet in Silverlight? I'd like to clip the image and, when a button is pressed, jump to the next frame. (If the user keeps tapping the button, it'll look like an animation). I've looked around but haven't found exactly what I'm looking for. Thanks for any help. The following will do exactly what you're looking for. You can use the Up ↑ and Down ↓ keys on your keyboard to navigate forwards and backwards through the animation. XAML <Rectangle x:Name="imgRect"> <Rectangle.Fill> <ImageBrush x:Name="imgBrush" ImageSource="walking_spritesheet.png" Stretch

Android: How to rotate a moving animated sprite based on the coordinates of its destination

扶醉桌前 提交于 2019-11-28 19:56:01
My application fires up sprite instances around a Canvas which then move across the screen towards a x/y coordinate. I would like to be able to rotate the sprite around its center so that it faces its destination coordinates. I am using a sprite-sheet and have had issues with clipping. I have also found a lot of good examples but nothing seems to cover exactly what I'm looking for. This example is very close but for efficiency I am using an ImagePooler class and cannot reload an image on each draw/rotation. So if someone had an idea on how to rotate the preloaded image w/out cutting my sprite

How to scale CSS sprites when used as background-image?

会有一股神秘感。 提交于 2019-11-28 11:16:28
问题 .my-sprite { background-image: url("https://i.stack.imgur.com/TkysI.png"); height: 100px; width: 100px; background-position: 0 0; background-position: -200px 0px; } <div class="my-sprite"></div> I can not get my sprites to scale to a smaller dimension. I want it to be like half of the actual size which is 100x100px how can I scale it with background-size property? Right now it only shows the full image size of 100x100px... 回答1: Your image sprite has a dimension of 500x400 so define half this

How do I center a surface (subsurface) around a rectangle? (scaled sprite hitbox / collision rect)

旧巷老猫 提交于 2019-11-28 02:11:50
Currently I have working code which will cycle through a spritesheet, adding each cell/image (9 in total) as a subsurface into a list. As the game updates, I am setting the Player image as the current cell in which the code has indexed by. Meanwhile, I also have a set rectangle which acts as the sprites 'hitbox'/collision rect. However, setting the subsurface as the new image, I found that the sprite scales from the top-left corner of the collision rect. As the sprite is significantly larger than the collision rect, the collision rect is placed far away from the actual char model/sprite. I am

Spritesheet programmatically cutting: best practices

↘锁芯ラ 提交于 2019-11-27 20:57:20
I have a big spritesheet (3808x1632) composed by 42 frames. I would present an animation with these frames and I use a thread to load a bitmap array with all the frames, with a splash screen waiting for its end. I'm not using a SurfaceView (and a draw function of a canvas), I just load frame by frame in an ImageView in my main layout. My approach is similar to Loading a large number of images from a spritesheet The completion actually takes almost 15 seconds, not acceptable. I use this kind of function: for (int i=0; i<TotalFramesTeapotBG; i++) { xStartTeapotBG = (i % framesInRowsTeapotBG) *