Hi guys I'm trying to learn animation/graphics(they're synonymus to me) what would really help me is a working model of a line turning on an intersection. I've searched around and all i can find is clocks and stuff but all i want is the basic code to cause a line to turn on a centre(like a single clock hand). I just want to learn motion from it, a working code would be massively appreciated. Thanks in advance.
beforetheyknew
0
Junior Poster in Training
Recommended Answers
Jump to PostOk, here's something to play with
import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; public class LinePanel extends JPanel { Timer animationTimer; float angle = 0f; int lineLen = 60; int x = 20; int y = …
Jump to Postimport java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; public class LinePanel2 extends JPanel { Timer animationTimer; int lineLen = 50; // length of the line int x = 65; // x anchor int y = 65; // …
All 5 Replies
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
beforetheyknew
0
Junior Poster in Training
beforetheyknew
0
Junior Poster in Training
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
beforetheyknew
0
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.