SVG animate tag causes undesired put back [duplicate] - svg

This question already has an answer here:
XML SVG - persist the end state of an animation
(1 answer)
Closed 3 years ago.
I am using ANIMATE tag to add some animation to my SVG path. I just set the FROM and TO coordinates, with no loop at all.
It works well but when my path morphs to the final shape it puts back instantly to the beginning "frame" instead of remain in the final shape.
I don't get any error messages, curve just waits, morphs and then goes back to beginning shape.

I just found out that adding a "fill='freeze'" additional attribute does the job

Related

how to implement quest pointer guide in godot 3? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last year.
The community is reviewing whether to reopen this question as of last year.
Improve this question
I am making a 2d platformer.(using gdscript)
I have been trying to make a guide arrow that shows you where to go and have been failing. I far as I can see there is no godot tutorial for this yet.
I have however managed to find a unity tutorial but have been having a hard time converting the instructions to godot.
https://youtu.be/dHzeHh-3bp4
Thanks in advance :)
I'll assume the indicator is a Sprite with whatever icon you want to show.
By the way, you are going to need a reference to the Camera2D. Unlike in 3D where you can ask Godot for the current Camera, you will have to handle references to the current Camera2D yourself.
I'll assume you already have the reference to the Camera2D (perhaps you have the code in the Camera2D script) and the reference to the indicator Sprite (which is another possible place to have the code).
I'll also assume you don't have a rotated Camera2D.
First we need the center of the screen:
var center := camera.get_camera_screen_center()
Then we can get the vector to the position we want:
var vec := target - center
Where target is the position in global coordinates you want to point to. By the way, if vec is Vector2.ZERO, then the target at the center of the screen.
Let us clamp it by the size of the Viewport. We are going to use half the size since we are measuring from the center of the screen. I'll also add a margin, I'll come back to that, for now, assume margin = Vector2.ZERO.
var helf_size := (get_viewport().size - margin) * 0.5
var clamped_vec := Vector2 (
clamp(vec.x, -half_size.x, half_size.x),
clamp(vec.y, -half_size.y, half_size.x)
)
If those are equal, it means the target is on the screen (it didn't need to be clamped):
if clamped_vec == vec:
# target on screen
pass
else:
# target out of screen
pass
Now, to place the indicator we need two things: a rotation and a position, correct?
The rotation is easy. It is the angle of our vec:
sprite.global_rotation = vec.angle()
And for the position, well, it will be our clamped_vec except we need to place the indicator. So we need to add a... Margin! Aha! So, adjust the margin to the size of the indicator you have, and clampled_vec will give us the position, we just need to add center back:
sprite.global_position = clamped_vec + center
And that should do it.

SVG marker hover

I would like to display tooltips on markers setup on a <path> element.
As several old posts pointed out, any events are not processed on markers as defined by the official SVG standard.
Links:
SVG Marker onHover Event (Graph)
Chrome SVG marker element onmouseover
Questions:
Since the linked questions are a few years old, is there an update to this? Is this still the case in the current 2021 world to not be able to receive events on marker elements?
Is there an alternative that is easy to implement and results in fast code for large sets of markers? My only idea currently is to render invisible <circle> elements on top of every marker in order to properly process events. Are there better options?

How to fix OOP Issue with opacity change in pygame [duplicate]

This question already has answers here:
How to convert the background color of image to match the color of Pygame window?
(1 answer)
How do I make the screen ignore the background color of some image?
(1 answer)
Pygame image transparency confusion
(1 answer)
Closed 1 year ago.
I'm trying to make pieces of what makes pygame into it's own separate classes/definitions. But when trying to set the opacity of an image, Instead of showing up as excepted, It starts from it's set opacity and lightens up until it reaches the maximum opacity possible.
I have tried to see if the opacity changes in the module that contains the game, and in the module that contains the classes. Yet they end up giving me the correct number that should be the number that is set for the opacity. And yes I have looked for anything that could possibly start adding up the opacity by mistake.
This is the piece of the code that i'm using to edit an image.
class PicEditor:
def scale(Pic,scaleX,scaleY):
Pic.blit = pygame.transform.scale(Pic.blit,(scaleX,scaleY))
def opacity(Pic,opc):
Pic.blit.set_alpha(opc)
print(opc) #attempt at figuring out the problem
And this is the code that i'm trying to run.
while not crashed:
display.gameLoopTop() #the usual game loop used ontop in pygame
PicEditor.opacity(templatePic,opacityTemplate) #the issue
PicEditor.scale(templatePic,displayX,displayY) #scaling an image (works fine)
templatePic.blitIMG() #bliting the image
display.gameLoopBottom() #the bottom of a game loop which includes the clock function and pygame display update
pygame.quit()
exit()
The expected results are that the image will change it's opacity by 50 (opacityTemplate = 50), then that the image will fit the size of the screen (displayX,displayY) and then that it is blited.
Everything runs perfectly, except that the opacity of the image goes from it's number given- 50, and adds another 50 until it reaches the maximum opacity possible without crashing.

How to animate text in SVG (possibly without using javascript)

I doing SVG animation of some physical process using svg (basically I want whole animation as a single svg file).
Example can be seen here: https://s3.amazonaws.com/public-bucket-vzi0CDPFDE4ywJfvfylfpnDW/dwg.svg .
Now I'd like to add label stating: "Time: 1.23ns" displaying current time. I couldnt find any obvioius way to replace contents of text object, insert format current time inside text element.
It would also be great if this animation wasn't using javascript, just SVG animation.

clicking a svg line its hard to hit,any ideas how to put a click area around a line [duplicate]

This question already has answers here:
JavaScript and SVG: how do you increase the clickable area for an onClick event?
(2 answers)
Closed 8 years ago.
I have a SVG Drawing, I want to click the lines on it. That works fine, if you hit the sometimes realy thin guy.
Does anybody have an idea, how to make the line clicking easier - without just enlarging "stroke-width"?
I tried using two lines (one white thicker one black thin), but then the rendering order destroys parts of the drawing.
any idea?
Draw two lines, one the one you want to see and another thicker i.e. with a stroke-width but with visibility="hidden" and then treat clicks on the hidden line as clicks on the visible line. You may need to adjust the pointer-events property to disable it for the visible line (pointer-events="none") and enable it for the hidden line (pointer-events="all")
one simple trick (in addition to above) is, use an other cursor in css of this element, eg: 'pointer', so your cusomers get a chance to "feel" if they are "above" the line

Resources