Is there a simple way to draw a loading circle / busy circle in a QDialog or should I just include an animated .gif image for this purpose?
Related
I have a pygame sprite animation where the position and shape of the sprite changes throughout a certain animation sequence (eg. - attack). How do I adjust the sprite's rect for collisions?
My Image: in one part of the animation, my sprite is at the center of a png image file (96x64 pixels). In another part of the animation, my sprite is near the right side of the png image file (96x64 pixels). In another part of the animation, the sprite changes shape (caused by sword movement). Etc.
Do I have to do some math and calculation to adjust the collision rect. of the sprite each frame of the animation or is there an easier method?
I am new to pygame so I'm not sure of all the different features and am not sure where to begin with creating the different rects. for each frame.
PS. I am using a ready-made sprite I found online - each frame is 96x64 pixels in dimension
Frame 1, 11, 22:
It's been a while since I've worked with Pygame but I believe you can use a pygame.mask object. A mask is basically an object with the precise outline of the foreground of an image. It takes considerably more computation power but if you only create a mask for the one main character then it should be okay.
You can create a mask from the image:
myMask = pygame.mask(myImage)
Then you can either use its rect or create a new surface to use:
myRect = myMask.get_rect() # Returns the pygame.Rect object that conatains mask, or:
mySurface - myMask.to_surface() # Returns a pygame.Surface object of the mask
Hope this helps, my info is from:
https://www.pygame.org/docs/ref/mask.html
I have svg rectangles animate from bottom to top and out of the border of the svg. In some resolutions and browsers there is a pixel line building up on top. Sort of like a smear-effect.
I change colors, opacity and sizes of the svg, but the problem consists.
see code in action:
https://codepen.io/anon/pen/ydYdpX
I know fabricjs can play Video and sprite sheet, But I have a lot of gif files, can I play these gif directly with fabricjs? I am not able to find method in Fabricjs website.
According to specs about the Canvas 2DRenderingContext drawImage method,
Specifically, when a CanvasImageSource object represents an animated image in an
HTMLImageElement, the user agent must use the default image of the animation (the one
that the format defines is to be used when animation is not supported or is
disabled), or, if there is no such image, the first frame of the animation, when
rendering the image for CanvasRenderingContext2D APIs.
This means that only the first frame of our animated canvas will be drawn on the canvas.
This is because we don't have any control on animations inside an img tag.
And fabricjs is based on canvas API, thus regulated by the same rules.
The solution is you need to parse all the still-images from your animated gif and to export it as a sprite-sheet. You can then easily animate it in fabricjs thanks to the sprite class.
Here are the facts:
I have a div with rounded corners containing an SVG element with rounded corners that creates a circle.
Inside the circle (SVG) I am drawing four polygons that make out different circle quadrants.
The polygons respond to hover by changing color - so that when a user mouse is over a specific quadrant in the circle - it lights up.
The SVG and the div containing the SVG both have overflow:hidden CSS directive.
When I mouse over an area outside the circle (but inside the clipped rectangle of the polygon) - the corresponding quadrant lights up...
Why is the element responding to mouse over even though I am hovering over a clipped area?
How can I make sure this will not happen? (without creating occluding transparent elements - I want to be able to touch something in the layer below...).
EDIT:
added fiddle as requested:
http://jsfiddle.net/JVQD8/
In the fiddle - note that the surrounding div is bordered with a red line.
the polygons (in blue) are clipped by the red border (div), and when you hover over a polygon it becomes a lighter shade of blue.
The polygon highlights outside the area of the red circle border if on the polygon.
Edit:
As commented by Robert Longson, there is no problem at all in Firefox.
However, in chrome the problem is as described, and in IE the SVG polygon is not even responding to hover.
So the question about chrome remains as is - only in chrome. How do i know if this is a bug that i should report, or if this is a designed behavioral difference?
Try experimenting with the pointer-events attribute.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/pointer-events
I'd like to make my SVG images interactive, with a zoom box that can be moved around by hovering or clicking the mouse in certain areas. Can this be done in a single SVG file, so that I can embed this interactive SVG image in a pdf?
You mean like this? Zoom and Pan