Extending the picture between two coordinates
3 replies



10.06.20 02:20:46 am
Hello everyone,
I want to resize my image. Its 1x1, and I want to resize it as below picture. How can I do it with LUA?

Thanks for your help.
Edit: I have now noticed that I have opened the subject to the wrong place, I am very sorry.
Edit x2:


@
cs2d_is_a_Gem: I want to extend 1x1 png between these two coordinates as in the picture.
I want to resize my image. Its 1x1, and I want to resize it as below picture. How can I do it with LUA?

Thanks for your help.
Edit: I have now noticed that I have opened the subject to the wrong place, I am very sorry.
Edit x2:


@

edited 2×, last 10.06.20 02:28:08 am
Admin/mod comment:
Wrong topic section, moved. /
I do not understand what you want to do, if you explain a little more, I can try to do the code.
http://www.cs2d.com/help.php?luacat=image&luacmd=image
to develop it in detail you should read that link a bit, if you put an image and move it with tween_move and adjust its size with tween_scale, you can get what you want.
this also depends on the resolution of the client so you should also use mp_hudscale
http://www.cs2d.com/help.php?luacat=image&luacmd=image
to develop it in detail you should read that link a bit, if you put an image and move it with tween_move and adjust its size with tween_scale, you can get what you want.
this also depends on the resolution of the client so you should also use mp_hudscale
edited 2×, last 10.06.20 05:06:22 am
I've forgotten how CS2D transformation system works. I'm assuming angle 0/360 is at 12 o'clock and the scaling origin is at the center of the image.
Or something like that.
Code:
1
2
3
4
2
3
4
local rot = math.deg(math.atan2(y2-y1, x2-x1)+math.pi*0.5)
local dist = math.sqrt((x1-x2)^2 + (y1-y2)^2)
imagepos(yourimg, (x1+x2)*0.5, (y1+y2)*0.5, rot)
imagescale(yourimg, 1, dist)
local dist = math.sqrt((x1-x2)^2 + (y1-y2)^2)
imagepos(yourimg, (x1+x2)*0.5, (y1+y2)*0.5, rot)
imagescale(yourimg, 1, dist)
Or something like that.
I'm awesome ... and I really like cookies.



