Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- 'im not going to quote out this source too much you should be able to look at this and understand
- 'whats going on if you suck at math dont read any further lol if you dont know what cosin and sin are
- 'you might get away copy pasting this but never understanding it if you do understand math
- 'what sin is and cosin are then this should make sense pretty quickly
- 'basicly i wrote this up in about 20 minutes but here is a rough outline of whats going on
- '
- ' ' _____ _ _ _ _ _ ' '
- ' '|_ _| | | | | | | (_) | | ' '
- ' ' | | ___ __| | | |_ _ _| |_ ___ _ __ _ __ _| | ' '
- ' ' | | / __| / _` | | __| | | | __|/ _ \| '__| |/ _` | | ' '
- ' ' _| |__\__ \_| (_| | | |_| |_| | |_| (_) | | | | (_| | | ' '
- ' ' \___(_)___(_)\__,_| \__|\__,_|\__|\___/|_| |_|\__,_|_| ' '
- 'DECLARATIONS
- 'this is your center point - imagine putting your pencil down in a compass
- Public Center As New Point(120, 120)
- 'timers tick value open timer 1 - tick speed and angle will make your object move faster
- 'your angle for a circle is what ? 360
- Dim tick As Integer
- 'distance from your center point 1 inch radius makes a 2 inch circle if that helps, or you didnt go to school
- Public radius As Integer = 190
- 'basicly the step value of
- Dim angleval As Integer
- 'do you remember rise over run from school ? basicaly im going to break this down as simple as i can
- 'basicly the sine of the angle gives you your rise
- Dim sineval As Integer
- 'and your cosine gives you your run
- Dim cosineval As Integer
- 'the angle that your sine and cosine are to be found for
- Private Angle As Integer = 0
- 'form load and declarition of default values incase a skid just hits start lol
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- MsgBox("Hope this helps you make a more user interactive experience for your users")
- MsgBox("credits i.s.d imports system.drawing on hf, if you use this you dont need to credit me")
- MsgBox("just say thanks in my thread")
- angleval = 1
- cosineval = 180
- sineval = 180
- tick = 1
- radius = 100
- Center = New Point(100, 100)
- End Sub
- 'timer/mathmatics per tick event
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- Try
- Timer1.Interval = tick
- Catch
- End Try
- Dim x As Integer = CInt(Math.Round(radius * Math.Cos(Angle * Math.PI / cosineval)))
- Dim y As Integer = CInt(Math.Round(radius * Math.Sin(Angle * Math.PI / sineval)))
- If CheckBox1.Checked = True Then
- PictureBox1.Location = New Point(x + Center.X, y + Center.Y)
- Else
- End If
- If CheckBox2.Checked Then
- Button4.Location = New Point(x + Center.X, y + Center.Y)
- Button5.Location = New Point(x + Center.X, y + Center.Y)
- Button6.Location = New Point(x + Center.X, y + Center.Y)
- End If
- Try
- angleval = DomainUpDown2.SelectedItem.ToString
- Catch
- angleval = 1
- End Try
- Angle += angleval
- If Angle = 360 Then
- Angle = 0
- End If
- End Sub
- 'start button
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- Timer1.Start()
- End Sub
- 'stop button
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Timer1.Stop()
- End Sub
- 'set button
- Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
- Try
- angleval = DomainUpDown2.Text.ToString
- Catch
- MsgBox("you forgot angle its ok im a catch statement just fix it plox")
- End Try
- cosineval = TextBox2.Text.ToString
- sineval = TextBox1.Text.ToString
- tick = TextBox3.Text.ToString
- Dim x1 As Integer
- Dim y1 As Integer
- x1 = TextBox4.Text.ToString
- y1 = TextBox6.Text.ToString
- Center = New Point(x1, y1)
- radius = TextBox5.Text.ToString
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement