English Extending the picture between two coordinates

3 replies
Goto Page
To the start Previous 1 Next To the start
Up
acm
User
Offline Off
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?

IMG:https://i.ibb.co/BwhbN28/xc.jpg



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:
IMG:https://i.ibb.co/9hCYFxn/1.jpg

IMG:https://i.ibb.co/wzfMJcj/22.jpg



@user cs2d_is_a_Gem: I want to extend 1x1 png between these two coordinates as in the picture.
edited 2×, last 10.06.20 02:28:08 am

Admin/mod comment:

Wrong topic section, moved. /user Fraizeraust
10.06.20 02:23:35 am
Up
cs2d_is_a_Gem
User
Offline Off
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
edited 2×, last 10.06.20 05:06:22 am
10.06.20 05:24:52 am
Up
Ortimh
User
Offline Off
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.
Code:
1
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)

Or something like that.
I'm awesome ... and I really like cookies.
10.06.20 04:43:46 pm
Up
acm
User
Offline Off
I found this thread guys.drawline

Thanks for your help, solved.
To the start Previous 1 Next To the start